I am currently working on an EA using mql5 and I want to check if a pending order has reached its take profit.I already thought of going through the list of HistoryDeals to identify the deal that corresponds with the pending order,but this seemed a little too complicated for such a simple task.
I apologize for my english as I am from Germany.
Thanks in advance!
A pending order can't reach a take profit, and there is no deals associated. I suppose you mean a position resulting from the triggering of a pending order ?
Anyway, you can't do that from history only (takeprofit are not recorded on history). The easiest way is to detect a deal out, and compare the price with your take profit.