I am using OrderUpdate and OnExecutionUpdate events to track my orders and executions, I am storing them in Dictionaries using order.Id as key to keeping track, but the issue I am facing when closing one order using an order in the opposite direction, I still see 'entry' order as when initially filled to open the position without any modification, and I know the 'exit' order closed one of my open orders, but no which one/.
For example:
Adding 1 entry + ATM (stop and target) = ID: 1
Adding 1 entry + ATM (stop and target) = ID: 2
Adding 1 entry + ATM (stop and target) = ID: 3
Adding a 1 Exit -- opposite order creates an 'exit' Order ID:4 and closing one of the open positions and closing the ATM -1 or order = ID:3 remaining orders ID:1 and ID:2,
but when I track OrderUpdate (using order.Id ) or OnExecutionUpdate (Execution execution in account.Executions or execution.Order), I can still see all the orders and order.Id 3 used as 'entry' still has all the same properties without any change as before the 'exit' was executed.
I would greatly appreciate any suggestions or insights on how to determine which 'entry' filled order has actually been closed after the opposite direction 'exit' order is filled.
Regards,
Ale

Comment