SuperWoodieCCI1

Download script
Author: duckfu
SuperWoodieCCI1

The SuperWoodiesCCI is a specialized technical analysis tool designed to help traders visualize market momentum and identify prevailing trends more clearly than a standard Commodity Channel Index (CCI). By combining multiple layers of data, it transforms a simple numerical oscillator into a multi-colored visual map that highlights the "mood" of the market.

Core Functionality

The script works by analyzing two distinct versions of the CCI indicator simultaneously. It calculates these values based on specific timeframes (periods) and then processes that data to generate a comprehensive visual display featuring three main components:

1. The Primary Trend Lines The tool plots two main lines to show the raw movement of price momentum. One represents the standard calculation, while the other provides a secondary perspective. These allow you to see the immediate fluctuations in market strength.

2. The Trend Histogram (Dynamic Color Coding) The most unique feature of this script is its automated "Trend Detection" logic. Rather than just showing a line, it evaluates the behavior of the momentum over a series of consecutive candles to determine the dominant trend. It uses a specific counting logic to decide which color to display:

  • Long Trend (Lime Green): When the momentum remains consistently positive over a sustained period, the histogram highlights in green, signaling a strong bullish trend.
  • Short Trend (Red): When the momentum remains consistently negative over a sustained period, the histogram highlights in red, signaling a strong bearish trend.
  • Neutral/No Trend (Blue): If the momentum is fluctuating and hasn't maintained a clear direction long enough to qualify as a "trend," the histogram remains neutral.

How it helps the trader

Instead of forcing you to guess whether a movement is a meaningful trend or just temporary noise, this script does the "heavy lifting" for you. It filters out minor price fluctuations and only highlights the trends when they achieve a certain level of consistency.

For a visitor looking at this chart, the visual logic is straightforward:

  • Green areas indicate periods where the market has shown sustained upward strength.
  • Red areas indicate periods where the market has shown sustained downward pressure.
  • Blue and the Line Overlays provide the necessary context for current price positioning and volatility.
Indicators Used
Commodity channel index
Miscellaneous
Implements a curve of type %1
12 Views
0 Downloads
0 Favorites
SuperWoodieCCI1
/*-----------------------------+
|			       |
| Shared by www.Aptrafx.com    |
|			       |
+------------------------------*/

//+------------------------------------------------------------------+
//|                                              SuperWoodiesCCI.mq4 |
//|                                                           duckfu |
//|                                          http://www.dopeness.org |
//+------------------------------------------------------------------+
#property copyright "duckfu"
#property link      "http://www.dopeness.org"

#property indicator_separate_window
#property indicator_buffers 5
#property indicator_color1 White // CCI Colour (note the superfluous vowel, cheers mates ;)
#property indicator_color2 Yellow // TCCI Colour
#property indicator_color3 LimeGreen // Long Trend Histogram Colour 
#property indicator_color4 Red // Short Trend Histogram Colour
#property indicator_color5 Blue // No Trend Histogram Colour
//---- input parameters
extern int       CCI_Period=50;
extern int       TCCI_Period=0;
//---- buffers
double ExtCCIBuffer[];
double ExtTCCIBuffer[];
double ExtLongHistBuffer[];
double ExtShortHistBuffer[];
double ExtFlatHistBuffer[];
//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init(){
//---- indicators
   SetIndexStyle(0,DRAW_LINE,STYLE_SOLID,1);
   SetIndexBuffer(0,ExtCCIBuffer);
   SetIndexStyle(1,DRAW_LINE);
   SetIndexBuffer(1,ExtTCCIBuffer);
   SetIndexStyle(2,DRAW_HISTOGRAM,STYLE_SOLID,1);
   SetIndexBuffer(2,ExtLongHistBuffer);
   SetIndexStyle(3,DRAW_HISTOGRAM,STYLE_SOLID,1);
   SetIndexBuffer(3,ExtShortHistBuffer);
   SetIndexStyle(4,DRAW_HISTOGRAM,STYLE_SOLID,1);
   SetIndexBuffer(4,ExtFlatHistBuffer);
   ArrayInitialize(ExtCCIBuffer,0);
   ArrayInitialize(ExtTCCIBuffer,0);
   ArrayInitialize(ExtLongHistBuffer,0);
   ArrayInitialize(ExtShortHistBuffer,0);
   ArrayInitialize(ExtFlatHistBuffer,0);
//----
   return(0);
}
//+------------------------------------------------------------------+
//| Custor indicator deinitialization function                       |
//+------------------------------------------------------------------+
int deinit(){
//---- TODO: add your code here
   
//----
   return(0);
}
//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
int start(){
   int i,j,limit,counted_bars=IndicatorCounted();
   int uptrending=0,downtrending=0;
//---- TODO: add your code here
   if(counted_bars<0) return(-1);
//---- last counted bar will be recounted
   if(counted_bars>0) counted_bars--;
   limit=Bars-counted_bars;
//---- main loop
   for(i=0; i<limit; i++){
      ExtCCIBuffer[i]=iCCI(NULL,0,CCI_Period,PRICE_TYPICAL,i);
      ExtTCCIBuffer[i]=iCCI(NULL,0,TCCI_Period,PRICE_TYPICAL,i);
      ExtFlatHistBuffer[i]=ExtCCIBuffer[i];     
   }
   
   for(i=0;i<limit;i++){
      for(j=0;j<6;j++){
         if(ExtCCIBuffer[i+j] > 0){
            uptrending++;
         } else if(ExtCCIBuffer[i+j] < 0){
            uptrending=0;         
         }
      }
      
      if(uptrending>5){
         ExtLongHistBuffer[i]=ExtCCIBuffer[i];
         ExtShortHistBuffer[i]=0;
         ExtFlatHistBuffer[i]=0;
      }
   }
   
   for(i=0;i<limit;i++){
      for(j=0;j<6;j++){
         if(ExtCCIBuffer[i+j] < 0){
            downtrending++;
         } else if(ExtCCIBuffer[i+j] > 0){
            downtrending=0;
         }
      }
      
      if(downtrending>5){
         ExtShortHistBuffer[i]=ExtCCIBuffer[i];
         ExtLongHistBuffer[i]=0;
         ExtFlatHistBuffer[i]=0;
      }
   }
   return(0);
}
//+------------------------------------------------------------------+

Comments