Draw line of High/Low on H1 chart, Please help !

 
//+------------------------------------------------------------------+
//|                                         D1_hi_low_line_on_h1.mq4 |
//|                       Copyright ?2010, MetaQuotes Software Corp. |
//|                                        http://www.metaquotes.net |
//+------------------------------------------------------------------+


/* Note:
draw 2 lines on H1 chart: high line and low line

1) high line is drawn by conneting Daily high,so need to find Daily high on H1 chart 
2) low line is drawn by conneting Daily low, so need to find Daily low on H1 chart 
*/

#property copyright "Copyright ?2010, MetaQuotes Software Corp."
#property link      "http://www.metaquotes.net"

#property indicator_chart_window
#property indicator_buffers 2
#property indicator_color1 Maroon
#property indicator_color2 Maroon
extern int TimeFrame = 1440; // D1
//---- buffers
double HighBuf[];
double LowBuf[];
//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
  {
//---- indicators
   SetIndexStyle(0,DRAW_LINE);
   SetIndexBuffer(0,HighBuf);
   SetIndexStyle(1,DRAW_LINE);
   SetIndexBuffer(1,LowBuf);
   
   SetIndexEmptyValue(0,0.0);
   SetIndexEmptyValue(1,0.0);
   
   IndicatorDigits(Digits);
   
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| Custom indicator deinitialization function                       |
//+------------------------------------------------------------------+
int deinit()
  {
//----
   
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
int start()
  {
     int    counted_bars=IndicatorCounted(); 
   if(counted_bars<0) return(-1);
   if(counted_bars>0) counted_bars--;
   int limit = Bars-counted_bars;   
   
   int i,j,k;
   datetime opt;           // opt:  open time of the  current bar 
   datetime opt.d;         //  opt.d: open time of D1 bar 
   int index1_h1;              // bar index of the first H1 bar in one day  
   int index.d;            // index.d :bar index of D1
   double high.d,low.d;     // high.d : bar high of D1 
//----
   
    for(i=0;i<limit;)  // 
    {   
       
       opt = Time[i];       // get the current H1 bar's open time 
       
       index.d = iBarShift(NULL,TimeFrame,opt); // calculate the current D1 bar's index 
       high.d = iHigh(NULL,TimeFrame,index.d);  //......
       low.d = iLow(NULL,TimeFrame,index.d);   //.....    
       opt.d = iOpen(NULL,TimeFrame,index.d);  // calculate the current D1 bar's open time
       
       index1_h1 =iBarShift(NULL,0,opt.d); //  opt.d is the same as  the first H1 bar's open time in one day 
       
      // calculate from right to left,namely,for the first H1 bar of a day to the current ....
      // to compare the H1 bar's High with high.d,if equals
       for(k=index1_h1;k<=i;k--) 
       {
       if(High[k]!= high.d) continue; 
       else
       { HighBuf[k]=High[k];break; } 
       } 
       
        for(k=index1_h1;k<=i;k--)
       {
       if(Low[k]!= low.d) continue;
       else
       {LowBuf[k]=Low[k];break;}
      }
       
       i=index1_h1+1;       // move back to last day ...
    }
   
   
//----
   return(0);
  }
//+------------------------------------------------------------------+

/* Note:
draw 2 lines on H1 chart: high line and low line
1) high line is drawn by conneting Daily high,so need to find Daily high on H1 chart
2) low line is drawn by conneting Daily low, so need to find Daily low on H1 chart
*/

now it draw nothing,why ?

 

Please.

 

Where is increment/decrement statement in for loop?

for(i=0;i<limit; ???? ) //

 
i=index1_h1+1;       // move back to last day 
 
hasayama:

Where is increment/decrement statement in for loop?

for(i=0;i<limit; ???? ) //


for(i=0;i<limit;)  // 
    {   
       
       ......
       
       i=index1_h1+1;       // move back to last day ...
    }
I deal with "for loop" like this for understanding easily
 

then use while not for

 

thanksssssssss........