Download MetaTrader 5

Value of a particular candle

To add comments, please log in or register
Do you often publish source codes? Find out how to do that correctly!
Uncl3B0B 2016.03.29 18:16 
I need to get the value of a particular candle, for example H1 10:00 today or the previous day. How do I get the size anytime during the day, Low, High, some specific candle?

whroeder1 2016.03.29 19:27  
Get the shift for the time you want. Then get what you want from that candle.
#define SECONDS         int
#define HR2400          86400 // PERIOD_D1 * 60
SECONDS    time(datetime when=0){
   return SECONDS((when == 0) ? TimeCurrent() : when) % HR2400;                }
datetime   date(datetime when=0){
   return ((when == 0) ? TimeCurrent() : when) - time(when);                   }
#define HR1000 36000 // 10 AM
datetime when = date() + HR1000;
int      iBar = iBarShift(NULL,0, when);
double   h = High[iBar];
Uncl3B0B 2016.03.30 08:51  

Thanks for info. 

MQL can not, so your design can not be used. But we helped iBarShift command that I used to what is already known and works it. 


   double A = iHigh(NULL,PERIOD_M1,iBarShift(NULL,PERIOD_M1,D'10:31'));         
   double B = iLow (NULL,PERIOD_M1,iBarShift(NULL,PERIOD_M1,D'10:31'));
   double X = A - B;  // size candle M1 10:31 today


THX for idea 

To add comments, please log in or register