Author: created by Luis Damiani
WoodiesCCI

The Woodies CCI tool is a custom technical analysis indicator designed to help traders visualize price momentum and identify potential trends through the comparison of different timeframes. It works by processing market data into three distinct visual components: a fast-moving line, a slow-moving line, and a histogram.

Core Logic Overview

The primary goal of this script is to analyze the "Commodity Channel Index" (CCI), which measures how far the current price of an asset has deviated from its average over a specific period. By using two different speeds for these measurements, the indicator allows you to see both immediate market reactions and broader, long-term trends simultaneously.

How it Works:

  • Dual-Speed Analysis: The script calculates two separate CCI values. One is "Fast" (based on a shorter timeframe) and one is "Slow" (based on a longer timeframe).
    • The Fast Line represents short-term price fluctuations and immediate momentum.
    • The Slow Line represents the underlying trend or the "big picture" of the market.
  • Visual Representation:
    • The Fast and Slow data are plotted as lines on a separate window in your trading platform.
    • A third element, the Histogram, provides a visual representation of the difference between these two movements. This helps traders quickly identify when momentum is accelerating or decelerating relative to the overall trend.
  • Dynamic Updates: The script is designed to be efficient. It monitors the market data in real-time and only recalculates the necessary information as new price bars appear on your chart. If you change your settings (like the periods for the fast or slow calculations), the script detects these changes and refreshes the data automatically.

Summary for Traders

In essence, this indicator helps filter out "market noise." By observing how the Fast line moves in relation to the Slow line and the Histogram, traders can better identify whether a current price movement is a significant trend shift or just a minor fluctuation. It provides a multi-layered view of market energy, making it easier to spot potential entry or exit points based on momentum shifts.

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