So i wanted to use iBarShift to find out in a higher timeframe, which bar covers a specific time. But it does return -1 sometimes (i put false as the exact parameter). My suspicion is that it does that because the bars are not yet initialized in the higher timeframe. Only when i enter that higher timeframe the bars catch up and i can apply iBarShift to that timeframe from a lower timeframe without error.
Can somebody confirm my observation?
And if so, how do i get around this? Can I prompt Metatrader to load the higher timeframe independently of which timeframes I jump through?
Thanks in advance!
Thanks. So regarding the other thread where you posted code: As far as I understand, I would need to call iTime() which will then cause MT4 to load the history in its own time. Then I wait until the errors are gone and I'm good to use iBarShift(). Is this about the procedure?
I'm still confused. Will only iTime prompt the platform to download history or will iBarShift also do the trick? I'm having the same problem with another indicator of mine..