Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

question regarding orders in orderState=CancelPending

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

    question regarding orders in orderState=CancelPending

    Hi NT experts,

    If an order is having orderState=CancelPending, can it still execute when the right condition is met ?

    if yes, is there any way for me to block or prevent the execution ?
    Last edited by elirion; 04-15-2025, 10:19 AM.

    #2
    Hello elirion,

    Thank you for your post.

    No, if an order's state is CancelPending, this means that NinjaTrader has sent a request to the exchange to cancel the order. It will not be able to execute, and you will likely see an error if the strategy attempts to submit the order, similar to:

    Code:
    Order='XXXXXXXXXX/XXXX Name='XXXX' New state='Rejected' Instrument='XX XX-XX' Action='X' Limit price=X Stop price=X Quantity=X Type='XX' Time in force=XX Oco='' Filled=0 Fill price=0 Error='Unable to submit order' Native error='Order 'XXXXXXXXXXXXX' can't be submitted: order status is CancelPending.'
    Please let us know if you have any further questions.

    Comment


      #3
      Hi Gaby,


      I am running my strategy on a simulated account. Basically I went short and price hits my profit target and I cancelled my stoploss order.
      However price went up and trigger my stoploss. This resulted in a stray long position.

      The sequence of of status change goes from CancelPending => Working => Filled. If this is not the intended behaviour, I take it as there is some issue with the demo server ?

      I am not too worried if the production server will not exhibit this behavior: a CancelPending order will never execute.

      Code:
      OnOrderUpdate(): <Order string>: orderId='203450801598' account='[removed]' name='SHORT-LOSS' orderState=CancelPending instrument='NQ 06-25' orderAction=BuyToCover orderType='Stop Market' limitPrice=0 stopPrice=19053.75 quantity=1 tif=Day oco='' filled=0 averageFillPrice=0 onBehalfOf='' id=37993 time='2025-04-15 22:17:38' gtd='2099-12-01' statementDate='2025-04-15'
      OnOrderUpdate(): <Order string>: orderId='203450801598' account='[removed]' name='SHORT-LOSS' orderState=Working instrument='NQ 06-25' orderAction=BuyToCover orderType='Stop Market' limitPrice=0 stopPrice=19053.75 quantity=1 tif=Day oco='' filled=0 averageFillPrice=0 onBehalfOf='' id=37993 time='2025-04-15 22:17:37' gtd='2099-12-01' statementDate='1800-01-01'
      OnOrderUpdate(): <Order string>: orderId='203450801598' account='[removed]' name='SHORT-LOSS' orderState=Filled instrument='NQ 06-25' orderAction=BuyToCover orderType='Stop Market' limitPrice=0 stopPrice=19053.75 quantity=1 tif=Day oco='' filled=1 averageFillPrice=19054 onBehalfOf='' id=37993 time='2025-04-15 22:17:38' gtd='2099-12-01' statementDate='1800-01-01'​
      Last edited by elirion; 04-15-2025, 10:56 AM.

      Comment


        #4
        Hello elirion,

        Please send me your log and trace files so that I may look into what occurred.


        You can do this by going to the Control Center-> Help-> Email Support


        Ensuring 'Log and Trace Files' is checked will include these files. This is checked by default.


        Please reference the following ticket number in the body of the email: Case Number:06033036 ATTN Gaby​

        Comment


          #5
          Hello Gaby,

          I was not able to send the files via Email Support function due to "The limit on the number of allowed outgoing messages was exceeded."
          Anyways I have sent the files via email to support @ ninjatrader.com, attention to you.

          Hope to hear from you soon.

          Comment


            #6
            Hello Gaby,

            Thanks for your solution. Learnt a lot especially the part on in-flight executions.

            Comment


              #7
              Hi,

              Can you please share what the solution was? I get the same issue with strategies not cleaning up the SL, I send cancel, I get CancelPending, and 2 hours later the SL triggers with Working+Filled.
              This happens only once in a while, most of the time after CancelPending I receive also CancelSubmitted and everything works ok.

              Thanks

              Comment

              Latest Posts

              Collapse

              Topics Statistics Last Post
              Started by NullPointStrategies, Today, 05:17 AM
              0 responses
              25 views
              0 likes
              Last Post NullPointStrategies  
              Started by argusthome, 03-08-2026, 10:06 AM
              0 responses
              120 views
              0 likes
              Last Post argusthome  
              Started by NabilKhattabi, 03-06-2026, 11:18 AM
              0 responses
              63 views
              0 likes
              Last Post NabilKhattabi  
              Started by Deep42, 03-06-2026, 12:28 AM
              0 responses
              41 views
              0 likes
              Last Post Deep42
              by Deep42
               
              Started by TheRealMorford, 03-05-2026, 06:15 PM
              0 responses
              46 views
              0 likes
              Last Post TheRealMorford  
              Working...
              X