Exception
all values are set except CustomOrder which I have as null
System.NullReferenceException: Object reference not set to an instance of an object.
at NinjaTrader.Cbi.Account.CreateOrder(Instrument instrument, OrderAction action, OrderType orderType, TimeInForce timeInForce, Int32 quantity, Double limitPrice, Double stopPrice, String oco, String name, CustomOrder customOrder)
Account Initialization
account = Account.All.FirstOrDefault(a => a.Name == "Backtest");
if (account != null) {
LOGGER.Debug("Adding events listeners to " + account);
account.ExecutionUpdate += OnExecutionUpdate;
account.OrderUpdate += OnOrderUpdate;
account.PositionUpdate += OnPositionUpdate;
}
Order Creation and Submission
double tickBreakLong = SMA(Low, 5)[0] + 5 * TickSize;
entryOrder = account.CreateOrder(Instrument,
OrderAction.Buy,
OrderType.StopMarket,
TimeInForce.Gtc,
1,
0,
tickBreakLong,
string.Empty,
"Long_Entry",
null);
account.Submit(new []{entryOrder});
//LOGGER.Debug("Submitted Order " + entryOrder);
Comment