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

Cancel Order

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

    Cancel Order

    Hello

    Suppose I tried to enter a position using the EnterLong method in a 'good till cancelled' mode.
    After awhile my order is still hasn't been filled (for example it's in a PendingSubmit mode) and I want to cancel that order. How should I do that? Using ExitLong or using CancelOrder (or maybe with another approach).

    Thanks
    Last edited by kiss987; 03-31-2016, 01:34 AM.

    #2
    Hello,
    If you have an order that is in PendingSubmit you will not be able to cancel it. You can only cancel orders that are in an order state of Accepted or Working. If the EnterLong() order is stuck in PendingCancel you will need to disconnect from your data provider if it was submitted to a live account; if it was submitted with a Simulation account you will need to reset the account. Resetting a simulation account will clear all historical trade data from this account. Please follow the instructions below to reset a simulation account. (This can take long depending on the size of your database file and your system.)

    From the NinjaTrader Control Center window select the menu Tools> Options> Simulator.
    Press the 'Reset' button.
    If you do not want to lose your trade data, uncheck the 'Clear history' box (This must be left checked when wanting to remove a stuck sim order)

    If you have an order submitted this way and is in an Accepted or Working state then the method you would use to cancel the order is CancelOrder(). If you are in a position from the EnterLong() order then you could use the ExitLong() order method to close your position.
    Cody B.NinjaTrader Customer Service

    Comment


      #3
      Thank you for your reply.
      So if i have an order which is on PendingSubmit which was submitted byEnterLong and I do not want to enter long anymore, I close/cancel it by ExitLong?

      Comment


        #4
        Hello kiss987,

        Thank you for your response.

        ExitLong() does not cancel orders that are in pending submit. Orders that are stuck in pending submit indicate an error in order submission.

        Comment


          #5
          So how can they be eliminated?
          Thanks

          Comment


            #6
            Repairing the database generally resolves the "stuck" orders. You can repair the database by going to Tools > Options > Data > Repair DB.

            Comment


              #7
              I am currently trading on demo and get orders which are stuck on PendingSubmit all the time.
              Is is because I'm working on a demo or shold I expect my orders to be stuck like that when I switch to live trading as well?

              Comment


                #8
                kiss987,

                You should not expect the orders to get stuck in pending submit at all. Only time this generally occurs is in incorrect use of OCO.

                May we test the strategy that has these orders go into pending submit? If so, please attach to your response or send to platformsupport[at]ninajtrader[dot]com with 'ATTN: Patrick H - 1491718' in the subject line.

                You can attach your strategy to your response by going to File > Utilities > Export NinjaScript > Export selected source files > select your strategy > select the right arrow > Export. The file will be located under (My) Documents\NinjaTrader 7\bin\Custom\ExportNinjaScript.

                Comment

                Latest Posts

                Collapse

                Topics Statistics Last Post
                Started by traderqz, Yesterday, 12:06 AM
                11 responses
                27 views
                0 likes
                Last Post NinjaTrader_Gaby  
                Started by PaulMohn, Today, 03:49 AM
                0 responses
                8 views
                0 likes
                Last Post PaulMohn  
                Started by inanazsocial, Today, 01:15 AM
                1 response
                10 views
                0 likes
                Last Post NinjaTrader_Jason  
                Started by rocketman7, Today, 02:12 AM
                0 responses
                11 views
                0 likes
                Last Post rocketman7  
                Started by dustydbayer, Today, 01:59 AM
                0 responses
                4 views
                0 likes
                Last Post dustydbayer  
                Working...
                X