browse all the currencies available

 

Hello,

I would like to know how to browse all the currencies available for my EA in mql5.

void OnTick()
  {

  for(int i=0;i<SymbolsTotal(1);i++)
     {
      Print("SYMBOL: ",SymbolName(i,1)," Found At: ",i);
     }
  
  }


When i test it (F5), i select in Settings -> Symbols -> All Symbols from Market Watch and i click on start, nothing is going on.

 
ket314MQL4:

Hello,

I would like to know how to browse all the currencies available for my EA in mql5.


When i test it (F5), i select in Settings -> Symbols -> All Symbols from Market Watch and i click on start, nothing is going on.

There are no ticks on the weekend so you need to compile and runs this as a script. Also, it's bad practice to replace "true" with "1". 

void OnStart() {
   for (int i=SymbolsTotal(false)-1; i>=0; --i) {
      printf("symbols[%d] = %s", i, SymbolName(i, false));
   }   
}
 
all perfect
 

Hello,

How do I test it as a script ?
(I created a new file as a script, ctrl+n -> script)
Reason: