//+------------------------------------------------------------------+
//|                                                         HHLL.mq4 |
//+------------------------------------------------------------------+

#property indicator_chart_window
#property indicator_buffers 2
#property indicator_color1 Red
#property indicator_color2 Red
//---- indicator parameters
extern int    NumBars=3;
//---- buffers
double HH[];
double LL[];
//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
  {
//---- indicators
   SetIndexStyle(0,DRAW_LINE);
   SetIndexBuffer(0,HH);
   SetIndexStyle(1,DRAW_LINE);
   SetIndexBuffer(1,LL);
   SetIndexDrawBegin(0,NumBars);
   SetIndexDrawBegin(1,NumBars);
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| Bollinger Bands                                                  |
//+------------------------------------------------------------------+
int start()
  {
   int limit;
   int counted_bars=IndicatorCounted();
   if(counted_bars<0) return(-1);
   if(counted_bars>0) counted_bars--;
   limit=Bars-counted_bars;
   for(int i=0; i<limit; i++)  {
     HH[i] = iHigh(NULL,0,iHighest(NULL,0,MODE_HIGH,NumBars+1,i));
     LL[i] = iLow(NULL,0,iLowest(NULL,0,MODE_LOW,NumBars+1,i));
   }       
   return(0);
  }
//+------------------------------------------------------------------+

//   for(int i=0; i<limit; i++)  {
//     HH[i] = iHigh(NULL,0,iHighest(NULL,0,MODE_HIGH,NumBars+1,i));
//     LL[i] = iLow(NULL,0,iLowest(NULL,0,MODE_LOW,NumBars+1,i));

