SuperWoodieCCI

Download script
Author: duckfu
SuperWoodieCCI

The SuperWoodiesCCI is a visual trading tool designed to help traders identify market trends and momentum by analyzing the Commodity Channel Index (CCI) in a way that filters out "noise" and highlights sustained movements.

Unlike a standard CCI indicator, which can fluctuate rapidly and make it difficult to discern the true direction of the market, this script provides a structured visual environment that categorizes price action into three distinct states: Bullish Trends, Bearish Trends, and Neutral/Flat zones.

How the Logic Works

The tool operates through three main layers of analysis:

1. Core Data Gathering The script begins by calculating two versions of the CCI indicator simultaneously. The primary version looks at a specific period (defaulting to 50), which helps smooth out short-term volatility to reveal the broader market direction.

2. Trend Verification (The "Look-Back" Mechanism) To prevent the indicator from reacting to every minor price wiggle, the script employs a verification logic. It scans the recent history of the CCI values to see if the price has remained consistently above or below zero for a specific duration.

  • It checks a sequence of bars to confirm that the momentum is persistent rather than just a temporary spike.
  • By requiring the data to stay positive (for uptrends) or negative (for downtrends) over a sustained period, it ensures that only "strong" movements are flagged as trends.

3. Visual Categorization (The Histogram) Once the trend is verified, the script translates that data into a color-coded histogram for easy reading:

  • Bullish Trend (Long): When the price shows sustained positive momentum over the verified period, it highlights this on the chart in Lime Green. This indicates a strong upward bias.
  • Bearish Trend (Short): When the price shows sustained negative momentum over the verified period, it highlights this in Red. This indicates a strong downward bias.
  • Neutral/Flat Zone: If the momentum does not meet the specific criteria for either a long or short trend, the script remains neutral (represented in Blue).

Summary for Traders

The primary goal of this script is to provide a "cleaner" view of the market. Instead of forcing you to guess which direction a fluctuating line is heading, the SuperWoodiesCCI does the heavy lifting by confirming trends. It tells you when the market has enough consistent momentum to be considered an active trend, while keeping the rest of the chart clear during periods of indecision.

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