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
Trying to handle errors 4066/4073 I used the Comment function to fetch values for iBarShift and iTime for other Symbols and timeframes.
When accessing price data for another symbol/TF that has not been updated, for example iTime returns 2019.01.01 (expected) but iBarshift sometimes returns 0 or -1.
I can not find the answer to this problem as I would expect iBarshift to always return -1 if the chart is not updated.
I have also tried the request data from another symbols, sleep for 5 seconds and re request again, but in some cases some charts were returning non updated price values.
I don't want to increase the time for sleep as that would slow down the EA.
Forgot to add it but DayNow and DayUpdated are globally declared string variables.
EDIT: Alright, I found the error.
should be
I will print values and report if iBarShift return -1 as expected.
So there seems to be a discrepancy between iTime and iBarShift.
When I requested price data for the EURNOK, which I never did before, iTime's date is 1970.01.01, which makes sense. But the iBarShift returns 0 when I was expecting -1.
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 - Forex Calendar - MQL4 programming forum - Page 3 #26 № 4
You haven't tried to handle anything. Go through your array of symbols/timeframes first and handle them.
Trying to handle errors 4066/4073 I used the Comment function to fetch values for iBarShift and iTime for other Symbols and timeframes.
When accessing price data for another symbol/TF that has not been updated, for example iTime returns 2019.01.01 (expected) but iBarshift sometimes returns 0 or -1.
I can not find the answer to this problem as I would expect iBarshift to always return -1 if the chart is not updated.
I have also tried the request data from another symbols, sleep for 5 seconds and re request again, but in some cases some charts were returning non updated price values.
I don't want to increase the time for sleep as that would slow down the EA.
Why Symbols array size 9 when operating on 10 symbols ?