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 NullPointStrategies, Yesterday, 05:17 AM
    0 responses
    58 views
    0 likes
    Last Post NullPointStrategies  
    Started by argusthome, 03-08-2026, 10:06 AM
    0 responses
    133 views
    0 likes
    Last Post argusthome  
    Started by NabilKhattabi, 03-06-2026, 11:18 AM
    0 responses
    73 views
    0 likes
    Last Post NabilKhattabi  
    Started by Deep42, 03-06-2026, 12:28 AM
    0 responses
    45 views
    0 likes
    Last Post Deep42
    by Deep42
     
    Started by TheRealMorford, 03-05-2026, 06:15 PM
    0 responses
    50 views
    0 likes
    Last Post TheRealMorford  
    Working...
    X