# Adding currency pair to EA

70

I would be most grateful if someone can help me with my problem!

I currently have very similar EA's that work fine on 5 different instruments (mostly currency pairs) - but if and only if I have no current open positions.

I am a very beginner programmer and have adapted a program I obtained here to suit my needs.  As implied above, the issue I have is that my EA's all seem to work ok as long as I have no current positions opened - i.e. a new open position will not be placed by any EA on the 5 separate charts I have open if any open position is current on any of the 5.  I thought magicnumber would sort this out but it hasn't.

I now think it is related to the code below (in all 5 EA's) , specifically the orderstotal, if(total<1) part.  I was thinking if I could add some code that states AND INSTRUMENT IS xxxxxx then this might sort it out (given that the 5 EA's are all on different instruments).  Does anyone know if I am right and if so, how to do this?

int cnt, ticket, total;

total=OrdersTotal();
if(total<1)
{
if(GetSignal()==1 && Time[shif]!= LastTime)
{
if(ticket>0)LastTime = Time[shif];
return(0);

Moderator
5801

Either by OrderSymbol() or by OrderMagicNumber().
70

Marco vd Heijden:
Either by OrderSymbol() or by OrderMagicNumber().

Thanks for the reply Marco.  Where would I add this in the program?  if(total< 1 and OrderMagicNumber()==MagicNumber) for example?  Would that work?

Edit:  Don't think it will because total trades <1 still applying

Moderator
5801

inside of the OrderSelect() loop.

Then you can count orders for each symbol in stead of ordersTotal

16353

 tippy: : it's AND so maybe it will? Symbol Doesn't equal Ordersymbol when another currency is added to another seperate chart . - MQL4 forum
70

70

Marco vd Heijden:

inside of the OrderSelect() loop.

Then you can count orders for each symbol in stead of ordersTotal