BobCCI2levelsingle

Download script
BobCCI2levelsingle

This technical indicator, known as BobCCI2levelsingle, is designed to provide visual signals for market trends by analyzing price fluctuations and momentum. Unlike standard oscillators that simply look at the speed of price movement, this tool uses a multi-layered mathematical approach to smooth out "noise" and identify meaningful shifts in market direction.

Core Logic and Workflow

The indicator operates through a sequence of data processing steps to arrive at its final visual output:

1. Price Change Analysis The script begins by calculating the difference between consecutive closing prices. This identifies the raw movement of the market for every period. It then takes the "absolute value" of these movements, which allows the tool to measure the intensity of the price action regardless of whether the price is moving up or down.

2. Multi-Stage Smoothing (The "Ergo" Process) To prevent the indicator from reacting to minor, insignificant price flickers, the data passes through several layers of Exponential Moving Averages (EMA).

  • It tracks the trend of the raw movements.
  • It then calculates a secondary average based on those trends.
  • It repeats this process for the absolute intensity of the movements.

3. The ErgoCCI Calculation The heart of the logic lies in comparing these two smoothed data streams: one representing the directional momentum and the other representing the volatility (intensity) of the price action. By dividing these smoothed values against each other and applying a scaling factor, it produces the ErgoCCI line.

4. Signal Generation Finally, the script applies one last layer of smoothing to create a "Trigger Line." The relationship between this Trigger Line and the main ErgoCCI line determines the market sentiment:

  • LONG Signal: Occurs when the smoothed trigger line falls below the main indicator value, suggesting downward pressure or a shift in momentum.
  • SHORT Signal: Occurs when the smoothed trigger line rises above the main indicator value, suggesting upward momentum.
  • NEUTRAL Signal: Occurs when the two lines intersect or are equal, indicating a period of equilibrium or transition.

Visual Presentation

The tool displays these results in a separate window on your chart. It utilizes specific horizontal levels (such as 0 and +/- 400) to help the user identify overbought or oversold conditions, providing a clear visual landscape of where the current market momentum sits relative to historical extremes.

Indicators Used
Moving average indicator
Miscellaneous
Implements a curve of type %1
11 Views
0 Downloads
0 Favorites
BobCCI2levelsingle
//+------------------------------------------------------------------+
//|                                               BobCCI2levelsingle |
//|                      Copyright © 2004, MetaQuotes Software Corp. |
//|                                       http://www.metaquotes.net/ |
//+------------------------------------------------------------------+
#property  copyright "Copyright © 2004, ."
#property  link      ""
//---- indicator settings
#property  indicator_separate_window
#property  indicator_buffers 2
#property  indicator_color1  Yellow
#property  indicator_color2  DRAW_NONE


// Ergo Variables

extern int pq =2;
extern int pr = 2;
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,3,Yellow);
   SetIndexStyle(1,DRAW_NONE);
   
   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);
   
   SetLevelValue(0,480);
   SetLevelValue(1,400);
   SetLevelValue(2,0);
   SetLevelValue(3,-400);
   SetLevelValue(4,-480);
   SetLevelStyle(STYLE_DOT,1,White);
    
//---- 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("Bob");
   return(0); }
  }
//+------------------------------------------------------------------+

Comments