Hello guys,
I made this test-indicator which checks all of my selected pairs and timeframes for correct history data so I can work with them.
This indicator should only check the timeframe when it's necessary. So it doesn't make sense to check the H4 chart for a new bar when it's 7:40 or so.
Most of the time it works fine but sometimes the larger timeframes are checked although they should not be checked at this time.
It's a bit difficult to explain, so I attached my code. I hope someone can tell me where the bug is.
'
Here you see what I mean. The M15 timeframe should not be checked at 19:50. The M15 chart should only be checked every 15 minutes and not in between.
This happens pretty rare but logically it should not even happen once. I don't see any logical error in my code...
timeMatrix[s][t]=iTime(sym,tf,0);
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 (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)
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 (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)
Hello,
I thought using Bars(sym,tf) will do the job to synchronize. It works pretty good most of the time. How do you synchronize? In the past I used the CheckHistory function which is shown in one of your links but it didn’t work for me. Additionally the sleep function is used in the CheckHistory code which can’t be used in indicators. I always thought that Bars() is a good way to start the synchronization.
- Bars(…) probably does (I don't know MT5). But Bars or iTime, you don't check the results and wait for any required update.
- It's your money; is EA “working most of the time” good enough for you?
- I gave you links; why don't you read them?
![MQL5 - Language of trade strategies built-in the MetaTrader 5 client terminal](https://c.mql5.com/i/registerlandings/logo-2.png)
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Hello guys,
I made this test-indicator which checks all of my selected pairs and timeframes for correct history data so I can work with them.
This indicator should only check the timeframe when it's necessary. So it doesn't make sense to check the H4 chart for a new bar when it's 7:40 or so.
Most of the time it works fine but sometimes the larger timeframes are checked although they should not be checked at this time.
It's a bit difficult to explain, so I attached my code. I hope someone can tell me where the bug is.
'