I am in the middle of developing an indicator which can place orders.
I am using following code which places an order with an ATM.
account.CreateOrder(this.Instrument, OrderAction.Buy, OrderType.Market, TimeInForce.Day, 1, 0, 0, string.Empty, "Entry", null); NinjaTrader.NinjaScript.AtmStrategy.StartAtmStrategy("ATM1", order);
OnBarUpdate function I check some conditions and want to change the limit price of the target order.
foreach (var o in account.Orders.Where(p => p.IsLimit && p.Name == "Target1" && (p.OrderState == OrderState.Working))){ o.LimitPrice = newPrice; account.Change(new[] { o }); }
This works fine on the Sim but not when I run the indicator on the live account using NT brokerage.
2025-01-17 14:12:30:136|1|32|Order='1067315690/XXX' Name='Target1' New state='Accepted' Instrument='MNQ MAR25' Action='Sell' Limit price=21624.25 Stop price=0 Quantity=1 Type='Limit' Time in force=GTC Oco='95296df0af154c43b527a7c593685357' Filled=0 Fill price=0 Error='No error' Native error='' 2025-01-17 14:12:30:136|1|32|Order='1067315690/XXX' Name='Target1' New state='Working' Instrument='MNQ MAR25' Action='Sell' Limit price=21624.25 Stop price=0 Quantity=1 Type='Limit' Time in force=GTC Oco='95296df0af154c43b527a7c593685357' Filled=0 Fill price=0 Error='Unable to change order' Native error='' 2025-01-17 14:12:30:136|0|32|XXX, affected Order: Sell 1 Limit @ 21624.25
Any help on this please?
Comment