Download MetaTrader 5

SymbolIsSynchronized() always returns false?

To add comments, please log in or register
pipsqueak1
21
pipsqueak1 2016.03.29 20:40 

If I create an EA* and use SymbolIsSynchronized() on EURUSD for example:

int OnInit() {
   bool result = SymbolIsSynchronized("EURUSD");
   printf("sync status: %u", result);
   return(INIT_SUCCEEDED);
};

The terminal prints the following:

EURUSD,H1: sync status: 0

No matter what I do (change timeframes, re-attach the EA to EURUSD), it always displays 0 (false); does this function work for anyone else?

* I'm using an MT4 terminal, but the same happens using MT5.

Thanks in advance for any help.

Alain Verleyen
Moderator
31091
Alain Verleyen 2016.03.29 21:39  
pipsqueak1:

If I create an EA* and use SymbolIsSynchronized() on EURUSD for example:

The terminal prints the following:

No matter what I do (change timeframes, re-attach the EA to EURUSD), it always displays 0 (false); does this function work for anyone else?

* I'm using an MT4 terminal, but the same happens using MT5.

Thanks in advance for any help.

This function is not documented for mql4, it's not working and return error 4014.

4014

ERR_UNKNOWN_COMMAND

Unknown command

On mql5, there is no problem for me.

2016.03.29 21:36:25.988    __TEST__ (EURUSD,M1)    EURUSD synchro =1

pipsqueak1
21
pipsqueak1 2016.03.29 23:38  
Alain Verleyen:

This function is not documented for mql4, it's not working and return error 4014.

4014

ERR_UNKNOWN_COMMAND

Unknown command

On mql5, there is no problem for me.

2016.03.29 21:36:25.988    __TEST__ (EURUSD,M1)    EURUSD synchro =1

Thanks for your prompt reply, much appreciated.

I was using an old demo account in MT5 and when I created a new one, the terminal updated and it now works.

For reference, you can't use MarketWatch window symbols, instead you have to physically open the chart for the function to check synchronisation, which I presume forces the 1minute candle data download so the terminal can create the hcc history file(s) for all other timeframes.

Thanks again for your help.

timkrug
31
timkrug 2016.03.30 09:52  
pipsqueak1:

For reference, you can't use MarketWatch window symbols, instead you have to physically open the chart for the function to check synchronisation, which I presume forces the 1minute candle data download so the terminal can create the hcc history file(s) for all other timeframes.


From the experience with my own custom indicators, market watch symbols can be synchronized without an open chart.

If SymbolIsSynchronized returns false, the symbol will be immediately synced on the next incoming tick.

Maybe you want to checkout the Refresh command from the standard library.

https://www.mql5.com/en/docs/standardlibrary/expertclasses/expertbaseclasses/cexpert/cexpertrefresh

Documentation on MQL5: Standard Library / Trading Strategy Classes / Base classes for Expert Advisors / CExpert / Refresh
Documentation on MQL5: Standard Library / Trading Strategy Classes / Base classes for Expert Advisors / CExpert / Refresh
  • www.mql5.com
Standard Library / Trading Strategy Classes / Base classes for Expert Advisors / CExpert / Refresh - Reference on algorithmic/automated trading language for MetaTrader 5
Alain Verleyen
Moderator
31091
Alain Verleyen 2016.03.30 10:24  
timkrug:


From the experience with my own custom indicators, market watch symbols can be synchronized without an open chart.

If SymbolIsSynchronized returns false, the symbol will be immediately synced on the next incoming tick.

Maybe you want to checkout the Refresh command from the standard library.

https://www.mql5.com/en/docs/standardlibrary/expertclasses/expertbaseclasses/cexpert/cexpertrefresh

Why are you thinking the Refresh() command is related to this topic ?
timkrug
31
timkrug 2016.03.30 12:49  
Alain Verleyen:
Why are you thinking the Refresh() command is related to this topic ?

"Refresh

Updates all data."


Seems not to be totally unrelated, but it was only a guess, anyway.

If it's not relevant, I would be pleased to receive your explanation why so.

Alain Verleyen
Moderator
31091
Alain Verleyen 2016.03.30 12:58  
timkrug:

"Refresh

Updates all data."


Seems not to be totally unrelated, but it was only a guess, anyway.

If it's not relevant, I would be pleased to receive your explanation why so.

Refresh() command is to update your EA data from Terminal data.

SymbolIsSynchronize() is about Server data versus Terminal data.

timkrug
31
timkrug 2016.03.30 13:05  
Alain Verleyen:

Refresh() command is to update your EA data from Terminal data.

SymbolIsSynchronize() is about Server data versus Terminal data.

I admit, not fully understanding the difference between Terminal and Server data.

Is it like local (stored on my computer) vs. external (brokers server) data?

Alain Verleyen
Moderator
31091
Alain Verleyen 2016.03.30 13:25  
timkrug:

I admit, not fully understanding the difference between Terminal and Server data.

Is it like local (stored on my computer) vs. external (brokers server) data?

Yes..Terminal is your MT4 platform, running on your computer.
To add comments, please log in or register