Download MetaTrader 5
To add comments, please log in or register
Make profit on MQL5 services. It's easy!
Sherif Hasan
7266
Sherif Hasan 2014.12.05 17:24 

Hi,

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

please advise me to find?

Carl Schreiber
6161
Carl Schreiber 2014.12.05 18:38  

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

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

whroeder1
13982
whroeder1 2014.12.05 20:45  
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