How can I check if a trade was closed by stoploss?
Left click on the "Account History" tab. Right click on any item and Left click on "Save as Detailed Report" and click Save. Then, your browser should pop up with the report.
If a trades was closed by stoploss, you'll see a "[sl]" at the end of the comment section for that particular trade.
- Vooch
If a trades was closed by stoploss, you'll see a "[sl]" at the end of the comment section for that particular trade.
- Vooch
Yes Vooch, but this may be server dependent and I am not sure it will be the case for all brokers. I had to change my code since different brokers seem to do different things to the comment.
regards,
hugues
regards,
hugues
Sorry I was not clear enough.
How can my MT4 EA 'see' if a position was closed by stoploss and reacts on it.
So as an example. If the stoploss gets hit the program should open a position in the oposite direction
How can my MT4 EA 'see' if a position was closed by stoploss and reacts on it.
So as an example. If the stoploss gets hit the program should open a position in the oposite direction
TraderSeven,
If you have the order ticket, you can try something like this.
If you have the order ticket, you can try something like this.
int ticket=12345678; if ( OrderSelect( ticket, SELECT_BY_TICKET ) == true ) { if( OrderCloseTime() != 0 && OrderProfit() < 0 ) { Print(StringConcatenate("Order #", ticket, " closed by stoploss!"); } }
Matias Romeo
matiasdotromeoatgmaildotcom
Custom Metatrader Systems
How can I check if a trade was closed by stoploss?
first analyze order comment, it should be "s/l" substring.
you may also compare close price with stoploss price.
if you do not close expert's orders manually then you can provide your own journal : open order - open record, close order - close record. and then analyze your journal

You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register