Download MetaTrader 5

Load bars in higher timeframe

To add comments, please log in or register
Samuel Beer
407
Samuel Beer  

Hi guys,


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!

whroeder1
16764
whroeder1  
RichPiano: My suspicion is that it does that because the bars are not yet initialized in the higher timeframe. And if so, how do i get around this?
Correct. Unless the chart is that specific pair/TF, you must handle 4066/4073 errors.
Samuel Beer
407
Samuel Beer  
whroeder1:
Correct. Unless the chart is that specific pair/TF, you must handle 4066/4073 errors.

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?

Samuel Beer
407
Samuel Beer  

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..

whroeder1
16764
whroeder1  
I believe only those that read bars
To add comments, please log in or register