Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

Partner 728x90

Collapse

CancelOrder on PendingSubmit Order

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

    CancelOrder on PendingSubmit Order

    I am using TraceOrders with an NT 7 strategy trading forex.

    I submit an EnterLong that creates an IOrder that moves to the PendingSubmit state. TraceOrders shows "Entered internal PlaceOrder()".

    Q1: Why does an order go into the PendingSubmit state?
    Q2: Why does it stay there, sometimes for a minute or two?

    After a period of time, I decide the order needs to be cancelled while still in the PendingSubmit state. I issue a CancelOrder with the IOrder returned by the original EnterLong.

    TraceOrders does not show any order management action. The order is not cancelled and remains in the PendingSubmit state?

    Q3: What is the expected outcome of issuing CancelOrder on an order in the PendingSubmit state?
    Q4: What is the expected action one should see from TraceOrders when issuing CancelOrder on an order in the PendingSubmit state?
    Q5: How does one cancel an order in the PendingSubmit state?

    Thanks.
    Multi-Dimensional Managed Trading
    jeronymite
    NinjaTrader Ecosystem Vendor - Mizpah Software

    #2
    Hello jeronymite,

    Thanks for your questions.

    Q1: Why does an order go into the PendingSubmit state?
    An order goes into PendingSubmit when it has been submitted to the broker but has not yet been accepted. Orders can get stuck here if OCO is being used and it is not disabled when another order is submitted. The broker sees the same OCO ID being used and does not accept the order.

    Q2: Why does it stay there, sometimes for a minute or two?
    It would mean that the order was submitted, but not accepted yet. Internet latency and volatility could affect the order in which the order is received.

    After a period of time, I decide the order needs to be cancelled while still in the PendingSubmit state. I issue a CancelOrder with the IOrder returned by the original EnterLong.

    TraceOrders does not show any order management action. The order is not cancelled and remains in the PendingSubmit state?

    In a real scenario, the order would have to be accepted by the broker before it can be cancelled.

    Q3: What is the expected outcome of issuing CancelOrder on an order in the PendingSubmit state?
    The CancelOrder request will still be sent by NinjaTrader. At that point it will be up to how the broker handles cancels that occur when an order is not in an accepted or working state. If the broker queues the order, it could be marked for cancellation before the submission completes. Please contact your broker for more information on how this scenario is handled.

    Q4: What is the expected action one should see from TraceOrders when issuing CancelOrder on an order in the PendingSubmit state?
    If an Order object exists, you should see an entry from TraceOrders that a Cancel has been submitted.

    I have created a demonstration video and a test for canceling orders to observe the expected behavior seen from TraceOrders and from OnOrderUpdate() This video is made with NinjaTrader 8 but is just as applicable to NinjaTrader 7 - https://www.screencast.com/t/NMJykAk1

    Q5: How does one cancel an order in the PendingSubmit state?
    If the order is not in an accepted or working state, it would not be possible to fully cancel it. How the order cancellation is handled before an order reaches an accepted state would have to be confirmed by your broker. NinjaTrader will tell you the feedback of the order states in OnOrderUpdate() and it will tell you if the orders come back as accepted working or filled. These states could then be used to drive further logic to attempt placing another order after some time, or to shut down the strategy.

    I have provided additional links to openly available documentation on OnOrderUpdate() and Order State definitions.

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

    Order State definitions - https://ninjatrader.com/support/help...efinitions.htm

    Please let me know if I may be of further assistance.
    JimNinjaTrader Customer Service

    Comment


      #3
      CancelOrder on PendingSubmit Order

      Thanks, Jim.

      I am using NinjaTrader Brokerage, specifically NinjaTrader FXCM. The tests I have been doing occur on a NinjaTrader FXCM demo account.

      It is only in recent days that orders have started becoming "stuck" in the PendingSubmit state for a period of time, shorter or longer. Prior to this, I had never seen such behaviour in the several years I have been using these demo accounts. Has something changed with the way orders for demo accounts are being processed or with the infrastructure supporting these accounts that would cause this?

      There has to be a supported way to completely and reliably cancel such orders. And surely NinjaTrader Brokerage accounts should fully support such a method.

      Given the behaviour I am now observing in the demo account, I am extremely hesitant to trade my live account.

      How is one to proceed?

      Thanks.
      Multi-Dimensional Managed Trading
      jeronymite
      NinjaTrader Ecosystem Vendor - Mizpah Software

      Comment


        #4
        We would be happy to assist you with any order submission issues.

        Could you write in to platformsupport [at] ninjatrader [dot] com with the thread URL, and your log and trace files?

        Please include the text "Attention Jim" and as much information about the order submission that got stuck in Pending Submit as possible. For example, order time, instrument, and price will help us track down the order and diagnose anything on the platform end.

        Please follow the steps below to manually attach your log and trace files to your response so I may investigate this matter further.
        • Open your NinjaTrader folder under My Documents.
        • Right click on the 'log' and 'trace' folders and select Send To> Compressed (zipped) Folder.
        • Send the 2 compressed folders as attachments to an email to Platform Support.
        • Once complete, you can delete these compressed folders.


        I look forward to being of further assistance.
        Last edited by NinjaTrader_Jim; 11-01-2017, 03:27 PM.
        JimNinjaTrader Customer Service

        Comment


          #5
          CancelOrder on PendingSubmit Order

          Thanks for the quick response, Jim.

          I'll put something together and send it on to you.

          Thanks.
          Multi-Dimensional Managed Trading
          jeronymite
          NinjaTrader Ecosystem Vendor - Mizpah Software

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by Christopher_R, Today, 12:29 AM
          0 responses
          6 views
          0 likes
          Last Post Christopher_R  
          Started by sidlercom80, 10-28-2023, 08:49 AM
          166 responses
          2,235 views
          0 likes
          Last Post sidlercom80  
          Started by thread, Yesterday, 11:58 PM
          0 responses
          3 views
          0 likes
          Last Post thread
          by thread
           
          Started by jclose, Yesterday, 09:37 PM
          0 responses
          7 views
          0 likes
          Last Post jclose
          by jclose
           
          Started by WeyldFalcon, 08-07-2020, 06:13 AM
          10 responses
          1,415 views
          0 likes
          Last Post Traderontheroad  
          Working...
          X