if OrderStopLoss() is not modified, the way to find if order was closed by SL is still valid, only the slippage is added in comments, ( this has to be checked).
It would be usefull to have access to the two arrays of the comments, where are the informations ;-)
Allow the use of cookies to log in to the MQL5.com website.
Please enable the necessary setting in your browser, otherwise you will not be able to log in.
You are signed in. Two-factor authentication has been disabled. Set it up again and scan a new QR code, or continue with two-factor authentication disabled.
I mean MT4 is watching this distance :
the différence between the two is the slippage,
if OrderStopLoss() is not modified, the way to find if order was closed by SL is still valid, only the slippage is added in comments, ( this has to be checked).
It would be usefull to have access to the two arrays of the comments, where are the informations ;-)
It is worrying that I did not get a definitive answer as the broker can change the value.
I can only say that in my experience, I have never seen an order closed at SL or TP that does not include SL,TP, sl or tp in the OrderComment.
I mean MT4 is watching this distance :
the différence between the two is the slippage,
Unless the trade was closed manually, or by an EA, or by the broker (margin call). This is the crucial bit of information we cannot retrieve.
I agree with GumRai, it would be great if MetaQuotes implemented a "OrderCloseAction()" or similar to remove all this guess work.
Hi,
what do you think about this solution, to know if an order is closed by TP, do you think this can be wrong?:
This code only works if both Stoploss and Takeprofit are set.
This code works if an order can only be close by Stoploss and Takeprofit (no OrderClose(), OrderCloseBy() or manual close).
And even in this case there is no guarantee it will work depending of the SL/TP distance from open and slippage.
Where would you place that code? Ontick?