I am currently trying to take baby steps in the world of MQL4. I am trying to load a very small amount of data into an array using:
printf(string(count) + " " + string(GetLastError()));
for(int i=0; i<ArraySize(test); i++)
If I do this using PERIOD_M15 I just get a loop of count = -1 and a 4073 error. If I use PERIOD_H4 it works fine. The M15 chart displays OK, so the data is clearly there. Why does this not work?
Your code looks fine, and i run it on my mt4 without any problem.
Regardless, this simply highlights the need to always check the return values / errors before continuing... because some times the system just needs more time.
The function linked to, opens a hidden chart for the symbol/TF in question (if not already open,) thus updating history, and temporarily placing the symbol on Market Watch (if not already there,) so SymbolInfoDouble(symbol, SYMBOL_BID) or MarketInfo(symbol, MODE_BID) don't also return zero the first call.
Sorry. I have edited the original post to add the code.
I'll give that function a try, thanks.