Download MetaTrader 5

How to find whether my previous order closed with s/l or t/p?

To add comments, please log in or register
Sherif Hasan
7388
Sherif Hasan  

Hi,

i would like to find whether my previous order closed with s/l or t/p?

please advise me to find?

Carl Schreiber
7110
Carl Schreiber  

1) Some brokers change the OrderComment()...

2) Loop through the OrdersHistoryTotal and compare OrderClosePrice with OrderStopLoss resp. OrderTakeProfit()

whroeder1
15598
whroeder1  
gooly:

1) Some brokers change the OrderComment()...

2) Loop through the OrdersHistoryTotal and compare OrderClosePrice with OrderStopLoss resp. OrderTakeProfit()

  1. Some do. I wouldn't trust it.
  2. Can't use equality A) SL/TP are market orders when triggered will not be exact prices, and B) The == operand. - MQL4 forum https://forum.mql4.com/56002#801213 The == operand. - MQL4 forum
  3. // OrderSelect
    double OCP = OrderClosePrice();
    bool isTP = MathAbs(OrderTakeProfit() - OCP) > MathAbs(OrderStopLoss() - OCP);
To add comments, please log in or register