testing multiple pairs

 
I am trying to test multiple pairs and once a signal occurred on one pair, an order is sent.

I use MA as entry signal, so instead of writing iMA (which I need 5 MAs for one pair) on each individual pair, I use this code to switch between pairs.
string currency;
int ss;
 
   if(ss == 0)
      currency = "EURCAD";
   if(ss == 1)
      currency = "USDJPY";
   if(ss == 2)
      currency = "GBPUSD";
   if(ss == 3)
      currency = "AUDUSD";
   if(ss == 4)
      {    
      currency = "USDCAD";
      ss = -1;
      }
 
   ss++;

for each tick, "currency" has different value.

My questions are:

Is there any way to do this?
when I test it on my live account, the value of "currency" is random and it doesn't go by that order, why?
when I test this on the Tester, it doesn't send any order, why?

Thanks,
 
The best thing to have separate EA for each pair. EAs are executed when tick comes in for the chart. If using pair other than the chart you may miss a tick or execute several times on the same tick of the other pair. If you want to stop sending orders when one pair got one, set global variable to true and have check it befiore sending orders. This called semaphore. You check for red light before you go.
 
Thanks for the input.

I forget a word in my question above, "Is there any way to do this", which I meant "Is there any OTHER way to do this?"

if I run the EA on different currencies, how the EA is going to read function like, OrdersTotal() (all open orders or just open orders for that currency)?
Is there an article to read about opening the same EA on different currencies (or maybe different timeframes)?
 
OrdersTotal() returns numer of ALL orders (open and pending on ALL Symbols ) on current account.
 

how about if I save the same EA on different names and run each EA on different pairs ?

I know OrdersTotal() still gives me the same result, but how about the global variables inside each EA (they have the same names)? what about the external variables?

Anything else I should be aware of?

 
Especially for those purposes exist such excellent feature as MagicNumber !
Reason: