How to get the OHLC (Open, High, Low, Close) of the last 1 min bar?
jon:
How to get the OHLC (Open, High, Low, Close) of the last 1 min bar?
mql5 or mql4 ?
How to get the OHLC (Open, High, Low, Close) of the last 1 min bar?
jon: How to get the OHLC (Open, High, Low, Close) of the last 1 min bar?
| Perhaps you should read the manual. |
double open = iOpen(Symbol(),1,1);
double close = iClose(Symbol(),1,1);
double high = iHigh(Symbol(),1,1);
double low = iLow(Symbol(),1,1);
double close = iClose(Symbol(),1,1);
double high = iHigh(Symbol(),1,1);
double low = iLow(Symbol(),1,1);
whroeder1:
MQL5
The OP hasn't yet stated MT4 or MT5 and posted in the MT5 forum. Those functions do not exist in MT5. |
jon:
With CopyXXX() functions. CopyRates() will give you OHLC.MQL5
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 */
if(CopyRates(Symbol(),PERIOD_M1,0,1,rates)!=1) { /*error processing */ };
/* USAGE: rates[0].open ; rates[0].high ; rates[0].low ; rates[0].close */
Alain Verleyen #:
With CopyXXX() functions. CopyRates() will give you OHLC.
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 */
if(CopyRates(Symbol(),PERIOD_M1,0,1,rates)!=1) { /*error processing */ };
/* USAGE: rates[0].open ; rates[0].high ; rates[0].low ; rates[0].close */
Is there a way of getting the OHLC data of the last 10 candles as an array that can be written to a .txt file?
Caspase #: Is there a way of getting the OHLC data of the last 10 candles as an array that can be written to a .txt file?
You have quoted the answer. Use CopyRates to get the data, and write it to a file — Documentation on MQL5: File Functions
Documentation on MQL5: File Functions
- www.mql5.com
File Functions - MQL5 Reference - Reference on algorithmic/automated trading language for MetaTrader 5
You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register