Finding the trades closed at take profits
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) ...
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.
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?