I would like to calculate the profit when a position is closed on the event OnExecutionUpdate (in the instrument currency).
I cannot use the account profits information before and after the trade because because the account information is common to all strategies running for the same account..
Looking at execution object, the order associated with the execution has the exit price but not the average opening price to make the calculation.
One idea that I had is to store the strategy position information about average price for this instrument when the trade is opened and make the calcutions when it is closed.
Is there a simpler approach? Would this one provide the right information?
Also, I would like so Sync the position with the account on startup of the strategy. In this case, the information in the strategy position would be consistent?
Regards
Zulok
Comment