Simple question: how to disable an ea when there are other trades running opened by another ea

 

How the title says, i am trying to disable my ea when trades not opened by it are already running, i am using the following code:

OrderSelect(0,0);

{if (OrderMagicNumber()!=Magic) othersplaying=1; else othersplaying=0;}


 if (othersplaying==0)

{OrderSend(Symbol(),..... etc etc...

However, with the above code the ea even durng backtest does not open any trade, even if trades with different magic number aren't running.

Someone can tell me what's wrong with the code above?

 
nxk: i am using the following code: OrderSelect(0,0);
  1. Don't paste code
    Play video
    Please edit your post.
    For large amounts of code, attach it.

  2. Read the documentation. What is the value of the second argument? What is the value of SELECT_BY_POS?
  3. What if there is NO open order. What are Function return values ? How do I use them ? - MQL4 forum
  4. What if the open order is on some other chart? OrderSelect loop and filter by symbol.
  5. Don't use zero and one when you mean true or false.
    bool isOther = OrderMagicNumber()!=Magic;
    if (!isOther) ...
    
 
nxk:

...

However, with the above code the ea even durng backtest does not open any trade.....


if there is no order,what is the othersplaying value.