FX Sniper's T3 CCI

Download script
Author: FX Sniper: T3-CCI :-)
FX Sniper's T3 CCI

The T3-CCI is a technical analysis tool designed for the MetaTrader platform to help traders identify market trends and potential momentum shifts. It works by combining two specific financial indicators: the Commodity Channel Index (CCI) and the T3 moving average filter.

Core Logic and Functionality

The primary objective of this script is to take raw market data and smooth it out significantly to reduce "market noise." While standard indicators can sometimes be jumpy or provide false signals due to minor price fluctuations, this tool uses a sophisticated multi-stage smoothing process to provide a clearer picture of the underlying trend.

1. Data Foundation (The CCI) The script begins by calculating the Commodity Channel Index (CCI). This is a standard momentum indicator that measures how far the current price is moving away from its average price over a specific period. It helps traders see if an asset is overbought, oversold, or simply trending in a specific direction.

2. The T3 Smoothing Filter Instead of showing you the raw CCI results, the script passes that data through a "T3" calculation. This is a specialized type of moving average known for being much faster and smoother than traditional averages. It uses a series of weighted calculations to ensure that the resulting line stays close to the actual price action while filtering out erratic spikes.

3. Visual Representation The script generates three distinct visual elements on your chart:

  • The Main Trend Line: A smooth line that represents the primary calculated trend of the market.
  • Upward Momentum: A visual indicator (histogram) that activates when the momentum is positive.
  • Downward Momentum: A visual indicator (histogram) that activates when the momentum is negative.

Automated Alerts

A key feature of this script is its ability to proactively notify the trader. It monitors the "crossings" of the trend. When the calculated momentum shifts from negative to positive (or vice versa), the script triggers a real-time alert notification. These alerts are designed to inform you immediately when the trend changes direction, allowing for quicker reactions to market movements.

Summary for the User

In simple terms, this tool acts like a sophisticated "trend stabilizer." It looks at the speed and strength of price movements (CCI), cleans up the jagged edges of that data using a high-performance filter (T3), and provides you with a clear visual map of where the market is headed, along with instant notifications when the trend flips.

Indicators Used
Commodity channel index
Miscellaneous
Implements a curve of type %1It issuies visual alerts to the screen
12 Views
0 Downloads
0 Favorites
FX Sniper's T3 CCI
//+------------------------------------------------------------------+
//|                                                       T3 CCI.mq4 |
//|                                                        FX Sniper |
//|                                                                  |
//+------------------------------------------------------------------+
#property copyright "FX Sniper:  T3-CCI :-)"
#property link      "http://dunno.com  :-)/"

#property indicator_separate_window
#property indicator_buffers 3
#property indicator_color1 Blue
#property  indicator_color2  Lime
#property  indicator_color3  Red

extern int CCI_Period = 14;
extern int T3_Period = 5;
extern double b = 0.618;

double e1,e2,e3,e4,e5,e6;
double c1,c2,c3,c4;
double n,w1,w2,b2,b3;
double cci[];
double cciHup[];
double cciHdn[];
double alertTag;
double prev;

//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
  {
//---- indicators setting
    IndicatorBuffers(8);

    SetIndexStyle(0,DRAW_LINE,STYLE_SOLID,2);
    SetIndexStyle(1,DRAW_HISTOGRAM,0,1);
    SetIndexStyle(2,DRAW_HISTOGRAM,0,1); 
        
    IndicatorDigits(MarketInfo(Symbol(),MODE_DIGITS));
    IndicatorShortName("FX Sniper's T3-CCI: "+CCI_Period);
    
    SetIndexBuffer(0,cci);
    SetIndexBuffer(1,cciHup);
    SetIndexBuffer(2,cciHdn);
    SetIndexLabel(0,"T3-CCI");
   

//---- variable reset

    b2=b*b;
    b3=b2*b;
    c1=-b3;
    c2=(3*(b2+b3));
    c3=-3*(2*b2+b+b3);
    c4=(1+3*b+b3+3*b2);
    n=T3_Period;

    if (n<1) n=1;
    n = 1 + 0.5*(n-1);
    w1 = 2 / (n + 1);
    w2 = 1 - w1;
    
//----
    return(0);
  }

//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
int start()
  {
   int limit;
   int counted_bars=IndicatorCounted();
//---- check for possible errors
   if(counted_bars<0) return(-1);
//---- last counted bar will be recounted
   if(counted_bars>0) counted_bars--;
   limit=Bars-counted_bars;
   
//---- indicator calculation
 //for(int i=limit; i>=0; i--)
    
    for(int i=Bars-1; i>=0; i--)
    {
    
    cci[i]= iCCI(NULL,0,CCI_Period, PRICE_TYPICAL ,i);

    
        e1 = w1*cci[i] + w2*e1;
        e2 = w1*e1 + w2*e2;
        e3 = w1*e2 + w2*e3;
        e4 = w1*e3 + w2*e4;
        e5 = w1*e4 + w2*e5;
        e6 = w1*e5 + w2*e6;
        
        cci[i] = c1*e6 + c2*e5 + c3*e4 + c4*e3;
   
     if (cci[i] >= 0 )
      cciHup[i] = cci[i];
     else
      cciHup[i] = 0;
     if(cciHup[i] == 0 && alertTag!=Time[0]) {Alert("FX Sniper T3 Trend Up on ",Symbol()," Period ",Period());alertTag = Time[0];}

    
     if (cci[i] < 0 )
      cciHdn[i] = cci[i];
     else
      cciHdn[i]=0; 
     if(cciHdn[i] == 0 && alertTag!=Time[0]) {Alert("FX Sniper T3 Trend Down on ",Symbol()," Period ",Period());alertTag = Time[0];}
   
        
        
    }   
//----
   return(0);
  }
//+------------------------------------------------------------------+

Comments