Get the selected symbols in MetaTrader 5

 

Hello everyone,

I need the mql5 code to get the selected symbols of MetaTrader 5 into a string Array.

The result Array will be similar to:

string Symbols[]={"USDJPY","XAUUSD","EURGBP",......................................................}

Can you help me with the code.

Thanks

 
Waldor Bray Silva Cubas:

Hello everyone,

I need the mql5 code to get the selected symbols of MetaTrader 5 into a string Array.

The result Array will be similar to:

string Symbols[]={"USDJPY","XAUUSD","EURGBP",......................................................}

Can you help me with the code.

Thanks


What does "selected symbols" mean? Do you mean the current chart?
 

You need to use:

SymbolsTotal
SymbolName
and SymbolInfoInteger with SYMBOL_SELECT

 
Taras Slobodyanik:

You need to use:


Ok Thanks,

I have the code:

string Symbols[];

for(int i=0;i<SymbolsTotal(true);i++){

         ArrayResize(Symbols,ArraySize(Symbols)+1);

         Symbols[i]=SymbolName(i,true);

}