Download MetaTrader 5
To add comments, please log in or register
Find out how to install MetaTrader on Mac OS
nicolasxu
296
nicolasxu 2015.04.10 10:31 

 When stop loss is triggered, the following log is generated by MT5. 

2015.04.10 16:22:14 Core 1 2015.01.19 11:35:29   stop loss triggered sell 1.00 EURUSD 1.15417 sl: 1.16217 tp: 1.15317 [#5 buy 1.00 EURUSD at 1.16217]

 

This is exactly the info I need in EA, getting price volume, against which order previously executed.

 

How can I obtain this in EA?

I tried intercept TRADE_TRANSACTION_HISTORY_ADD on OnTradeTransaction() event handler, and compare the price, direction, with previous recorded order, but no success, since it is too complex and I lost int his process.  I realize this may not be the intended way. 

Can you please show me the standard way to detect stop loss execution, and get the following information? 

1) stop loss order price

2) stop loss order volume

3) against which previous order (price, volume)

4) net loss of the this stop loss execution

 

Thank you very much! 

/
To add comments, please log in or register