Author: created by Luis Damiani
WCCI_v1

This tool is designed to provide traders with a visual representation of market momentum by utilizing a specific combination of the Commodity Channel Index (CCI). Rather than relying on a single data point, it analyzes the relationship between two different timeframes of price movement to help identify trends and potential price shifts.

How the Logic Works

Dual Momentum Tracking The script calculates two distinct versions of the CCI indicator simultaneously:

  1. Fast Momentum: This looks at short-term price fluctuations over a smaller number of candles. It is designed to react quickly to immediate market changes.
  2. Slow Momentum: This tracks price movement over a larger number of candles, providing a broader view of the overall trend and filtering out minor "market noise."

Visual Representation The tool displays these two different speeds of momentum on your chart as separate lines:

  • One line represents the rapid movements of the market.
  • The second line represents the steadier, long-term direction.
  • Additionally, the script generates a histogram component, which helps in visualizing the difference or "gap" between these two speeds.

Smart Efficiency To ensure your trading platform runs smoothly, the script includes an optimization logic. Instead of constantly recalculating every single piece of data on your screen every time the price moves, it intelligently checks if the market parameters (like the asset you are trading or the settings you have chosen) have changed. If everything remains the same, it only calculates the newest data points, saving processing power and ensuring a fluid experience.

Summary for Traders

By comparing the "Fast" and "Slow" momentum lines, users can get a clearer picture of market health. When the fast line moves significantly away from or toward the slow line, it often highlights periods of acceleration or exhaustion, allowing for a more nuanced understanding of where price might be heading next.

Indicators Used
Commodity channel index
Miscellaneous
Implements a curve of type %1
20 Views
0 Downloads
0 Favorites
WCCI_v1
/*-----------------------------+
|			       |
| Shared by www.Aptrafx.com    |
|			       |
+------------------------------*/

//+------------------------------------------------------------------+
//|                                                   WoodiesCCI.mq4 |
//|                                                             Rosh |
//|                                        http://www.metaquotes.net |
//+------------------------------------------------------------------+
#property copyright "created by Luis Damiani; converted by Rosh"
#property link      "http://www.metaquotes.net"

#property indicator_separate_window
#property indicator_buffers 3
#property indicator_color1 Red
#property indicator_color2 DeepSkyBlue
#property indicator_color3 DimGray
//---- input parameters
extern int       A_period=14;
extern int       B_period=6;
extern int       num_bars=550;
// parameters
int shift=0;
bool initDone=true; // áûëî init
int bar=0;
int prevbars=0;
int startpar=0;  // áûëî start
int cs=0;
int prevcs=0;
string commodt="nonono";
int frame=0;
int bars=0;

//---- buffers
double FastWoodieCCI[];
double SlowWoodieCCI[];
double HistoWoodieCCI[];
//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
  {
//---- indicators
   SetIndexStyle(0,DRAW_LINE);
   SetIndexBuffer(0,FastWoodieCCI);
   SetIndexStyle(1,DRAW_LINE,1,3);
   SetIndexBuffer(1,SlowWoodieCCI);
   SetIndexStyle(2,DRAW_HISTOGRAM);
   SetIndexBuffer(2,HistoWoodieCCI);
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| Custor indicator deinitialization function                       |
//+------------------------------------------------------------------+
int deinit()
  {
//---- TODO: add your code here
   
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
int start()
  {
   int    counted_bars=IndicatorCounted();
//---- TODO: add your code here
cs= A_period+B_period+num_bars; //checksum used to see if parameters have been changed
if ((cs==prevcs)&&(commodt==Symbol())&&(frame==(Time[4]-Time[5]))&&((Bars-prevbars)<2)) startpar=Bars-prevbars; else startpar=-1;  //params haven't changed only need to calculate new bar
commodt=Symbol();
frame=Time[4]-Time[5];
prevbars = Bars;
prevcs = cs;
if (startpar==1 | startpar==0)  bar=startpar; else initDone = true;

if (initDone)
   {
   FastWoodieCCI[num_bars-1]=0;
   SlowWoodieCCI[num_bars-1]=0;
   HistoWoodieCCI[num_bars-1]=0;  
   //SetIndexValue(num_bars-1, 0);
   //SetIndexValue2(num_bars-1, 0);
   bar=num_bars-2;
   initDone=false;
   }

//SetLoopCount(0);
for (shift = bar;shift>=0;shift--)
   {
   FastWoodieCCI[shift]=iCCI(NULL,0,B_period,PRICE_TYPICAL,shift);
   SlowWoodieCCI[shift]=iCCI(NULL,0,A_period,PRICE_TYPICAL,shift);
   HistoWoodieCCI[shift]=iCCI(NULL,0,A_period,PRICE_TYPICAL,shift);  
   //SetIndexValue(shift,iCCIEx(A_period,PRICE_TYPICAL,shift));
   //SetIndexValue2(shift,iCCIEx(B_period,PRICE_TYPICAL,shift));
   }

//----
   return(0);
  }
//+------------------------------------------------------------------+

Comments