Say like I want to get yesterday's close price of GPBUSD daily bar, while I'm in EURUSD 1H chart window. The function iClose("GBPUSD",1440,1) will return 0 if local history is empty; but how can I know the returned price is actually for yesterday? If local history is not updated does it return incorrect price?
Close price value for the bar of specified symbol with timeframe and shift. If local history is empty (not loaded), function returns 0. To check errors, one has to call the GetLastError() function.
It should be the correct price, or 0.
I waited to the end of the day and I checked it myself. Unfortunately it returns incorrect prices.
For example the last time daily chart for AUDCAD was opened was at July 3rd. And when I ran the script on July 4th, the function iClose("AUDCAD", 1440,1) returned the close price of July 2nd (bar shift=1 relative to last bar known in history: july 3rd). The history is practically "not empty", but it's not updated.
Is there anyway to force history data to be updated before returning results? Or I have to manually open up each chart to get it updated in history?
İ tested the function in first minutes of July 4th on my mt4 server time!
I've come to conclusion that history is not updated if the chart is not opened manually :| So, is there any way to do this without opening charts?
My main idea is to run a script to get prices of previous day on all symbols. But it seems I have no way to do this unless I open all charts to get them updated and then run the script... That's a pain..
Actually I know what he means. I had been waiting for some authorized answer, but nothing comes. The timeframes that do not appear on some chart do not get updated until an MQL read request is made, like iBars. In that case the last 2048 bars are updated. But there is no method I would know about to learn the data is already up-to-date.