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.
    Gaby V.NinjaTrader Customer Service

    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​
        Gaby V.NinjaTrader Customer Service

        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

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by defa0009, Today, 12:27 PM
            0 responses
            2 views
            0 likes
            Last Post defa0009  
            Started by manteored, 02-16-2023, 10:24 AM
            6 responses
            1,639 views
            0 likes
            Last Post charlesthomas  
            Started by mbrandau, 07-28-2021, 01:58 PM
            11 responses
            569 views
            0 likes
            Last Post bluesoul40  
            Started by _Zero_, 04-10-2020, 03:21 PM
            149 responses
            8,929 views
            6 likes
            Last Post ChrisR
            by ChrisR
             
            Started by benghabili, Today, 10:18 AM
            1 response
            14 views
            0 likes
            Last Post NinjaTrader_ChristopherJ  
            Working...
            X