Two EA with same parameters and only one working

 

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. 


Regards

 

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 ... 

 
TotalOrdersCount function is problem, it not check Symbol.
 

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.

 

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;
 //--------
 return(0);
}
Reason: