Synchronize Server Data with Terminal Data

 

Is there a way to force the synchronisation process between the Server and Terminal?

I'm using SymbolIsSynchronized(Symbol()) function to check if Terminal data is synchronised with a server. However, the function keeps returning false values (I'm doing my testing in metaquotes VPS)

I've tried placing a 5 minute delay before executing any other functions, but SymbolIsSynchronized function keeps returning the same value = false

Please help.

Thank you

 
Which other code except for SymbolIsSynchronized do you call to request the symbol data?
 
Sergei Krupich:

Is there a way to force the synchronisation process between the Server and Terminal?

I'm using SymbolIsSynchronized(Symbol()) function to check if Terminal data is synchronised with a server. However, the function keeps returning false values (I'm doing my testing in metaquotes VPS)

I've tried placing a 5 minute delay before executing any other functions, but SymbolIsSynchronized function keeps returning the same value = false

Please help.

Thank you

I ran into a maybe similar problem. Check:

   Comment(
                "\n1.Date Chart: ",(datetime)SeriesInfoInteger(Symbol(),Period(),SERIES_FIRSTDATE),
                "  1.Date Term:  ",(datetime)SeriesInfoInteger(Symbol(),Period(),SERIES_TERMINAL_FIRSTDATE),
                "  1.Date Serv:  ",(datetime)SeriesInfoInteger(Symbol(),Period(),SERIES_SERVER_FIRSTDATE),
                "  isSync  ",(bool)SeriesInfoInteger(Symbol(),Period(),SERIES_SYNCHRONIZED) );

To request the history I do now:

MqlRates r[];
int nR, mxB = TerminalInfoInteger(TERMINAL_MAXBARS);
nR = CopyRates(_Symbol, PERIOD_M1,0,    mxB+2,r);
nR = CopyRates(_Symbol, PERIOD_M1,mxB*1,mxB+2,r);
nR = CopyRates(_Symbol, PERIOD_M1,mxB*2,mxB+2,r);
nR = CopyRates(_Symbol, PERIOD_M1,mxB*3,mxB+2,r);
nR = CopyRates(_Symbol, PERIOD_M1,mxB*4,mxB+2,r);

and I compare nR and mxB and the error-code.

 

Thanks Carl, I've found an .mqh file and it resolved my issue

The file can be included inside an expert or indicator. It checks for loaded history and requests missing data from the server if necessary.

I'm including a link for anyone's reference:


https://www.mql5.com/en/code/1251

CheckHistory - Check and load history function
CheckHistory - Check and load history function
  • www.mql5.com
Slightly modified history load function from MetaQuotes.
Reason: