Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

OnOrderUpdate doesn't show any error

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    OnOrderUpdate doesn't show any error

    I am using managed approach and Playback connection. Playing it. I see the problem only in real-time. I only have a single strategy running on the entire NinjaTrader Platform.
    Every once in a while the strategy aborts because of Order Rejected or "Unable to change order" and the strategy aborts.

    The problem is that I don't get any error in OnOrderUpdate() and so I cannot manage it.

    I see the reason of the rejection and I'll fix it but I don't understand what could be a reason for the error not to show up during OnOrderUpdate()

    I often also get error "Unable to change order" and the reason is not apparent. Would you know of a common reason why in playback I could get Unable to Change Order ?

    The code I use is
    Code:
    protected override void OnOrderUpdate(Order order, double limitPrice, double stopPrice, int quantity, int filled, double averageFillPrice,  OrderState orderState, DateTime time, ErrorCode error, string nativeError)
    {
        Print("  order.Time:" + order.Time + " OnOrderUpdate " + order.ToString() + "   err" + error.ToString() + " time:" + time.ToString() + " natErr:" + nativeError);
    }
    I am entering a EnterLongStopMarket with stop entry placed 2 ticks above the High of the order bar. order itself (High[0] is equal to 20437.75.

    Why I get the error and why I cannot catch it in OnErrorUpdate() ?

    it prints:
    order.Time:10/10/2024 5:22:02 AM OnOrderUpdate orderId='0e69d89edde0426b96c7649b384d730b' account='Playback101' name='Z1L' orderState=Submitted instrument='NQ 12-24' orderAction=Buy orderType='Stop Market' limitPrice=0 stopPrice=20438.25 quantity=1 tif=Gtc oco='' filled=0 averageFillPrice=0 onBehalfOf='' id=471 time='2024-10-10 05:22:02' gtd='2099-12-01' statementDate='2024-10-10' err NoError time:10/10/2024 5:22:02 AM natErr:
    Strategy 'ExecS01/342051783' submitted an order that generated the following error 'Order rejected'. Strategy has sent cancel requests, attempted to close the position and terminated itself.​
    Best
    Gio
    Last edited by giogio1; 11-22-2024, 06:18 AM.

    #2
    Hello Gio,

    Is the strategy running with RealtimeErrorHandling.IgnoreAllErrors or is the strategy becoming disabled when the error occurs?
    Chelsea B.NinjaTrader Customer Service

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by Mindset, 04-21-2026, 06:46 AM
    0 responses
    87 views
    0 likes
    Last Post Mindset
    by Mindset
     
    Started by M4ndoo, 04-20-2026, 05:21 PM
    0 responses
    128 views
    0 likes
    Last Post M4ndoo
    by M4ndoo
     
    Started by M4ndoo, 04-19-2026, 05:54 PM
    0 responses
    65 views
    0 likes
    Last Post M4ndoo
    by M4ndoo
     
    Started by cmoran13, 04-16-2026, 01:02 PM
    0 responses
    117 views
    0 likes
    Last Post cmoran13  
    Started by PaulMohn, 04-10-2026, 11:11 AM
    0 responses
    67 views
    0 likes
    Last Post PaulMohn  
    Working...
    X