EA supporting multiple pairs

 

I am trying to create an EA that will trade multiple pairs although only loaded on one pair.

I have created the following two variables:

string   Pairs[28] = {"AUDCAD, AUDCHF, AUDJPY, AUDNZD, AUDUSD, CADCHF, CADJPY, CHFJPY, EURAUD, EURCAD, EURCHF, EURGBP, EURNZD, EURUSD, EURJPY, GBPAUD, GBPCAD, GBPCHF, GBPJPY, GBPNZD, GBPUSD, NZDCAD, NZDCHF, NZDJPY, NZDUSD, USDCAD, USDCHF, USDJPY"};
string   symbol;

And then I have this code:

     for(int j=0; j<=27; j++)
     
      {
      
      Pairs[j] = symbol;
      
      OpenPrice = iOpen(symbol,0,1);
      ClosePrice = iClose(symbol,0,1);
     
       ...........

     }

But it is not working. Can anybody tell me why?

 

Your Array contains only 1 value:

[0] == "AUDCAD, AUDCHF, AUDJPY, AUDNZD, AUDUSD, CADCHF, CADJPY, CHFJPY, EURAUD, EURCAD, EURCHF, EURGBP, EURNZD, EURUSD, EURJPY, GBPAUD, GBPCAD, GBPCHF, GBPJPY, GBPNZD, GBPUSD, NZDCAD, NZDCHF, NZDJPY, NZDUSD, USDCAD, USDCHF, USDJPY"

It should be {"AUDCAD", "AUDCHF", ...."}

 
Hi, if you want create EA for MT4 it that will not work, MT4 not support multi currency EA. Regards Greg 
 
Greg Pawlak: if you want create EA for MT4 it that will not work, MT4 not support multi currency EA. Regards Greg 
  1. False, works just fine. It is the tester that doesn't support multi-currency.
  2. Why did you post your MT4 question in the Root / MT5 EA section instead of the MQL4 section, (bottom of the Root page?)
              General rules and best pratices of the Forum. - General - MQL5 programming forum
    Next time post in the correct place. The moderators will likely move this thread there soon.

  3. I recommend: Do not trade multiple currencies in one EA.

 
Enrique Dangeroux:

Your Array contains only 1 value:

[0] == "AUDCAD, AUDCHF, AUDJPY, AUDNZD, AUDUSD, CADCHF, CADJPY, CHFJPY, EURAUD, EURCAD, EURCHF, EURGBP, EURNZD, EURUSD, EURJPY, GBPAUD, GBPCAD, GBPCHF, GBPJPY, GBPNZD, GBPUSD, NZDCAD, NZDCHF, NZDJPY, NZDUSD, USDCAD, USDCHF, USDJPY"

It should be {"AUDCAD", "AUDCHF", ...."}

Thank you! That was a stupid mistake from me!

 
William Roeder:
  1. False, works just fine. It is the tester that doesn't support multi-currency.

  2. I recommend: Do not trade multiple currencies in one EA.

William I really appreciate your feedback! Thank you very much. I think I will stick to one EA one pair as you recommend.

Reason: