Download MetaTrader 5
To add comments, please log in or register
MQL5 Reference is available in 8 languages. Learn MQL5 in the language that suits you best!
Marco Garbuglia
516
Marco Garbuglia 2014.08.03 13:57 

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?

whroeder1
13644
whroeder1 2014.08.03 15:48  
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) ...
    
Hongliang Liu
1196
Hongliang Liu 2014.08.04 08:44  
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.
/
To add comments, please log in or register