Download MetaTrader 5
To add comments, please log in or register
Develop applications to order. Make profit using Freelance service!
moonsboy
889
moonsboy 2015.12.04 09: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? 

qjol
3243
qjol 2015.12.04 11:02  
for loop SymbolsTotal() compare with SymbolName()
moonsboy
889
moonsboy 2015.12.05 06:39  
qjol:
for loop SymbolsTotal() compare with SymbolName()

Yes, a good idea, thanks! 

honest_knave
959
honest_knave 2015.12.05 11: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.
rod178
276
rod178 2015.12.05 11: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");  
/
To add comments, please log in or register