When executing the above code, I get the following:
2019.12.28 16:38:12.284 test EURUSD-ECN,H1:
2019.12.17 23:55:00
2019.12.28 16:38:12.284 test EURUSD-ECN,H1: 2019.12.18 00:00:00
This does not make sense, as taking the iTime of the iBarShift of a certain datetime variable should just return that same datetime.
When
doing the same for M15 or everything above, the datetimes dó match as expected. It seems to concern only M1 and M5.
Anyone seen something like this before or knows what's going on?
When I ran your code the dates were equal. But at day/shift 8 I got a similar error, probably because we're a day or so forward now.
I looped through 100 consecutive days and got a small number of seemingly random days in error; and for m15 and m30 as well, but not for H1, H4...
This one here for M1 at shift 8
Day 7 2019.12.17 00:00:00
Day 7 2019.12.17 00:00:00
Day 8 2019.12.16 00:00:00
Day 8 2019.12.13 23:59:00
===========
But if I make the iBarShift(.....true) I get
Day 7 2019.12.17 00:00:00
Day 7 2019.12.17 00:00:00
Day 8 2019.12.16 00:00:00
Day 8 1970.01.01 00:00
Not sure what that tells us, that there is no M1 for that time? Unless my code is wrong.
When executing the above code, I get the following:
2019.12.28 16:38:12.284 test EURUSD-ECN,H1:
2019.12.17 23:55:00
2019.12.28 16:38:12.284 test EURUSD-ECN,H1: 2019.12.18 00:00:00
This does not make sense, as taking the iTime of the iBarShift of a certain datetime variable should just return that same datetime.
When
doing the same for M15 or everything above, the datetimes dó match as expected. It seems to concern only M1 and M5.
Anyone seen something like this before or knows what's going on?
Because you can always have missing bar if there are no quotes, and the probability to have missing bars is the highest for M1 and decreases as the timeframe increases.
Specifically, in your example that means there is no M5 bar at 2019.12.18 00:00:00, so iBarShift returned the previous bar index.
"Free-of-Holes" Charts - MQL4 Articles
No candle if open = close ? - MQL4 programming forum
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
When executing the above code, I get the following:
2019.12.28 16:38:12.284 test EURUSD-ECN,H1: 2019.12.17 23:55:00
2019.12.28 16:38:12.284 test EURUSD-ECN,H1: 2019.12.18 00:00:00
This does not make sense, as taking the iTime of the iBarShift of a certain datetime variable should just return that same datetime.
When doing the same for M15 or everything above, the datetimes dó match as expected. It seems to concern only M1 and M5.
Anyone seen something like this before or knows what's going on?