Either by OrderSymbol() or by OrderMagicNumber().
Marco vd Heijden:
Either by OrderSymbol() or by OrderMagicNumber().
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
inside of the OrderSelect() loop.
Then you can count orders for each symbol in stead of ordersTotal
tippy: : it's AND so maybe it will?
| Symbol Doesn't equal Ordersymbol when another currency is added to another seperate chart . - MQL4 forum |
Thanks for your help!
Marco vd Heijden:
Thanks for your help!
inside of the OrderSelect() loop.
Then you can count orders for each symbol in stead of ordersTotal

You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
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)
{
ticket=OrderSend(Symbol(),OP_BUY,Lots,Ask,3,Bid-SL*Point,Ask+TP*Point,"",MagicNumber,0,Green);
if(ticket>0)LastTime = Time[shif];
return(0);