FX_Sniper's_Ergodic_CCI_Trigger_(SRDC)

Download script
FX_Sniper's_Ergodic_CCI_Trigger_(SRDC)

This technical tool, known as the FX Sniper's Ergodic CCI & Trigger, is designed to help traders identify market momentum and potential entry points by analyzing price fluctuations. Instead of looking at raw price movement alone, it uses a multi-layered mathematical approach to filter out "noise" and highlight significant shifts in trend direction.

How the Logic Works

The script processes market data through several distinct stages to arrive at a final trading signal:

1. Tracking Price Movement (Momentum) The tool begins by calculating the difference between current closing prices and previous closing prices. This provides a basic map of the market's immediate momentum—whether it is moving up, down, or staying flat.

2. Smoothing and Absolute Value Analysis To ensure the tool doesn't react to minor, insignificant price wiggles, the script performs two specific actions:

  • It calculates the Absolute Momentum, which looks at the magnitude of the move regardless of direction.
  • It applies a series of "Exponential Moving Averages" (EMA). In non-technical terms, this means it smooths out the jagged edges of price data to reveal a clearer underlying trend.

3. The Ergodic CCI Calculation This is the core of the indicator. It takes the smoothed momentum data and compares it against the smoothed absolute momentum data. By dividing these two values, the tool creates a specialized ratio (the "Ergodic CCI"). This ratio helps distinguish between a strong, healthy trend and weak, exhausted price action.

4. The Trigger Mechanism To prevent "false starts" where the indicator might flip back and forth too quickly, the script applies one final smoothing layer to the Ergodic CCI. This creates a secondary line called the Trigger Line.

How to Read the Results

The indicator provides visual feedback in a separate window on your chart:

  • Trend Identification: The interaction between the primary Ergodic CCI line and the Trigger Line determines the market sentiment.
  • Signal Generation:
    • When the Main CCI (Trigger) is higher than the Ergodic CCI, the tool identifies a SHORT bias (potential downward pressure).
    • When the Main CCI (Trigger) is lower than the Ergodic CCI, it identifies a LONG bias (potential upward pressure).
    • When the two lines are equal, the market is considered NEUTRAL, suggesting a period of consolidation or indecision.

In summary, this tool acts as a sophisticated filter that takes raw price changes, smooths them out to remove market noise, and compares the strength of current momentum against historical averages to provide a clear directional signal.

Indicators Used
Moving average indicator
Miscellaneous
Implements a curve of type %1
12 Views
0 Downloads
0 Favorites
FX_Sniper's_Ergodic_CCI_Trigger_(SRDC)
/*-----------------------------+
|			       |
| Shared by www.Aptrafx.com    |
|			       |
+------------------------------*/

//+------------------------------------------------------------------+
//|                                       Louw Coetzer aka FX Sniper |
//|                      Copyright © 2004, MetaQuotes Software Corp. |
//|                                       http://www.metaquotes.net/ |
//+------------------------------------------------------------------+
#property  copyright "Copyright © 2004, Fx Sniper."
#property  link      "http://www.dunno.net/"
//---- indicator settings
#property  indicator_separate_window
#property  indicator_buffers 2
#property  indicator_color1  Blue
#property  indicator_color2  Red


// Ergo Variables

extern int pq =2;
extern int pr = 10;
extern int ps = 1;
extern int trigger =2;

//---- indicator buffers

string signal;
double mtm[];
double absmtm[];
double ErgoCCI[];
double MainCCI[];
double var1[];
double var2[];
double var2a[];
double var2b[];
//double valor1[];
//double valor2[];
//double extvar[];
//double cciSignal[];

//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
  {
//---- 2 additional buffers are used for counting.
   IndicatorBuffers(8);
   
//---- drawing settings
   SetIndexStyle(0,DRAW_LINE,STYLE_SOLID,2,Blue);
   SetIndexStyle(1,DRAW_LINE,STYLE_SOLID,1,Red);
   
   SetIndexBuffer(0,ErgoCCI);
   SetIndexLabel(0,"Egodic CCI");
   SetIndexBuffer(1,MainCCI);
   SetIndexLabel(1,"Trigger Line");
   SetIndexBuffer(2,mtm);
   SetIndexBuffer(3,var1);
   SetIndexBuffer(4,var2);
   SetIndexBuffer(5,absmtm);
   SetIndexBuffer(6,var2a);
   SetIndexBuffer(7,var2b);
      
//---- name for DataWindow and indicator subwindow label

   
//---- initialization done
   return(0);
  }
//+------------------------------------------------------------------+
//| Calculations                                    |
//+------------------------------------------------------------------+
int start()
  {
   int limit;
   int i;
   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;
 
//---- main loop
   
//---- done

   for(i=0; i <= Bars; i++) 
   {
   mtm[i]= Close[i]- Close[i +1];
   }
   for(i=0; i <= Bars-1; i++) 
   { 
    absmtm[i] =  MathAbs(mtm[i]);
   }
   for(i=0; i <= Bars-1; i++) 
   {   
    var1[i]= iMAOnArray(mtm,0,pq,0,MODE_EMA,i);
   }
   for(i=0; i <= Bars-1; i++) 
   {
   var2[i]= iMAOnArray(var1,Bars,pr,0,MODE_EMA,i);
   }
   for(i=0; i <= Bars-1; i++) 
   {
   var2a[i]= iMAOnArray(absmtm,0,pq,0,MODE_EMA,i);
   }
   for(i=0; i <= Bars-1; i++) 
   {
   var2b[i]= iMAOnArray(var2a,0,pr,0,MODE_EMA,i);
   }
    for(i=0; i <= Bars-1; i++) 
   {   
   ErgoCCI[i] = (500 * iMAOnArray(var2,0,ps,0,MODE_EMA,i))/(iMAOnArray(var2b,0,ps,0,MODE_EMA,i)); //var2a[i]/var2b[i];
   
   }
   for(i=0; i<=Bars; i++)
   {
     MainCCI[i]=iMAOnArray(ErgoCCI,0,trigger,0,MODE_EMA,i);
   }
   
   for(i=0; i<=Bars; i++)
   {
      if(MainCCI[i] > ErgoCCI[i])
      {signal = "SHORT";}
      if (MainCCI[i] < ErgoCCI[i])
      {signal = "LONG";}
      if (MainCCI[i] == ErgoCCI[i])
      {signal = "NEUTRAL";}
 
    IndicatorShortName("FX Sniper's Ergodic CCI & Trigger: "+signal);
   return(0); }
  }
//+------------------------------------------------------------------+

Comments