protected override void OnExecutionUpdate(Execution execution, string executionId, double price, int quantity, MarketPosition marketPosition, string orderId, DateTime time)
{
if (execution.Order.OrderState == OrderState.Filled && execution.Order.Name == "longEntry")
{
ExitLongLimit(0, true, 1, (Close[0] + 20) , @"exitLong1", @"longEntry");
ExitLongStopMarket(0, true, 1, (Close[0] - 20) , @"longStop", @"longEntry");
}
else if (execution.Order.OrderState == OrderState.Filled && execution.Order.Name == "shortEntry")
{
ExitShortLimit(0, true, 1, (Close[0] - 20) , @"exitShort1", @"shortEntry");
ExitShortStopMarket(0, true, 1, (Close[0] + 20) , shortstop, @"shortEntry");
}
// if (execution.Order.OrderState == OrderState.Filled && execution.Order.Name == "exitLong1")
// {
// CancelOrder("longStop");
// }
// else if (execution.Order.OrderState == OrderState.Filled && execution.Order.Name == "longStop")
// {
// CancelOrder("exitLong1");
// }
// if (execution.Order.OrderState == OrderState.Filled && execution.Order.Name == "exitShort1")
// {
// CancelOrder("shortStop");
// }
// else if (execution.Order.OrderState == OrderState.Filled && execution.Order.Name == "shortStop")
// {
// CancelOrder("exitShort1");
// }
}
But I get the error "Argument 1: cannot convert from 'string' to 'NinjaTrader.Cbi.Order'" when trying to compile. I commented it out for now just so I could get everything to compile.
How can I accomplish this?
Comment