Hi,
I know this question must be already asked earlier but i am not really able to find the proper code for the same.
I need the close price for a specific time in history. I do understand that i can get it via iClose[] function. All i need is the working code for getting bars since that time in history.
example. I need the close price for yesterday at 2pm server time for a 5 minute candle. this value will change every day.
any help is much appreciated.
iBarShift
- There is no such iBarShift in MT5. This is Root /
MT5 General section
not the
MQL4 section, (bottom of the Root page?)
General rules and best pratices of the Forum. - General - MQL5 programming forum - Mohit Marwaha: I need the close price for yesterday at 2pm server time for a 5 minute candle.
- Get or compute the time. You do not want yesterday, you want the last trading day.
Find bar of the same time one day ago - Simple Trading Strategies - MQL4 and MetaTrader 4 - MQL4 programming forum - Use the MT5 equivalent of iBarShift.
Migrating from MQL4 to MQL5 - MQL5 Articles № 18
- Get or compute the time. You do not want yesterday, you want the last trading day.
- There is no such iBarShift in MT5. This is Root /
MT5 General section
not the
MQL4 section, (bottom of the Root page?)
General rules and best pratices of the Forum. - General - MQL5 programming forum - Get or compute the time. You do not want yesterday, you want the last trading day.
Find bar of the same time one day ago - Simple Trading Strategies - MQL4 and MetaTrader 4 - MQL4 programming forum - Use the MT5 equivalent of iBarShift.
Migrating from MQL4 to MQL5 - MQL5 Articles № 18
- Get or compute the time. You do not want yesterday, you want the last trading day.
The OP is talking about iClose[], we can suppose it's iClose() and it's mql4. So moved.
By the way, there is an iBarshift in MT5 ;-)
#1 was referencing Mohamad Zulhairi Baba's post, not OP. That isn't a MT5 iBarShift, that is custom code and the text explicitly states:
Same as the code reference in the article linked #18.
IBarShift is not found in
List of MQL5 Functions - Reference on algorithmic/automated trading language for MetaTrader 5
#1 was referencing Mohamad Zulhairi Baba's post, not OP. That isn't a MT5 iBarShift, that is custom code and the text explicitly states:
Same as the code reference in the article linked #18.
IBarShift is not found in
List of MQL5 Functions - Reference on algorithmic/automated trading language for MetaTrader 5
MQL5 is meant to be used with libraries. There are like 5 different iBarShift libs, take your pick.
#1 was referencing Mohamad Zulhairi Baba's post, not OP. That isn't a MT5 iBarShift, that is custom code and the text explicitly states:
Same as the code reference in the article linked #18.
IBarShift is not found in
List of MQL5 Functions - Reference on algorithmic/automated trading language for MetaTrader 5
Always a pleasure to discuss with you. The OP post is about mql4 !
nicholishen is perfectly right on this. mql5 (and mql4 by the way) is not a close and static language.
Anyway that doesn't matter.

- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Hi,
I know this question must be already asked earlier but i am not really able to find the proper code for the same.
I need the close price for a specific time in history. I do understand that i can get it via iClose[] function. All i need is the working code for getting bars since that time in history.
example. I need the close price for yesterday at 2pm server time for a 5 minute candle. this value will change every day.
any help is much appreciated.