Download MetaTrader 5

D1 price on H4 chart issue

To add comments, please log in or register
Do you want to know about the MQL5.community development? Have a look at the Wall!
hhchenfx
886
hhchenfx 2015.02.02 02:10 

Hi Everyone,

This code below works fine with indicator value of D1 on H4 chart.

But when I want to compare Close(previous day on D1)  and Band(previous day on D1), it only work on D1 but not on H4.

Could you please help me to fix it?

Thank you so much.

HHC

  for (i = limit - 1; i >= 0; i--)
  {
    priceabove_bb_htf[i] = EMPTY_VALUE;pricebelow_bb_htf[i] = EMPTY_VALUE;
        
    bar_d1 = iBarShift(Symbol(), D1, Time[i]) + 1;
    if(bar_d1 > (limit-1))
      continue;

//--Band section
   double bb_lower=iBands(Symbol(),D1,20,2,0,PRICE_CLOSE,MODE_LOWER,bar_d1);
   double bb_upper=iBands(Symbol(),D1,20,2,0,PRICE_CLOSE,MODE_UPPER,bar_d1);
   double bb_middle=iBands(Symbol(),D1,20,2,0,PRICE_CLOSE,MODE_MAIN,bar_d1);



//--PRICE ON D1 ABOVE BOLINGER BAND ON D1    WHY CLOSE Close[bar_d1] NOT WORK

   if(iClose(NULL,0,bar_d1)>=bb_upper || iOpen(NULL,0,bar_d1)>=bb_upper ) priceabove_bb_htf[i]=90;
   else
   if(iClose(NULL,0,bar_d1)<=bb_lower || iOpen(NULL,0,bar_d1)<=bb_lower) pricebelow_bb_htf[i]=90;
   
To add comments, please log in or register