Stop Loss and Take Profit Activation

 

Hi,

I would like to ask if you have an idea on how to detect on an EA whether a trade is activated on StopLoss or TakeProfit.

 

Thanks.

 

Have a look in your mt4 reference or here under Trade Functions.

Start with keywords OrderHistoryTotal() and OrdersTotal() and the examples there

 
raven.chrono: how to detect on an EA whether a trade is activated on StopLoss or TakeProfit.
  1. I use
    bool wasSL = MathAbs( OrderClosePrice() - OrderStopLoss() ) < MathAbs( OrderClosePrice() - OrderTakeProfit() );
  2. See also The == operand. - MQL4 forum

Reason: