Using hour-bars and and 15 Minute bars in one indicator (MQL4)

 

I want have access on the  one-hour bars and at the same time on the 15 minute bars in my indicator:

 int limit = rates_total;

    int count=prev_calculated;

      

    

    for(int ac=limit-count; ac>=0; ac--)

        {                                    

             double High_H1_0 = iHigh(_Symbol,PERIOD_H1,ac);      // the actuall hour-bar 

             double High_H1_1 = iHigh(_Symbol,PERIOD_H1,ac+1);   // the next hour-bar

}



                 for(int bb=limit-count; bb>=0;bb-4)

                  {

                      double Open_M15_0 = iOpen(_Symbol, PERIOD_M15, bb);      

                      double Close_M15_1 = iClose(_Symbol, PERIOD_M15, bb+1); 

                   }

The hour bars are correct, but I cant catch the right 15-minute bar.

 
24h-worker:

I want have access on the  one-hour bars and at the same time on the 15 minute bars in my indicator:

The hour bars are correct, but I cant catch the right 15-minute bar.

The rates_total and prev_calculated applies only to the timeframe your chart is on, so to access data from any other timeframe, you'll need to use iBarShift() with the time at ac, to find the correct bar index.

Reason: