Show your loop. We don't know what ID or timeframe values are.
iTime for the symbol may not be fully updated for the time-frame and symbol the first time that it is called
When dealing with multi-currency you have to wait for data to update. So you should check for a return of zero (iTime return value) and then proceed to check for the error code.
Forum on trading, automated trading systems and testing trading strategies
William Roeder, 2022.09.25 17:44
On MT4: Unless the current chart is that specific symbol(s)/TF(s) referenced, you must handle 4066/4073 errors before accessing candle/indicator values.
Download history in MQL4 EA - MQL4 programming forum - Page 3 #26.4 (2019)On MT5: Unless the current chart is that specific pair/TF, you must synchronize the terminal Data from the Server before accessing candle/indicator values.
Error 4806 while using CopyBuffer() - Expert Advisors and Automated Trading - MQL5 programming forum #10 (2020)
Is it mystical?! It is! - Withdraw - Technical Indicators - MQL5 programming forum (2019)
Timeseries and Indicators Access / Data Access - Reference on algorithmic/automated trading language for MetaTrader 5
Synchronize Server Data with Terminal Data - Symbols - General - MQL5 programming forum #2 (2018)
SymbolInfoInteger doesn't work - Symbols - General - MQL5 programming forum (2019)
When dealing with multi-currency you have to wait for data to update. So you should check for a return of zero (iTime return value) and then proceed to check for the error code.
Thanks Fernando Carreiro and Keith Watford. I am getting Error 4066: Requested history data is in update state.
But I guess that of the current chart had finished updating since.
What can I do to get the correct data from the non-current charts, e.g. iTime, iHigh etc.?
I even tried ChartRedraw(ID) but it did not update.
bool download_history(ENUM_TIMEFRAMES period=PERIOD_CURRENT){ return download_history(_Symbol, period); } bool download_history(SYMBOL symbol, ENUM_TIMEFRAMES period=PERIOD_CURRENT){ if(period == PERIOD_CURRENT) period = (ENUM_TIMEFRAMES)_Period; ResetLastError(); datetime other = iTime(symbol, period, 0); if(_LastError == 0 && other != 0) return true; if(_LastError != ERR_HISTORY_WILL_UPDATED && _LastError != ERR_NO_HISTORY_DATA ) PrintFormat("iTime(%s,%i) Failed: %i", symbol, period, _LastError); return false; }What if I use RefreshRates just like using ChartRedraw for the objects

What can I do to get the correct data from the non-current charts, e.g. iTime, iHigh etc.? I even tried ChartRedraw(ID) but it did not update. I just saw this in the link you referred me to. I don't understand how to use it for the update. What if I use RefreshRates just like using ChartRedraw for the objects
- macpee #: . What if I use RefreshRates just like using ChartRedraw for the objectsRefreshRates updates:
Predefined variables: Ask, Bars, Bid, Close[], High[], Low[], Open[], Point, Time[], Volume[]
RefreshRates - Timeseries and Indicators Access - MQL4 Reference
Predefined Variables - MQL4 Reference
Also updates: Hour, Minute, and Seconds
Minute() returns wrong values - or am I wrong? - MQL4 programming forum (2017)It has nothing to do with other symbols.
- macpee #: What can I do to get the correct data from the non-current charts, e.g. iTime, iHigh etc.?Nothing. If the data is not yet available, return and wait until it is.
- RefreshRates updates:
Predefined variables: Ask, Bars, Bid, Close[], High[], Low[], Open[], Point, Time[], Volume[]
RefreshRates - Timeseries and Indicators Access - MQL4 Reference
Predefined Variables - MQL4 Reference
Also updates: Hour, Minute, and Seconds
Minute() returns wrong values - or am I wrong? - MQL4 programming forum (2017)It has nothing to do with other symbols.
- Nothing. If the data is not yet available, return and wait until it is.
I have added:
Sleep (1000);
RefreshRates;
Sleep(1000);
The_Time = iTime(ChartSymbol(ID)....);
in that order and it seems to be working fine for each of all the non-current charts with the ID.
Don't use Sleep as that will block the thread. Return from the OnTick or OnCalculate event handler, and check on the next event.
Also, RefreshRates() will not do anything for other symbols. William has already explained that in the previous post.
Hi guys, the command
does not update at all when I loop around charts (30 charts).
The time of the Zero bar is too early for non current bars.
Sometimes it gives me the time of bar one of the chart.
Any solution please?
Thanks.
Not sure if this relevant, but don't forget a new bar on your "host" chart, doesn't mean a new bar on other charts. That's because, on the "other" chart, a new bar forms only when a tick is received after the completion of the previous bar.
So, you could look into MarketInfo(sym,MODE_TIME) which gives the last tick time for a symbol.

- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Hi guys, the command
does not update at all when I loop around charts (30 charts).
The time of the Zero bar is too early for non current bars.
Sometimes it gives me the time of bar one of the chart.
Any solution please?
Thanks.