Hello all,
I’m currently encountering the following problem:
- BAR 1 : I have an open position and 2 pending orders (Profit Target and Stop Loss) not attached to the order (not within the order, i.e as separate orders).
- BAR 2 : On opening of the bar, Stop Loss is touched and position is closed, however OnTradeTransaction() is not called ! The OnTick() event handler is first called (as there is a new quote), then the OnTradeTransaction() event handler is called. However my order management system is only updated through OnTradeTransaction() because it needs to know what has been executed and what hasn’t. In this example, if OnTradeTransaction() had been called first, I would have known with MqlTradeTransaction.type what had happened and updated my strategy, knowing that the order had been filled, and the position closed.
To make it short, is there any way to prioritize the OnTradeTransaction() event on the OnTick() event.
Thanks in advance,