Download MetaTrader 5
To add comments, please log in or register
Subscribe to signals right in MetaTrader. It is easy!
jon
449
jon 2016.11.09 11:47 
How to get the OHLC (Open, High, Low, Close) of the last 1 min bar?
Alain Verleyen
Moderator
30325
Alain Verleyen 2016.11.09 11:59  
jon:
How to get the OHLC (Open, High, Low, Close) of the last 1 min bar?
mql5 or mql4 ?
whroeder1
14245
whroeder1 2016.11.09 12:48  
Predefined Variables - MQL4 Reference
Predefined Variables - MQL4 Reference
  • docs.mql4.com
Predefined Variables - MQL4 Reference
Osama Shaban
1385
Osama Shaban 2016.11.09 15:53  
double  open = iOpen(Symbol(),1,1);
double close = iClose(Symbol(),1,1);
double  high = iHigh(Symbol(),1,1);
double   low = iLow(Symbol(),1,1);
whroeder1
14245
whroeder1 2016.11.09 16:55  
Osama Shaban:
The OP hasn't yet stated MT4 or MT5 and posted in the MT5 forum. Those functions do not exist in MT5.
jon
449
jon 2016.11.09 22:57  
whroeder1:
The OP hasn't yet stated MT4 or MT5 and posted in the MT5 forum. Those functions do not exist in MT5.
MQL5
Alain Verleyen
Moderator
30325
Alain Verleyen 2016.11.09 23:04  
jon:

MQL5

With CopyXXX() functions. CopyRates() will give you OHLC.


   MqlRates rates[1];
   if(CopyRates(Symbol(),PERIOD_M1,0,1,rates)!=1) { /*error processing */ };

   /* USAGE: rates[0].open ; rates[0].high ; rates[0].low ; rates[0].close */

/
To add comments, please log in or register