Download MetaTrader 5
To add comments, please log in or register
Interested in social trading? Read the article!
Rumen Zapryanov
Rumen Zapryanov 2016.05.10 15:23 

Hi there,

I have 2 EA based on SMA which are the same, but with different magic numbers and entering parameters. One I use for EUR/USD M15, the other I use for NZD/USD M15, both working fine.

The problem - when I got signal in EUR/USD for example and I got second signal in NZD/USD - the EA in NZD/USD doesn't open position. On the contrary - when the NZD/USD open position, the EUR/USD EA will not. What I have to do in order to get the 2 EA working in the same time?

I attach the EA's for any case. 


Osama Shaban
Osama Shaban 2016.05.10 20:17  

I'm not much good in tracing other's codes, but your code looks easy to understand and straight forward.

Nothing seems to be wrong for me. Be sure about other settings like lots you use and lot representation (number of digits after decimal points) ...

Also, put in mind your broker's stoplevel in points, ..., .. , etc ...

Good luck ... 

Trinh Dat
Trinh Dat 2016.05.11 01:05  
TotalOrdersCount function is problem, it not check Symbol.
Frederic Metraux
Frederic Metraux 2016.05.12 04:10  

I'm not sure TotalOrdersCount is the problem. It checks the positions using magic number which is the same as checking symbol.

But anyway it won't be very expensive to try:

int TotalOrdersCount()
  int result=0;
  for(int i=0;i<OrdersTotal();i++)
     OrderSelect(i,SELECT_BY_POS ,MODE_TRADES);
     if (OrderSymbol()==Symbol()) result++;

  return (result);

Another possibility is that 0.3 lots is too big for you account. A "Not enough money" in the log could be possible.

ffoorr 2016.05.13 07:45  

Try to put a  MagicNumber for EURUSD an another one for NZDUSD, something like that :

int init()
 if( Symbol() == "EURUSD" ) MagicNumber = 12546;
 else                     MagicNumber = 589746;
To add comments, please log in or register