I have used an IOrder object to exit orders in a controlled fashion.
It is not logging errors during Simulations.
However, it is sending the following error message when the system attempts to run my ExitOrder command during a live demo run:
"Failed to execute DB job 'StrategyUpdateJob': There was an error reflecting type 'NinjaTrader.Strategy.myExitOrder' of type NinjaTrader.Cbi.Order', see inner exception for more details.: Cannot serialize member NinjaTrader.Strategy.Strategy.myExitOrder of type NinjaTrader.Cbi.IOrder because it is an interface.
I am confused because I have implemented ExitOrder as per the help file documentation.
The following lists the programming commands where I have used it: can anyone point out my mistake?
public IOrder myExitOrder = null;
myExitOrder = ExitShortLimit(0, true, 1, 5.6, "ExitShortLimit", "EnterShortLimit");
if (myExitOrder != null) { CancelOrder(myExitOrder); }
protected override void OnOrderUpdate(IOrder order)
{
if (myExitOrder != null && myExitOrder.Token == order.Token)
{
//Print(order.ToString());
if (order.OrderState == OrderState.Filled)
{
myExitOrder = null;
}
}
}
Comment