//TRO_HL_HIST

 

//---- indicator settings
#property  indicator_separate_window
#property  indicator_buffers 2



#property  indicator_color1  Lime
#property  indicator_color2  Red
#property  indicator_color3  DimGray 
 
//---- indicator buffers
double     H_Buffer[];
double     L_Buffer[];

//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
  {
//---- drawing settings
   SetIndexStyle(0,DRAW_LINE);
   SetIndexStyle(1,DRAW_LINE);

   
   IndicatorDigits(Digits+1);

   SetIndexBuffer(0,H_Buffer);
   SetIndexBuffer(1,L_Buffer);

   
   IndicatorShortName("HL_Hist");
   SetIndexLabel(0,"High");
   SetIndexLabel(1,"Low");
   
#property indicator_level1  1
#property indicator_level2  0
#property indicator_level3  -1

   return(0);
  }
  
//+------------------------------------------------------------------+


int start()
  {
   int limit;
   int counted_bars=IndicatorCounted();
//---- last counted bar will be recounted
   if(counted_bars>0) counted_bars--;
   limit=Bars-counted_bars;

   for(int i=0; i<limit; i++)
   {
      H_Buffer[i]=High[i] - High[i+1] ;
      L_Buffer[i]=Low[i] - Low[i+1] ;

   }
   return(0);
  }
//+------------------------------------------------------------------+