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 CarlTrading, 03-31-2026, 09:41 PM
    1 response
    79 views
    1 like
    Last Post NinjaTrader_ChelseaB  
    Started by CarlTrading, 04-01-2026, 02:41 AM
    0 responses
    40 views
    0 likes
    Last Post CarlTrading  
    Started by CaptainJack, 03-31-2026, 11:44 PM
    0 responses
    63 views
    2 likes
    Last Post CaptainJack  
    Started by CarlTrading, 03-30-2026, 11:51 AM
    0 responses
    63 views
    0 likes
    Last Post CarlTrading  
    Started by CarlTrading, 03-30-2026, 11:48 AM
    0 responses
    54 views
    0 likes
    Last Post CarlTrading  
    Working...
    X