what is the good way to detect if a symbol is existing?

Back to topics list To post a new topic, please log in or register
avatar
228
jollydragon 2015.12.04 10:58
 

What is the good way to detect if a symbol is existing? 

E.g. How to detect if "EurUsd.Pro" is existing or not? 

avatar
3134
qjol 2015.12.04 12:02 #
 
for loop SymbolsTotal() compare with SymbolName()
avatar
228
jollydragon 2015.12.05 07:39 #
 
qjol:
for loop SymbolsTotal() compare with SymbolName()

Yes, a good idea, thanks! 

avatar
735
honest_knave 2015.12.05 12:06 #
 
MqlTick tick;
SymbolInfoTick(sym,tick);
if(GetLastError()==4106)
  {
   Print(sym+" is not available");
  }
Attempt to retrieve something. If the last error is 4106, the symbol doesn't exist.
avatar
164
rod178 2015.12.05 12:12 #
 
jollydragon:

What is the good way to detect if a symbol is existing? 

E.g. How to detect if "EurUsd.Pro" is existing or not? 

 

     string symbol="EurUsd.Pro";

     if(SymbolInfoInteger(symbol,SYMBOL_SELECT)) Print(symbol,"   found") ;

     else Print(symbol,"   not found");  
Back to topics list  

To add comments, please log in or register