Normally SymbolIsSynchronized should work (and worked for me). If you can locate the problem feel free to post a test case for the bug.
Also you probably want to check TerminalInfoInteger(TERMINAL_CONNECTED) before all other checks, and also look at SeriesInfoInteger(_Symbol, _Period, SERIES_SYNCHRONIZED).
Normally SymbolIsSynchronized should work (and worked for me). If you can locate the problem feel free to post a test case for the bug.
Also you probably want to check TerminalInfoInteger(TERMINAL_CONNECTED) before all other checks, and also look at SeriesInfoInteger(_Symbol, _Period, SERIES_SYNCHRONIZED).
I tried to also add these checks before copyTicks call, but alway give me true.
The simple test i do is disable network on my pc, wait some minutes, and reconnect. Indicator pass all three checks - TerminalInfoInteger(TERMINAL_CONNECTED) and SeriesInfoInteger(_Symbol, _Period, SERIES_SYNCHRONIZED) and SymbolIsSynchronized(_Symbol) - call copyTicks using "from time" the time before disconnection, but give me only current tick, skipping the precedent ones...
onCalculate is called with prev_calculated=0, more than one time, so terminal "signaling" indicator it is filling gaps, but i need to call copyTicks just when history is synch, not before. Is there no way to check this?
I tried to also add these checks before copyTicks call, but alway give me true.
The simple test i do is disable network on my pc, wait some minutes, and reconnect. Indicator pass all three checks - TerminalInfoInteger(TERMINAL_CONNECTED) and SeriesInfoInteger(_Symbol, _Period, SERIES_SYNCHRONIZED) and SymbolIsSynchronized(_Symbol) - call copyTicks using "from time" the time before disconnection, but give me only current tick, skipping the precedent ones...
onCalculate is called with prev_calculated=0, more than one time, so terminal "signaling" indicator it is filling gaps, but i need to call copyTicks just when history is synch, not before. Is there no way to check this?
Seems i found the problem, when copyTicks result is greater than 0, we need also check the error code. In fact, i get 2 ticks as result of CopyTicks and error code ERR_HISTORY_TIMEOUT 4403. We have to check both, return value and error code.
This is not how it's supposed to work.
From documentation :
Returned value
The number of copied tick or -1 in case of an error.
- www.mql5.com
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
My question is, how can i check data is sync, if it returns immediately without error and with result>0 ?
I tried SymbolIsSynchronized(_Symbol) function, but it returns true event if all data gaps have not be filled by trading server yet.