Download MetaTrader 5

Stop Loss and Take Profit Activation

To add comments, please log in or register
raven.chrono
324
raven.chrono  

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.

Carl Schreiber
6689
Carl Schreiber  

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

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

whroeder1
14778
whroeder1  
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

To add comments, please log in or register