Reason for Last Order Closing

JGF
186
JGF  

Is there a simple way of retrieving if a previously closed order closed via Take Profit or Stop Loss? At present I am retrieving price data and comparing closing price with stop loss and take profit to infer if that was the case.


thanks

Brian Dee - Random Trader
1757
Brian Dee - Random Trader  

JGF

See this topic https://www.mql5.com/en/forum/132473

Or anything else on OrderHistory() function

-BB-

JGF
186
JGF  
BarrowBoy:

JGF

See this topic https://www.mql5.com/en/forum/132473

Or anything else on OrderHistory() function

-BB-

I noticed something interesting. When I print out the OrderComment() output through a loop, it also provides the reason for the closing of the order (see below):


2011.06.13 21:49:57 2011.01.03 17:15 TriColor X 1.4.2.1b EURUSD,M15: 1stBuyOrder4[sl]
2011.06.13 21:49:57 2011.01.03 17:15 TriColor X 1.4.2.1b EURUSD,M15: 1stBuyOrder2[tp]
2011.06.13 21:49:57 2011.01.03 17:15 TriColor X 1.4.2.1b EURUSD,M15: 1stBuyOrder3[sl]
2011.06.13 21:49:57 2011.01.03 17:15 TriColor X 1.4.2.1b EURUSD,M15: 1stBuyOrder1[tp]


I assume that is a "normal" output. I discovered this by accident. Was trying to use OrderComment as a specific identifier and could not get it to work. So there you go.....

zzuegg
1503
zzuegg  
This is a broker related thing. You can not assume that every broker is altering the comment line.