I am trying to write some code that will get called when an open order is closed (in other words when an existing open position is closed, resulting in a profit or loss).
I am planning to use the OnOrderUpdate event for this purpose, is this correct? What states of the IOrder object do I need to check so that my code only responds when an order is closed?
Also, I don't see any properties on the IOrder or IExecution interfaces that would tell me what the closed trade's profit/loss and maximum drawdown was?
Many thanks
Comment