CCI_Woodies_v1

Download script
CCI_Woodies_v1

This tool is designed to help traders visualize price momentum by analyzing how the market moves over different timeframes simultaneously. Rather than looking at just one speed of price action, it calculates two distinct "momentum profiles" and displays them in a separate window beneath your main price chart.

How the Logic Works

The script operates on the principle of comparing two different cycles of market activity:

  • Long-Term Momentum (Blue Line): This represents the broader trend. It looks at a larger set of historical data points (set by the first period) to determine the overall "velocity" of the price. It helps in identifying the primary direction of the market.
  • Short-Term Momentum (Red Line): This represents the immediate, faster movement of the price. By looking at a smaller window of data (the second period), it captures quick fluctuations and rapid shifts that happen before they become obvious in the larger trend.

What This Means for the Trader

By plotting these two lines together, the script allows you to see the relationship between "fast" and "slow" market movements.

When both lines move in the same direction, it suggests a strong consensus in price action. Conversely, when the lines diverge—for example, if the fast red line moves sharply while the slow blue line remains steady—it can highlight moments of high volatility or early shifts in sentiment that haven't yet fully influenced the larger trend.

Essentially, the tool acts as a multi-layered filter, helping you distinguish between temporary market "noise" and the underlying momentum driving the price.

Indicators Used
Commodity channel index
Miscellaneous
Implements a curve of type %1
14 Views
0 Downloads
0 Favorites
CCI_Woodies_v1
//+------------------------------------------------------------------+
//|                                                  CCI_Woodies.mq4 |
//|                                                                  |
//|                                                                  |
//+------------------------------------------------------------------+

#property indicator_separate_window
#property indicator_buffers 2
#property indicator_color1 RoyalBlue
#property indicator_color2 Red
//---- input parameters
extern int CCIPeriod1=14;
extern int CCIPeriod2=6;
extern int CountBars=300;
//---- buffers
double CCIBuffer1[];
double CCIBuffer2[];
//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
  {
   string short_name;
//---- indicator line
   IndicatorBuffers(2);
   SetIndexStyle(0,DRAW_LINE,STYLE_SOLID,2,RoyalBlue);
   SetIndexStyle(1,DRAW_LINE);
   SetIndexBuffer(0,CCIBuffer1);
   SetIndexBuffer(1,CCIBuffer2);
//----
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| CCI_Woodies                                                         |
//+------------------------------------------------------------------+
int start()
  {
   SetIndexDrawBegin(0,Bars-CountBars+CCIPeriod1);
   SetIndexDrawBegin(1,Bars-CountBars+CCIPeriod1);
   int i,counted_bars=IndicatorCounted();
//----
   if(CountBars<=CCIPeriod1) return(0);
//---- initial zero
   if(counted_bars<1)
      for(i=1;i<=CCIPeriod1;i++) CCIBuffer1[CountBars-i]=0.0;
//----
   i=CountBars-CCIPeriod1-1;
//   if(counted_bars>=CCIPeriod1) i=Bars-counted_bars-1;
   while(i>=0)
     {
      CCIBuffer1[i]=iCCI(NULL,0,CCIPeriod1,PRICE_TYPICAL,i);
      CCIBuffer2[i]=iCCI(NULL,0,CCIPeriod2,PRICE_TYPICAL,i);
      i--;
     }
   return(0);
  }
//+------------------------------------------------------------------+

Comments