Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Stop order is being cancelled that is unrelated

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

    Stop order is being cancelled that is unrelated

    I'm having a problem at the moment whereby the below ShortStopOrder2 is being cancelled when the ShortTargetOrder is executed. I expect the ShortStopOrder1 to be cancelled which is happening because it is related to the ShortEntryOrder1. The tricky thing is this does not happen all the time and I believe the problem may occur when the ShortEntryOrder1 has multiple rows in the Control Center's Executions Tab. eg 2 rows with 1 contract each. I run this strategy on both the ES and NQ contracts and it occurs more frequently on NQ maybe because of the way it fills??

    The problem is occurring in Simulation mode for both long and short entries. I would appreciate any help please.

    ShortEntryOrder1=EnterShortLimit(0,false,2,EntryOr derPrice,"MyShortEntry1");

    ShortEntryOrder2=EnterShortLimit(0,false,1,EntryOr derPrice,"MyShortEntry2");

    ShortStopOrder1=ExitShortStop(0,true,order.Filled, StopOrderPrice, "MyShortStop1", "MyShortEntry1");

    ShortTargetOrder = ExitShortLimit(0, true, order.Filled, TargetOrderPrice, "MyShortTarget", "MyShortEntry1");

    ShortStopOrder2 = ExitShortStop(0, true, order.Filled, StopOrderPrice, "MyShortStop2", "MyShortEntry2");

    #2
    top order is being cancelled that is unrelated cont..

    I forgot to mention when the strategy is run on historical data it performs as expected.

    Comment


      #3
      Hi ahagger, welcome to the NinjaTrader support forums! Please use TraceOrders = true in your Initialize() and see what insight the TraceOrders output has to offer - http://www.ninjatrader-support.com/H...aceOrders.html

      Please also see this tip regarding TraceOrders - http://www.ninjatrader-support2.com/...ead.php?t=3627
      Last edited by NinjaTrader_Bertrand; 01-15-2009, 09:43 AM.
      BertrandNinjaTrader Customer Service

      Comment


        #4
        Thanks for replying Bertrand. I actually already run TraceOrders = True in my code. I will run my scripts on live data tomorrow and provide the output for you to check out. When the problem does occur the output I have seen to date generated by TraceOrders just gives the standard "Cancelled pending exit order, since associated position is closed". Problem is that the associated ShortEntryOrder2 position isn't closed. I do not know why it cancels the ShortStopOrder2 only to say that it seems to occur when the ShortEntryOrder1 which is a 2 contract position is filled in single contracts (ie. two rows in the Executions Tab). Previously mentioned when run on historical data the trace orders output looks and behaves correctly also when run on live data and ShortEntryOrder1 generates 1 row, places a 2 in the Qty column in the Executions Tab everything works correctly.

        Comment


          #5
          Hi ahagger, yes please post the TraceOrders output here for review. It may have to do with your order.filled parameter as quantity in the order, if this is invalid or not supplied the full position will be exited.
          BertrandNinjaTrader Customer Service

          Comment


            #6
            Hi Bertrand here is the trace orders output.

            16/01/2009 9:28:54 AM Entered internal PlaceOrder() method at 16/01/2009 9:28:54 AM: Action=SellShort OrderType=Limit Quantity=2 LimitPrice=463.8 StopPrice=0 SignalName='MyOracleShortEntry1' FromEntrySignal=''
            16/01/2009 9:28:54 AM Entered internal PlaceOrder() method at 16/01/2009 9:28:54 AM: Action=SellShort OrderType=Limit Quantity=1 LimitPrice=463.8 StopPrice=0 SignalName='MyOracleShortEntry2' FromEntrySignal=''
            16/01/2009 9:28:56 AM Entered internal PlaceOrder() method at 16/01/2009 9:28:56 AM: Action=BuyToCover OrderType=Stop Quantity=1 LimitPrice=0 StopPrice=464.6 SignalName='MyOracleShortStop2' FromEntrySignal='MyOracleShortEntry2'
            16/01/2009 9:28:56 AM Entered internal PlaceOrder() method at 16/01/2009 9:28:56 AM: Action=BuyToCover OrderType=Stop Quantity=2 LimitPrice=0 StopPrice=464.6 SignalName='MyOracleShortStop1' FromEntrySignal='MyOracleShortEntry1'
            16/01/2009 9:28:56 AM Entered internal PlaceOrder() method at 16/01/2009 9:28:56 AM: Action=BuyToCover OrderType=Limit Quantity=2 LimitPrice=463.4 StopPrice=0 SignalName='MyOracleShortTarget' FromEntrySignal='MyOracleShortEntry1'
            16/01/2009 9:30:04 AM Cancelled pending exit order, since associated position is closed: Order='09447b3ff67443748adb42b3ae4b7b03/Sim103' Name='MyOracleShortStop1' State=Accepted Instrument='TF 03-09' Action=BuyToCover Limit price=0 Stop price=464.6 Quantity=2 Strategy='SystemOracle' Type=Stop Tif=Gtc Oco='' Filled=0 Fill price=0 Token='09447b3ff67443748adb42b3ae4b7b03' Gtd='01/12/2099 12:00:00 AM'
            16/01/2009 9:30:04 AM Cancelled pending exit order, since associated position is closed: Order='3d80612553b44516ab3ae22b7681c43f/Sim103' Name='MyOracleShortStop2' State=Accepted Instrument='TF 03-09' Action=BuyToCover Limit price=0 Stop price=464.6 Quantity=1 Strategy='SystemOracle' Type=Stop Tif=Gtc Oco='' Filled=0 Fill price=0 Token='3d80612553b44516ab3ae22b7681c43f' Gtd='01/12/2099 12:00:00 AM'

            Comment


              #7
              ahagger,

              Do you have a simple-as-possible strategy that demonstrates this? We would like to test it on our end and are not sure how you have coded yours. Thank you.
              Josh P.NinjaTrader Customer Service

              Comment


                #8
                Hi Josh,
                I will try and put something together. As mentioned previously it doesn't happen all the time only when the rows in the Executions tab look like this;

                Instrument Action Qty Price Time ID E/X Position Order ID Name Commission Rate Account Connection
                TF 03-09 Sell 1 463.8 16/01/2009 9:28 e146643734544fbbaa17e51d812d61d9 Entry 1S f33ac1a3c3284ace916407ee669af953 MyOracleShortEntry1 0 1 Sim103 Mirus-Live
                TF 03-09 Sell 1 463.8 16/01/2009 9:28 c0d422ce0ca54db9a598e6a5f94abafa Entry 2S 6e29a5333d9b468a9bd326f5c7a07be4 MyOracleShortEntry2 0 1 Sim103 Mirus-Live
                TF 03-09 Sell 1 463.8 16/01/2009 9:28 2df3c6edbd1e4523b1ffe36a1e4d8199 Entry 3S f33ac1a3c3284ace916407ee669af953 MyOracleShortEntry1 0 1 Sim103 Mirus-Live
                TF 03-09 Buy 2 463.4 16/01/2009 9:30 c51d1d76b4b844bd9ebcc8b6831b53a8 Exit 1S 80c5c57d3d7f4cbaaa63aa605c38b333 MyOracleShortTarget 0 1 Sim103 Mirus-Live

                Comment


                  #9
                  Understood. If you are able to get it to reproduce at will, that scenario would be extremely helpful. Thank you.
                  Josh P.NinjaTrader Customer Service

                  Comment


                    #10
                    Hi Josh,

                    Attached is a strategy which should produce examples of the problem. Try testing it on the TF 03-09 contract on an 89 tick chart.
                    Attached Files

                    Comment


                      #11
                      Forgot to mention Entry Handling should be set to UniqueEntries.

                      Comment


                        #12
                        ahagger,

                        Realtime? Backtesting? Do you have a replay file and a timestamp where your issue consistently occurs?
                        Josh P.NinjaTrader Customer Service

                        Comment


                          #13
                          Realtime. I don't have a recent replay file. To reproduce the issue in replay mode I assume I will need to wait to Monday to record some data??. I ran the strategy I sent you on TF 03-09 89 tick and it produced the issue when it placed these orders;

                          Instrument Action Qty Price Time ID E/X Position Order ID Name Commission Rate Account Connection
                          TF 03-09 Buy 1 462.6 16/01/2009 14:35 125453905da745179b1730f4775ce63f Entry 1L 38deae3f343f4df48919865a13bdc738 MyNTSupportLongEntry1 0 1 Sim101 Mirus-Live
                          TF 03-09 Buy 1 462.6 16/01/2009 14:35 092b793f636c4cdbb4fbb21fda1302db Entry 2L f3d7d632274b48d9bbe90edb31b3af88 MyNTSupportLongEntry2 0 1 Sim101 Mirus-Live
                          TF 03-09 Buy 1 462.7 16/01/2009 14:35 6c3c3fee8e144a7eb468aecbb3786013 Entry 3L 38deae3f343f4df48919865a13bdc738 MyNTSupportLongEntry1 0 1 Sim101 Mirus-Live
                          TF 03-09 Sell 1 463 16/01/2009 14:35 319a5dc88c3546418de1092946e8e74e Exit 2L 9cb4f69919104463aa9aabe9570bad2e MyNTSupportLongTarget 0 1 Sim101 Mirus-Live
                          TF 03-09 Sell 1 463 16/01/2009 14:35 8979cab3cea6425fab5360a6431fef70 Exit 1L 9cb4f69919104463aa9aabe9570bad2e MyNTSupportLongTarget 0 1 Sim101 Mirus-Live

                          Comment


                            #14
                            The timestamp on the orders below is Chicago time.

                            Comment


                              #15
                              ahagger,

                              We will take a look at it, but it may be till after the weekend before we can conclude anything.
                              Josh P.NinjaTrader Customer Service

                              Comment

                              Latest Posts

                              Collapse

                              Topics Statistics Last Post
                              Started by algospoke, Yesterday, 06:40 PM
                              2 responses
                              23 views
                              0 likes
                              Last Post algospoke  
                              Started by ghoul, Today, 06:02 PM
                              3 responses
                              14 views
                              0 likes
                              Last Post NinjaTrader_Manfred  
                              Started by jeronymite, 04-12-2024, 04:26 PM
                              3 responses
                              45 views
                              0 likes
                              Last Post jeronymite  
                              Started by Barry Milan, Yesterday, 10:35 PM
                              7 responses
                              21 views
                              0 likes
                              Last Post NinjaTrader_Manfred  
                              Started by AttiM, 02-14-2024, 05:20 PM
                              10 responses
                              181 views
                              0 likes
                              Last Post jeronymite  
                              Working...
                              X