Just by way of further explanation:
- I have looked at multiple MTF indicators on here and have not found one that uses LoadCheckHistory(). They appear to use CopyRates() and CopyBuffer() directly. However everything that I have read is telling me that it is critical to assemble the HTF data first!
- I contemplated calling the CheckLoadHistory() script from the indicator, but this appears to be well beyond my self-taught programming skills.
cheers
I was also trying to use CheckLoadHistory() in an indicator and it didn't work. From what I understand the problem is that there are Sleep() commands in that function, that don't work when they are called from an indicator. See https://www.mql5.com/en/docs/common/sleep. Therefore I switched to call that function from an EA.

Documentation on MQL5: Common Functions / Sleep
- www.mql5.com
Sleep - Common 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
Hey everyone. Greetings from Down Under.
I have been trying to implement an indicator that downloads higher timeframe price data in MQL5. I have used various versions of the CheckLoadHistory() functions, including this one https://www.mql5.com/en/docs/series/timeseries_access and this one https://www.mql5.com/en/code/1251.
The first one is written as a script and works perfectly, when used as a script. I have tried it as both a function and embedded within the indicator but it only works AFTER recompiling of the Indicator.
The second one is written as a function and I have the same problem. When the indicator is first attached to the chart, it returns zero bars. If after attachment I compile the indicator again, it then downloads the HTF bars.
Incidentally, they seem to work fine from EA's.
I fully expect that I am missing something obvious here. Nonetheless I am wondering if:
1) has anyone experienced this same problem?
2) and does anyone have an example of a working CheckLoadHistory() function implemented in an Indicator?
Hopefully my amateur description is not too cryptic and someone out there has had this issue before me and figured out how to make it work.