I need help with a strategy to change order:
I followed the guide NinjaTrader 8
I am able to get the order ID from the OnOrderUpdate.
if (order.Name == "Stop loss")
StoplossOrder = order;
Later I use this Order in OnBarUpdate to change the stop loss.
I am able to print the current order ID and stop loss.
After executing the ChangeOrder, the stop is not getting updated.
Would you please help me how to update the order ?
protected override void OnBarUpdate()
{
// Raise stop loss to breakeven when you are at least 4 ticks in profit
if (stopOrder != null && stopOrder.StopPrice < Position.AveragePrice && Close[0] >= Position.AveragePrice + 4 * TickSize)
ChangeOrder(stopOrder, stopOrder.Quantity, 0, Position.AveragePrice);
}

Comment