Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

CancelOrder Submits a Modified Order

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

    CancelOrder Submits a Modified Order

    I occasionally experience a situation where CancelOrder appears to submit a modified order on IB instead of canceling a limit order. The situation only occurs when the position is flat after being stopped out. The quanity used in the modified order is always 33.3% of the quantity in the original limit order. I've attached an Audit log from IB and also Print statement output from the Output window. On lines 47 and 48 of the output, the two open limit orders show the correct quantities of 50,000. On lines 74 and 75 of the output, the two open limit orders show the incorrect quantities of 16,666 (after the ATR stop flattened the position). I've also attached my code.

    In this case the order(s) was rejected by IB because it was under the 20,000 size limit for EURUSD, and the strategy shutdown.

    I have experienced this on both Beta 19 and Beta 20.

    Greg
    Attached Files
    The Trading Mantis
    NinjaTrader Ecosystem Vendor - The Trading Mantis

    #2
    Thanks for reporting in Greg, we'll take a look shortly and attempt reproducing on our end here.
    BertrandNinjaTrader Customer Service

    Comment


      #3
      One other small piece of information... This always and only seems to occur after T1 and T2 are hit and then the ATRStop is hit. I have seen this happen several times now and those have always been the conditions.

      Makes me think the problem is in my code, but I can find nothing that would set or change T3 and T4 after the ATRStop, unless it is some incredibly subtle logic error.
      The Trading Mantis
      NinjaTrader Ecosystem Vendor - The Trading Mantis

      Comment


        #4
        Just observed another behavior...

        After T1, T2 and T3 are hit and then the ATRStop is hit, a modified limit order was placed for T4 (equal to 66.66% of the original order quantity) and then immediately cancelled. This order is not rejected by IB because it is greater than the minimum order size for the EURUSD and the strategy continues to run.
        The Trading Mantis
        NinjaTrader Ecosystem Vendor - The Trading Mantis

        Comment


          #5
          Greg, could you please let me know with which parameters you startup your strategy? Just making sure we ran the same scenario.

          Thanks
          BertrandNinjaTrader Customer Service

          Comment


            #6
            I was running it on the EURUSD. The attached PNG shows the parameter settings I used.
            Attached Files
            The Trading Mantis
            NinjaTrader Ecosystem Vendor - The Trading Mantis

            Comment


              #7
              Thanks, got it running live here - so far no rejection issues, I'll keep monitoring it.
              BertrandNinjaTrader Customer Service

              Comment


                #8
                Greg, so far I could not see an issue here - I'll be off soon here, so I'll just leave it running and see what develops later.
                Attached Files
                BertrandNinjaTrader Customer Service

                Comment


                  #9
                  Bertrand,

                  Check the output window and look for a limit order for T3 (exitT3Order) when ATRStop (exitS3Order) was executed. The quantity of the limit order would be 33,333. You can also check the IB Audit Log.

                  When T3 is hit and then ATRStop hit, the order is not rejected because it is above the 20,000 minimum. After the order is submitted, it is immediately cancelled.

                  This behavior is slightly different than when T2 is hit and then the ATRStop is hit.
                  The Trading Mantis
                  NinjaTrader Ecosystem Vendor - The Trading Mantis

                  Comment


                    #10
                    gregschr,

                    Can you please attach your log/trace files as well for the time of your initial report? Thank you.
                    Josh P.NinjaTrader Customer Service

                    Comment


                      #11
                      Here you go....

                      I have also been running this on Market Replay, and the same thing is happening.
                      Attached Files
                      The Trading Mantis
                      NinjaTrader Ecosystem Vendor - The Trading Mantis

                      Comment


                        #12
                        Greg, thanks - got it running here again with TraceOrders = true in the Initilize() to check into.
                        BertrandNinjaTrader Customer Service

                        Comment


                          #13
                          Have so far not seen a case like yours when testing this - are you sure the account position was in sync with the strategy position at all times?
                          BertrandNinjaTrader Customer Service

                          Comment


                            #14
                            I am reaonably certain acct and strategy were in sync, I'll verify this is the case next time it happens. I have seen this situation happen multiple times so far.

                            Are you testing EURUSD on IB with a lot size of 50,000 and 4 lots? Problem has not happened when trading smaller lot size of 12 on ES 09-10.
                            The Trading Mantis
                            NinjaTrader Ecosystem Vendor - The Trading Mantis

                            Comment


                              #15
                              Yes, I tried today exactly with your posted UI settings on a IB Paper account here and did not see it, please keep an eye on the sync the next time you try just in case this is related, which I suspect currently.

                              Thanks
                              BertrandNinjaTrader Customer Service

                              Comment

                              Latest Posts

                              Collapse

                              Topics Statistics Last Post
                              Started by JoMoon2024, Today, 06:56 AM
                              0 responses
                              6 views
                              0 likes
                              Last Post JoMoon2024  
                              Started by Haiasi, 04-25-2024, 06:53 PM
                              2 responses
                              17 views
                              0 likes
                              Last Post Massinisa  
                              Started by Creamers, Today, 05:32 AM
                              0 responses
                              5 views
                              0 likes
                              Last Post Creamers  
                              Started by Segwin, 05-07-2018, 02:15 PM
                              12 responses
                              1,786 views
                              0 likes
                              Last Post Leafcutter  
                              Started by poplagelu, Today, 05:00 AM
                              0 responses
                              3 views
                              0 likes
                              Last Post poplagelu  
                              Working...
                              X