Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Strategy sent cancel request

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

    Strategy sent cancel request

    Hi, Occasionally I get this error in my strategy when placing a trade. Happens when the market is moving fast. Is there a way to capture this error so the strategy doesn't terminate? thanks



    Strategy 'MyNT8TradeEntry/200702403' submitted an order that generated the following error 'Order rejected'. Strategy has sent cancel requests, attempted to close the position and terminated itself.

    Sim101, Sell stop or sell stop limit orders can't be placed above the market. affected Order: Sell 1 StopLimit @ 2833 x 2833


    Order='7ac9483809b44823940a9d11589b013f/Sim101' Name='shortOrder3' New state='Rejected' Instrument='ES 06-20' Action='Sell' Limit price=2833 Stop price=2833 Quantity=1 Type='Stop Limit' Time in force=GTC Oco='' Filled=0 Fill price=0 Error='Order rejected' Native error='Sell stop or sell stop limit orders can't be placed above the market.'
    Attached Files

    #2
    Hello pman777,

    Thanks for your post.

    To prevent the strategy from being deactivated, you can set the strategy's RealtimeErrorHandling property to IgnoreAllErrors or StopCancelCloseIgnoreRejects. With this property set, you can then trap order rejections in OnOrderUpdate if you would like to have the strategy attempt a different action.

    RealtimeErrorHandling - https://ninjatrader.com/support/help...orhandling.htm

    OnOrderUpdate() - https://ninjatrader.com/support/help...rderupdate.htm

    Please let me know if I can be of further assistance.

    Comment


      #3
      thank you Jim. Can you provide a sample or example where an error is captured in OnOrderUpdate()?

      Comment


        #4
        Hello pman777,

        You could consider the following as an example for a handling a rejection on a stop loss order submitted with SetStopLoss(). Order.Name would be the signal name given when submitting the order.

        Code:
        protected override void OnOrderUpdate(Cbi.Order order, double limitPrice, double stopPrice, 
            int quantity, int filled, double averageFillPrice, 
            Cbi.OrderState orderState, DateTime time, Cbi.ErrorCode error, string comment)
        {
            if (order.Name == "Stop loss" && order.OrderState == OrderState.Rejected)
                ExitLong();
        }
        We look forward to assisting.

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by argusthome, 03-08-2026, 10:06 AM
        0 responses
        111 views
        0 likes
        Last Post argusthome  
        Started by NabilKhattabi, 03-06-2026, 11:18 AM
        0 responses
        60 views
        0 likes
        Last Post NabilKhattabi  
        Started by Deep42, 03-06-2026, 12:28 AM
        0 responses
        38 views
        0 likes
        Last Post Deep42
        by Deep42
         
        Started by TheRealMorford, 03-05-2026, 06:15 PM
        0 responses
        43 views
        0 likes
        Last Post TheRealMorford  
        Started by Mindset, 02-28-2026, 06:16 AM
        0 responses
        79 views
        0 likes
        Last Post Mindset
        by Mindset
         
        Working...
        X