T3 CCI
Download scriptThis tool is a specialized technical analysis indicator designed for the MetaTrader platform. It provides traders with a smoothed visual representation of market momentum by combining two distinct mathematical concepts: the Commodity Channel Index (CCI) and the T3 Moving Average logic.
How it Works
The core purpose of this script is to filter out "market noise"—those small, erratic price fluctuations that can often trigger false signals—to reveal the underlying trend of an asset more clearly. It achieves this through a multi-layered calculation process:
1. Momentum Identification (CCI) The indicator begins by looking at the Commodity Channel Index (CCI). The CCI is a standard momentum oscillator that measures how far the current price is deviating from its average price over a specific period. In simple terms, it helps identify whether an asset is overbought, oversold, or moving with significant strength.
2. Advanced Smoothing (T3 Logic) Instead of using a standard moving average, which can often be sluggish or "lag" behind current price action, this script applies the T3 smoothing algorithm. The T3 is known for its ability to provide a much smoother curve than traditional averages while remaining highly responsive to actual price changes. It uses a series of complex weighting factors (coefficients) to ensure that the resulting line stays as close to the price action as possible without being jagged.
3. Layered Filtration The script doesn't just apply the smoothing once. It passes the CCI data through a series of recursive calculations (represented by the variables e1 through e6 in the logic). By layering these calculations on top of each other, the indicator effectively "refines" the momentum data multiple times.
The Final Output
The result is a single, smooth red line displayed in a separate window below your main price chart. This line represents a highly refined version of market momentum.
- When the line moves upward: It indicates strengthening bullish momentum.
- When the line moves downward: It indicates strengthening bearish momentum.
By using this specialized logic, traders can better identify the "heartbeat" of the market, allowing for smoother trend identification and potentially more reliable entry and exit points by reducing the distractions caused by minor price volatility.
//+------------------------------------------------------------------+
//| T3 CCI.mq4 |
//| adoleh2000 |
//| http://groups.yahoo.com/group/MetaTrader_Experts_and_Indicators/ |
//+------------------------------------------------------------------+
#property copyright "Modification of T3 MACO. Thanks to Perky_z and Mojos Program"
#property link "http://groups.yahoo.com/group/MetaTrader_Experts_and_Indicators/"
#property indicator_separate_window
#property indicator_buffers 1
#property indicator_color1 Red
extern int CCI_Period = 15;
extern int T3_Period = 5;
extern double b = 0.7;
double MapBuffer[];
double e1,e2,e3,e4,e5,e6;
double c1,c2,c3,c4;
double n,w1,w2,b2,b3;
//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
int init()
{
//---- indicators setting
SetIndexStyle(0,DRAW_LINE,STYLE_SOLID,1,Red);
IndicatorDigits(MarketInfo(Symbol(),MODE_DIGITS));
IndicatorShortName("T3_ CCI "+CCI_Period);
SetIndexBuffer(0,MapBuffer);
//---- variable reset
e1=0; e2=0; e3=0; e4=0; e5=0; e6=0;
c1=0; c2=0; c3=0; c4=0;
n=0;
w1=0; w2=0;
b2=0; b3=0;
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=Bars;
//---- indicator calculation
for(int i=limit; i>=0; i--)
{
e1 = w1*(iCCI(NULL,0,CCI_Period,PRICE_MEDIAN,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;
MapBuffer[i]=c1*e6 + c2*e5 + c3*e4 + c4*e3;
}
//----
return(0);
}
//+------------------------------------------------------------------+
Comments