for(int i=0;i<SymbolsTotal(1);i++) { Print("SYMBOL: ",SymbolName(i,1)," Found At: ",i); }
//+------------------------------------------------------------------+ //| Symbols Total, by Marco van der Heijden | //+------------------------------------------------------------------+ for(int i=0;i<SymbolsTotal(1);i++) { if(SymbolName(i,1)=="AUDCAD") { // do something for AUDCAD } if(SymbolName(i,1)=="AUDCHF") { // do something for AUDCHF } if(SymbolName(i,1)=="AUDJPY") { // do something... } if(SymbolName(i,1)=="AUDNZD") { } if(SymbolName(i,1)=="AUDSGD") { } if(SymbolName(i,1)=="AUDUSD") { } if(SymbolName(i,1)=="AUS200") { } if(SymbolName(i,1)=="CADCHF") { } if(SymbolName(i,1)=="CADJPY") { } if(SymbolName(i,1)=="CHFJPY") { } if(SymbolName(i,1)=="CHFSGD") { } if(SymbolName(i,1)=="EURAUD") { } if(SymbolName(i,1)=="EURCAD") { } if(SymbolName(i,1)=="EURCHF") { } if(SymbolName(i,1)=="EURCZK") { } if(SymbolName(i,1)=="EURGBP") { } if(SymbolName(i,1)=="EURJPY") { } if(SymbolName(i,1)=="EURNOK") { } if(SymbolName(i,1)=="EURNZD") { } if(SymbolName(i,1)=="EURPLN") { } if(SymbolName(i,1)=="EURSEK") { } if(SymbolName(i,1)=="EURSGD") { } if(SymbolName(i,1)=="EURTRY") { } if(SymbolName(i,1)=="EURUSD") { } if(SymbolName(i,1)=="EURZAR") { } if(SymbolName(i,1)=="EUSTX50") { } if(SymbolName(i,1)=="FRA40") { } if(SymbolName(i,1)=="GBPAUD") { } if(SymbolName(i,1)=="GBPCAD") { } if(SymbolName(i,1)=="GBPCHF") { } if(SymbolName(i,1)=="GBPJPY") { } if(SymbolName(i,1)=="GBPNOK") { } if(SymbolName(i,1)=="GBPNZD") { } if(SymbolName(i,1)=="GBPSEK") { } if(SymbolName(i,1)=="GBPSGD") { } if(SymbolName(i,1)=="GBPTRY") { } if(SymbolName(i,1)=="GBPUSD") { } if(SymbolName(i,1)=="GER30") { } if(SymbolName(i,1)=="HK50") { } if(SymbolName(i,1)=="IT40") { } if(SymbolName(i,1)=="JPN225") { } if(SymbolName(i,1)=="NAS100") { } if(SymbolName(i,1)=="NOKJPY") { } if(SymbolName(i,1)=="NOKSEK") { } if(SymbolName(i,1)=="NZDCAD") { } if(SymbolName(i,1)=="NZDCHF") { } if(SymbolName(i,1)=="NZDJPY") { } if(SymbolName(i,1)=="NZDUSD") { } if(SymbolName(i,1)=="SEKJPY") { } if(SymbolName(i,1)=="SGDJPY") { } if(SymbolName(i,1)=="SPA35") { } if(SymbolName(i,1)=="UK100") { } if(SymbolName(i,1)=="US2000") { } if(SymbolName(i,1)=="US30") { } if(SymbolName(i,1)=="US500") { } if(SymbolName(i,1)=="USDCAD") { } if(SymbolName(i,1)=="USDCHF") { } if(SymbolName(i,1)=="USDCNH") { } if(SymbolName(i,1)=="USDCZK") { } if(SymbolName(i,1)=="USDHKD") { } if(SymbolName(i,1)=="USDJPY") { } if(SymbolName(i,1)=="USDMXN") { } if(SymbolName(i,1)=="USDNOK") { } if(SymbolName(i,1)=="USDPLN") { } if(SymbolName(i,1)=="USDRUB") { } if(SymbolName(i,1)=="USDSEK") { } if(SymbolName(i,1)=="USDSGD") { } if(SymbolName(i,1)=="USDTHB") { } if(SymbolName(i,1)=="USDTRY") { } if(SymbolName(i,1)=="USDZAR") { } if(SymbolName(i,1)=="XAGEUR") { } if(SymbolName(i,1)=="XAGUSD") { } if(SymbolName(i,1)=="XAUEUR") { } if(SymbolName(i,1)=="XAUUSD") { } if(SymbolName(i,1)=="XBRUSD") { } if(SymbolName(i,1)=="XNGUSD") { } if(SymbolName(i,1)=="XPDUSD") { } if(SymbolName(i,1)=="XPTUSD") { } if(SymbolName(i,1)=="XTIUSD") { } if(SymbolName(i,1)=="ZARJPY") { } if(SymbolName(i,1)==" ") { //maybe more? add here. } }//END for(i=0;i<SymbolsTotal(1);i++) //+------------------------------------------------------------------+
Here's a template i made especially for you.
Here's a template i made especially for you.
Thank you very much.
I'll try it .
and what about this : Modified from szgy74
extern bool Trade_On_All_Market_Currencies=true; string _Sympols; // Function Call if (Trade_On_All_Market_Currencies){ _Sympols=Symbols(); } else _Sympols=Symbol(); //end of function call //Function string Symbols() { int iCount=SymbolsTotal(false); // true, the function returns the number of symbols selected in MarketWatch. If the value is false, it returns the total number of all symbols. Print("Symbols Count: ", iCount); int i; for(i=0; i<iCount; i++) { string sSymbol=SymbolName(i, false);// true, the symbol is taken from the list of symbols selected in MarketWatch. If the value is false, the symbol is taken from the general list. // string desc=SymbolInfoString(sSymbol, SYMBOL_DESCRIPTION); } return(sSymbol); }
Here's a template i made especially for you.
a switch can also work but its a little bit different with integer constants so the example above is a bit more easy as it shows the actual symbol name.
yes of course.
enum symbols { AUDCAD=0, AUDCHF=1, ... };the problem with this is that the positions can vary between brokers where in the first examples, it will always only use what is offered, when int i comes across it at the right position this way you can be sure the same symbol is always at the same int i position in the code, and there can be no mix up of string comparison.
Dear all,
I need help to code an ea that checks the same conditions to open and close trades on as many symbols as it can from the symbols that the broker is dealing in, without opening their charts.
- any help on a code that returns " Symbol" and adds it tho the Ordersend.it is a try to run the ea on many currencies by attaching it to one chart.
Here is my try but I do not know if it will work
You can study the use of OnChartEvent ()
https://www.mql5.com/en/articles/1052

- 2015.03.05
- Jose Miguel Soriano
- www.mql5.com
I went back and looked through the posts from other threads, but am having problems with the search function working properly. There was a thread, I do not remember if it was on MQL4 or 5 right now, but someone was trying to run multiple instances of the trading platform. One of the topics covered there was EAs, and the platform only allows a maximum of one EA per chart. I am not sure if this applies here, or if you can trade other pairs without having a chart open for them or not.
Edit: I found the other thread I was talking about. It is here at https://www.mql5.com/en/forum/59293.
I went back and looked through the posts from other threads, but am having problems with the search function working properly. There was a thread, I do not remember if it was on MQL4 or 5 right now, but someone was trying to run multiple instances of the trading platform. One of the topics covered there was EAs, and the platform only allows a maximum of one EA per chart. I am not sure if this applies here, or if you can trade other pairs without having a chart open for them or not.
Edit: I found the other thread I was talking about. It is here at https://www.mql5.com/en/forum/59293.
That has nothing to do with the current topic.

- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Dear all,
I need help to code an ea that checks the same conditions to open and close trades on as many symbols as it can from the symbols that the broker is dealing in, without opening their charts.
Here is my try but I do not know if it will work