//+------------------------------------------------------------------+
//|                                           #Soho_Chikou_Histo.mq4 |
//|                      Copyright © 2010, MetaQuotes Software Corp. |
//|                                        http://www.metaquotes.net |
//+------------------------------------------------------------------+

#property copyright "Copyright © 2011, Sohocool."

#property link       "http://sohocool-trading.blogspot.be/search/label/METATRADER"

#property indicator_separate_window
#property indicator_minimum 0.0
#property indicator_maximum 1.0

#property  indicator_buffers 2
#property  indicator_color1  Yellow
#property  indicator_color2  Red
#property indicator_width1 4
#property indicator_width2 4



//---- indicator parameters      
extern int Chinkou=24;
extern int Price=0;


//---- indicator buffers
double   ExtBuffer1[];
double   ExtBuffer2[];

//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
  {//----//---- drawing settings

   SetIndexStyle (0,DRAW_HISTOGRAM, EMPTY,4,Yellow);
   SetIndexBuffer(0,ExtBuffer1);
   SetIndexStyle (1,DRAW_HISTOGRAM, EMPTY,4,Red);
   SetIndexBuffer(1,ExtBuffer2); 
   
   IndicatorShortName("Soho_Chinkou_Histo "+Chinkou+" Price "+Price+" ");
   SetIndexLabel(0,"Chinkou "+Chinkou +" is ABOVE ");
   SetIndexLabel(1,"Chinkou "+Chinkou +" is BELOW ");
   
//---- initialization done
   
   
  
  
//----
   return(0);
  }


  
//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
int start()
  {
  
  
  
   int limit;
   int counted_bars=IndicatorCounted();
//---- last counted bar will be recounted
   if(counted_bars>0) counted_bars--;
   limit=Bars-counted_bars;
//---- macd counted in the 1st buffer
   for(int i=0; i<limit; i++)
   
       if (iMomentum(NULL,0,Chinkou,Price,i)<=100) 
        {
        ExtBuffer2[i]=1;
               
        }
       else
       
        {
        ExtBuffer1[i]=1;
     
        
        }
       
      
   return(0);
  }
//+------------------------------------------------------------------+