Could you please let me know when Position object gets updated?
It appears that in OnOrderUpdate handler it has its Position.MarketPosition property set correctly (is that always the case?) but the following is zero for the first trade:
// unrealizedPL is zero in OnOrderUpdate when order state is Filled
double unrealizedPL = Position.GetProfitLoss(Close[0], PerformanceUnit.Currency);
I realize there is an update handler for Position object, however, it looks like Position object gets partially updated when control comes in OnOrderUpdate.
Is my understanding correct? If so, what would be the workaround?
Thanks.
Comment