Hi Guys
Can someone explain why whenever I have a new chart opened and run iTime(Symbol(),PERIOD_D1,0) or iTime(Symbol(),PERIOD_D1,1)
for the first time. I always got 1970.01.01. TimeCurrent() is showing good time, straight away.
Did you read the documentation ?
Return Value
The opening time of the bar (indicated by the 'shift' parameter) on the corresponding chart or 0 in case of an error. For error details, call the GetLastError() function.
Note
The function always returns actual data. For this purpose it performs a request to the timeseries for the specified symbol/period during each call. This means that if there is no ready data during the first function call, some time may be taken to prepare the result.
The function does not store previous calls results, and there is no local cache for quick value return.
- www.mql5.com
Hi Guys
Can someone explain why whenever I have a new chart opened and run iTime(Symbol(),PERIOD_D1,0) or iTime(Symbol(),PERIOD_D1,1)
for the first time. I always got 1970.01.01. TimeCurrent() is showing good time, straight away.
its perhaps due to available bars not synchronized , check with
datetime d1 = D'1970.01.01'; if(iTime(Symbol(),PERIOD_D1,0) == d1) Print(GetLastError());
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)
- 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
Can someone explain why whenever I have a new chart opened and run iTime(Symbol(),PERIOD_D1,0) or iTime(Symbol(),PERIOD_D1,1)
for the first time. I always got 1970.01.01. TimeCurrent() is showing good time, straight away.