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

To add comments, please log in or register
Alberto Tortella
847
Alberto Tortella  

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!

William Roeder
20207
William Roeder  
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]
To add comments, please log in or register