SuperWoodieCCI_v4

Download script
Author: duckfu
SuperWoodieCCI_v4

The SuperWoodiesCCI is a custom technical analysis tool designed to help traders visualize market momentum and identify sustained price trends. Instead of providing a single complex metric, this script breaks down market movement into three distinct visual components: trend direction, strength, and stability.

Core Logic Overview

The indicator operates by analyzing the Commodity Channel Index (CCI), a standard market tool used to measure the difference between an asset's current price and its average price over a specific period. The script takes this raw data and filters it to highlight consistent trends while filtering out "noise" or temporary fluctuations.

How the Data is Processed

The logic follows a multi-step verification process to determine what the market is actually doing:

1. Momentum Tracking The script first calculates two versions of the CCI. It maps these values as primary lines on your chart, allowing you to see the underlying heartbeat of the price movement.

2. Trend Verification (The "Look-Ahead" Logic) To ensure that a move is a genuine trend rather than a momentary spike, the script employs a verification loop. It examines a sequence of consecutive data points (a window of 6 bars).

  • For Uptrends: The logic checks if the CCI remains consistently above zero across this window. If it maintains this position, it confirms a "Long Trend."
  • For Downtrends: Conversely, it checks if the CCI remains consistently below zero. If maintained, it confirms a "Short Trend."

3. Visual Output Once the logic confirms a sustained trend, it translates that data into a color-coded histogram for easier reading:

  • Long Trend (Lime Green): This appears when the market shows sustained positive momentum over the verified window, signaling a period of strength.
  • Short Trend (Red): This appears when the market shows sustained negative momentum, signaling a period of weakness.
  • Neutral/No Trend (Blue): When the market is fluctuating and hasn't met the criteria for either a long or short trend, the indicator remains in a neutral state.

Summary for the Trader

Essentially, this script acts as a sophisticated filter. While a standard CCI might jump up and down frequently, the SuperWoodiesCCI logic requires the momentum to "prove itself" over several bars before it colors the histogram. This helps traders identify when a move has real staying power, making it easier to distinguish between a temporary price fluctuation and a sustained market direction.

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