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

submitted a cancellation request for Order ID '1146265001' has not been confirmed ...

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

    submitted a cancellation request for Order ID '1146265001' has not been confirmed ...

    What's this all about?

    Code:
    **NT** Strategy 'iPEADv401/81d470114ca947ce9ddc501c221d9463' submitted a cancellation request for Order ID '1146265001' has not been confirmed cancelled. Please check your account orders and positions.
    **NT** Disabling NinjaScript strategy 'iPEADv401/81d470114ca947ce9ddc501c221d9463'
    Also, after such errors, the ninjatrader *exits* any open positions. I would prefer it to leave the positions open, so that I can manage them manually. Can this be done?

    #2
    Hello AntiMatter,

    Please use Help > Mail to support feature to attach your trace / log files so we can review the complete sequence. Send to Attn: RyanM and we'll take a look.
    Ryan M.NinjaTrader Customer Service

    Comment


      #3
      Thanks for sending in the files. Unfortunately no way to change NT's handling in this case, except to move towards a real time only strategy, or manually cancel any previous working strategy orders.

      The process you're running into is described here on the syncing page:


      When your strategy starts it will check for any active orders previously generated by the strategy on your account and cancel those first. Should the strategy be unable to cancel and receive confirmation on the cancellation of these orders within 40 seconds the strategy will not start and an alert will be issued.

      It will run through this process anytime you start the strategy, so the only way to prevent it is to have no working orders from a previous strategy instance. Best recommendation here is to find out the exact difficulty cancelling this particular order. Your broker is the best one to work with on this, as they should be able to provide more details based on a given order id.
      Ryan M.NinjaTrader Customer Service

      Comment


        #4
        There were no open positions from a previous strategy instance. In fact, the script seemed to be trying to close all my positions due to another error. The failed cancellation request was the script trying to close one of my stoplosses.


        This is one of my stopLosses being ordered:
        Code:
        7/25/2011 9:34:01 AM|1|32|Order='1146265001/U591241' Name='Stop loss' New state=Accepted Instrument='BOH' Action=Sell Limit price=0 Stop price=44.38 Quantity=100 Type=Stop Filled=0 Fill price=0 Error=NoError Native error=''
        And this is the error:

        Code:
        7/25/2011 9:34:07 AM|0|128|Strategy 'iPEADv401/81d470114ca947ce9ddc501c221d9463' submitted a cancellation request for Order ID '1146265001' has not been confirmed cancelled. Please check your account orders and positions.
        I think the problem could be related to a previous order, where I tried to sell short, but shares were not avialable:

        Code:
        7/25/2011 9:33:55 AM|1|32|Order='c751d34d1af74a0a976260669579460d/U591241' Name='CSR4' New state=PendingSubmit Instrument='CSR' Action=SellShort Limit price=5.33 Stop price=0 Quantity=1,873 Type=Limit Filled=0 Fill price=0 Error=NoError Native error=''
        7/25/2011 9:33:55 AM|1|32|Order='c751d34d1af74a0a976260669579460d/U591241' Name='CSR4' New state=Accepted Instrument='CSR' Action=SellShort Limit price=5.33 Stop price=0 Quantity=1,873 Type=Limit Filled=0 Fill price=0 Error=NoError Native error=''
        7/25/2011 9:33:55 AM|1|32|Order='c751d34d1af74a0a976260669579460d/U591241' Name='CSR4' New state=Rejected Instrument='CSR' Action=SellShort Limit price=5.33 Stop price=0 Quantity=1,873 Type=Limit Filled=0 Fill price=0 Error=OrderRejected Native error='Order held while securities are located. (404)'
        7/25/2011 9:33:55 AM|0|32|IB-shaku, Order held while securities are located. (404) affected Order: SellShort 1873 Limit @ 5.33
        7/25/2011 9:33:55 AM|1|32|Order='1146264998/U591241' Name='CSR4' New state=Accepted Instrument='CSR' Action=SellShort Limit price=5.33 Stop price=0 Quantity=1,873 Type=Limit Filled=0 Fill price=0 Error=NoError Native error=''
        7/25/2011 9:33:55 AM|0|128|Strategy 'iPEADv401/81d470114ca947ce9ddc501c221d9463' submitted an order that generated the following error 'OrderRejected'. Strategy has sent cancel requests, attempted to close the position and terminated itself.
        7/25/2011 9:33:55 AM|1|32|Order='1146264998/U591241' Name='CSR4' New state=PendingCancel Instrument='CSR' Action=SellShort Limit price=5.33 Stop price=0 Quantity=1,873 Type=Limit Filled=0 Fill price=0 Error=NoError Native error=''
        7/25/2011 9:33:55 AM|1|32|Order='1146264998/U591241' Name='CSR4' New state=Cancelled Instrument='CSR' Action=SellShort Limit price=5.33 Stop price=0 Quantity=1,873 Type=Limit Filled=0 Fill price=0 Error=NoError Native error='Order Canceled - reason: (202)'
        7/25/2011 9:33:55 AM|1|32|Order='2f77663a560546a3b0bc9e82247f351a/U591241' Name='SREV4' New state=PendingSubmit Instrument='SREV' Action=SellShort Limit price=17.14 Stop price=0 Quantity=583 Type=Limit Filled=0 Fill price=0 Error=NoError Native error=''
        Is this the problem, and how do I avoid it?

        Comment


          #5
          It's identifying order 146265001 as for cancellation. How did you originally place this order? What date/time was this order originally submitted?
          Last edited by NinjaTrader_RyanM1; 07-25-2011, 01:11 PM.
          Ryan M.NinjaTrader Customer Service

          Comment


            #6
            No, it did not have any orders from a previous instance of the strategy!!!

            This was an order that this instance of the strategy entered, and then almost immediately tried to cancel.

            Comment


              #7
              Thanks for the reply. Yes, you're right -- looks like due to that first order rejection message, and then the message later on is difficulty cancelling the stop loss order. The default rejection handling is to stop the strategy, cancel any remaining working orders, and then close any open positions managed by the strategy by submitting one "Close" order for each unique position.

              You can program your own rejection handling by turning off RealTimeErrorHandling and monitoring for rejected state.
              Ryan M.NinjaTrader Customer Service

              Comment


                #8
                Hmmn, I set the following:
                Code:
                            ExitOnClose = false;
                            RealtimeErrorHandling = RealtimeErrorHandling.TakeNoAction;
                However, on hitting an overfill, the script still closed all of my positions and stopped!

                Code:
                **NT** Enabling NinjaScript strategy 'iPEADv402/40aca2ea8a91404d91641e1b5951c1a3' : On starting a real-time strategy - StrategySync=SubmitImmediately SyncAccountPosition=False EntryHandling=UniqueEntries EntriesPerDirection=1 StopTargetHandling=PerEntryExecution ErrorHandling=TakeNoAction ExitOnClose=False Set order quantity by=Strategy ConnectionLossHandling=KeepRunning DisconnectDelaySeconds=10 CancelEntryOrdersOnDisable=True CancelExitOrdersOnDisable=False MaxRestarts=4 in 5 minutes
                **NT** An over fill was detected on order 'Order='773226535/DU73059' Name='ORBK6' State=Filled Instrument='ORBK' Action=SellShort Limit price=11.99 Stop price=0 Quantity=833 Strategy='iPEADv402' Type=Limit Tif=Gtc Oco='' Filled=833 Fill price=11.954 Token='e71216f6c626492e942cf756fde5305b' Gtd='01/12/2099 00:00:00'' generated by strategy 'iPEADv402/40aca2ea8a91404d91641e1b5951c1a3' : This strategy will be disabled and NinjaTrader will attempt to cancel/close any strategy generated orders and positions. Please check your account orders and positions and take any appropriate action.
                **NT** Strategy 'iPEADv402/40aca2ea8a91404d91641e1b5951c1a3' attempted to cancel an order with ID '773226549' however, NinjaTrader has not yet received cancellation confirmation from your broker. Please check your account orders and position and take appropriate action.
                **NT** Disabling NinjaScript strategy 'iPEADv402/40aca2ea8a91404d91641e1b5951c1a3'

                Comment


                  #9
                  As in the above post;

                  I just had NinjaTrader crash on me - it exitied all position before crashing. This was horrible. Is there any way for NT to not exit all positons if a strategy (or the NinjaTrader itself) crashes?

                  I have set the following:
                  ExitOnClose = false; RealtimeErrorHandling = RealtimeErrorHandling.TakeNoAction;

                  Comment


                    #10
                    Sorry for the missed post, Antimatter.

                    Error handling does not apply to overfills. The only way to program your own overfill handling is to work in unmanaged approach and set IgnoreOverFill = true.


                    Is this what you mean in your latest post had NinjaTrader crash on me. Is that an overfill or did the program crash?
                    Ryan M.NinjaTrader Customer Service

                    Comment


                      #11
                      Both times above, I hit an overfill and NT exited all my positions. In the second instance, NinjaTrader also crashed after entering all the exit orders.

                      So If I set IgnoreOverFill = true, then if I hit an overfill:

                      1) the strategy will continue to run?
                      2) NT will not exit my positions?

                      Thanks

                      Comment


                        #12
                        IgnoreOverFill is only available with unmanaged strategy, so you should first look at how your strategy is coded, to see if you can make changes that will reduce chance of overfill.

                        Unmanaged strategy should only be considered if you have evaluated everything completely and find that overfills are still going to happen in your strategy, and are prepared to makes all the changes to code your own order management system.

                        With unmanaged strategy and ignore overfill, strategy keeps running and does nothing when overfill occurs.
                        Ryan M.NinjaTrader Customer Service

                        Comment


                          #13
                          My strategy involves getting prices very close to market, so there is always a chance of an overfill. I guess I need to go unmanaged :-(

                          Comment


                            #14
                            OK I seem to be making some progress with unmanaged approach.
                            One thing - normally my unfilled orders cancel after 1 minute. What would be the best way to mimic this behaviour? I have calculateOnBarClose = false fwiw, so I cant just wait for the next bar.

                            Comment


                              #15
                              If you are running with COBC = false, but want a way to monitor for new bars, can use FirstTickOfBar.

                              if (FirstTickOfBar)
                              //CancelHere

                              More control is possible if you want to wait exactly 1 minute before cancelling. For this you would have to capture date time at time of submission and then use this captured time in your cancel conditions.

                              Ryan M.NinjaTrader Customer Service

                              Comment

                              Latest Posts

                              Collapse

                              Topics Statistics Last Post
                              Started by DawnTreader, 05-08-2024, 05:58 PM
                              7 responses
                              25 views
                              0 likes
                              Last Post NinjaTrader_Gaby  
                              Started by sgordet, Today, 05:24 AM
                              0 responses
                              5 views
                              0 likes
                              Last Post sgordet
                              by sgordet
                               
                              Started by royhagerman, Today, 04:30 AM
                              0 responses
                              1 view
                              0 likes
                              Last Post royhagerman  
                              Started by haas88, 03-21-2024, 02:22 AM
                              18 responses
                              208 views
                              0 likes
                              Last Post haas88
                              by haas88
                               
                              Started by Board game geek, Today, 02:20 AM
                              0 responses
                              8 views
                              0 likes
                              Last Post Board game geek  
                              Working...
                              X