check if an order was closed @ take profit or @ stop loss

 

Hi all, is there a quick way to check in the Order History if an order was closed @ tale profit (green) or @ stop loss (red) ?

One way is to compare the OrderClosePrice() with OrderTakeProfit() and OrderStoploss(), but may be there is a smarter way.

Thank you!

 
Alberto Tortella: One way is to compare the OrderClosePrice() with OrderTakeProfit() and OrderStoploss(), but may be there is a smarter way.
  1. bool closeBySL = MathAbs( OrderClosePrice() - OrderStopLoss() ) < MathAbs( OrderClosePrice() - OrderTakeProfit() );
  2. Not a good idea to use comments, brokers can change comments, including complete replacement. Not all brokers modify comments with [SL] or [TP]
Reason: