Author: Modification of T3 MACO. Thanks to Perky_z and Mojos Program
T3 CCI_v3

This script is a custom technical analysis tool designed for the MetaTrader platform. It functions as a specialized momentum indicator that blends two distinct mathematical concepts: the Commodity Channel Index (CCI) and the T3 Moving Average logic.

Core Logic Overview

The primary goal of this tool is to provide a smoother, more refined view of market momentum than standard indicators can offer. It achieves this by taking raw market data and putting it through a multi-stage "filtering" process.

Here is how the logic flows:

  • Data Source (CCI): The script begins by looking at the Commodity Channel Index (CCI). In trading, the CCI measures how far the current price of an asset is deviating from its statistical average. It helps identify whether a market is overbought, oversold, or trending strongly.
  • The T3 Smoothing Engine: Instead of plotting the raw CCI data—which can often be "noisy" or jump around erratically—the script applies a sophisticated smoothing technique known as a T3 Moving Average. This specific type of average is designed to reduce the lag (delay) typically found in standard moving averages while still effectively filtering out random market fluctuations.
  • The Multi-Stage Calculation: The logic performs a series of recursive calculations. It takes the CCI value and passes it through several successive layers of weighted calculations (represented by the variables e1 through e6). Each layer builds upon the previous one, progressively refining the data.
  • Weighting and Coefficients: The script uses specific mathematical constants (pre-calculated during the initial setup) to ensure that the final output accurately represents the underlying trend. By combining these weights, the indicator produces a "weighted" average that reacts quickly to significant price movements but ignores minor "hiccups" in the market.

How it Appears on the Chart

The result of all this math is a single, continuous line displayed in a separate window below the main price chart (colored Aqua). Because of the T3 logic, this line will appear much more fluid and stable than a standard CCI line.

For a trader, this means the indicator aims to highlight the "true" direction of momentum, helping to identify clearer trends and potential reversal points by stripping away the visual clutter of volatile price action.

Indicators Used
Commodity channel index
Miscellaneous
Implements a curve of type %1
6 Views
0 Downloads
0 Favorites
T3 CCI_v3
//+------------------------------------------------------------------+
//|                                                      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 Aqua

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,Aqua);
    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