In MQL5 there's a property called DEAL_REASON that could be queried for historical deals, and it will be set to DEAL_REASON_TP if your take profits was hit.
if(HistoryDealGetInteger(dealticket,DEAL_REASON)==DEAL_REASON_TP) ...
Batuhan:
I'm currently using a time and a profit filter for finding trades closed at take profits (my take profits are at 40 pips and I'm searching trades closed with + 30 or more pips for a specified time interval).
Is there a more smarter way of doing this?
Check for string "[tp]" in OrderComment(). I don't know if it works for all brokers so check if your broker is using this tag in comment for trades closed by TP.
Thanks to all.
![MQL5 - Language of trade strategies built-in the MetaTrader 5 client terminal](https://c.mql5.com/i/registerlandings/logo-2.png)
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
I'm currently using a time and a profit filter for finding trades closed at take profits (my take profits are at 40 pips and I'm searching trades closed with + 30 or more pips for a specified time interval).
Is there a more smarter way of doing this?