protected override void OnOrderUpdate(IOrder order)
{
loops thro all orders.
if all orders are filled which means my positins are closed..
set order objects to null
print("setting obects = null");
}
protected onBarupdate()
{
if ((Position.MarketPosition == MarketPosition.Short) && (Position.Quantity>0))
{
// do some action with the order objects
The code is getting triggered for few ticks after the exitorders are filled. becoz i had set the order objects = null. i get exceptions. I dunno why the Position.Quantity>0 is true becoz its printed after the printing of "setting obects = null"
}
}
what is a good practise to check within the barupdate if the positions are closed becoz Position.Quantity does not reflect reality during runtime.
mind you, this is random that it happens only for USD.CAD instrument and not for the others.

Comment