Check if Magic Number = Order Type

 
if ((OrderMagicNumber()==0)==(OrderType()==OP_BUY)) 
{ 
   OrderSend(NULL,OP_SELLSTOP,ls3,tpSell,10,slSell,tpSellStop,NULL,1); 
}

I want my EA to only do the OrderSend if the OrderMagicNumber 0 (a pending order) is fulfilled. I can't seem to make this work. Any feedback would be greatly appreciated!

Documentation on MQL5: Constants, Enumerations and Structures / Trade Constants / Order Properties
Documentation on MQL5: Constants, Enumerations and Structures / Trade Constants / Order Properties
  • www.mql5.com
Order Properties - Trade Constants - Constants, Enumerations and Structures - MQL5 Reference - Reference on algorithmic/automated trading language for MetaTrader 5