How to get second candle open/high/low/close of opened chart?

 

Hi,

Hope, subject itself asks question:

How to get second candle open/high/low/close of opened chart?

eg:

i opened 4 hour chart. i need the2nd candle of the day. please give me support!

 
  datetime openday= iTime(Symbol(),PERIOD_D1,0); 
    Alert( TimeToStr(openday,TIME_DATE|TIME_MINUTES));
  int b=iBarShift(Symbol(),0,openday,0); 
    Alert(b);
  double open=Open[b-1];
    Alert(open);
 
WDholic:


Thanks. works for me.