Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

BarsInProgress[1] causing expiration of BarsInProgress[0] orders

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

    BarsInProgress[1] causing expiration of BarsInProgress[0] orders

    With TraceOrders on, I can see that with 3 active orders, a new bar on the higher timeframe of the same instrument (BarsArray[1]) will cause the first of the three orders to expire but leave the other two.

    How can I keep all orders active until a new bar of the BarsArray[0] timeframe?

    #2
    Are your orders being submitted in the context of BarsInProgress[1] or [0]?
    RayNinjaTrader Customer Service

    Comment


      #3
      All orders are submitted withing the body of an

      if(BarsInProgress == 0)
      {
      order and position management logic ..
      }

      Comment


        #4
        Would you be able to to create a basic script that will demonstrate this to us so we can run some further tests?
        RayNinjaTrader Customer Service

        Comment


          #5
          I have attached a simple strategy which I placed on an ES 233t chart that adds the ES 5000v.

          If an order is working on the primary timeframe while a new bar is completed on the secondary (5000v), the order is cancelled.
          Attached Files

          Comment


            #6
            We will check this out. Thanks.
            RayNinjaTrader Customer Service

            Comment


              #7
              nolantx,

              I can't seem to get your strategy working the way you have described. Please inform me of exact reproduce steps. I am setting EntriesPerDirection to 3 and running on CalculateOnBarClose = true. Thank you.
              Josh P.NinjaTrader Customer Service

              Comment


                #8
                When Entries per Direction is set to 3 and Entry handling is set to UniqueEntries, all 3 orders are placed and the 1st order is canceled on the completion of the higher timeframe bar.

                When Entries per Direction is set to 3 and Entry handling is set to AllEntries, the third order is rejected with the following log entry:

                Ignored PlaceOrder() method at 12/2/2008 8:32:19 AM: Action=SellShort OrderType=Limit Quantity=1 LimitPrice=829.00 StopPrice=0 SignalName='S3' FromEntrySignal='' Reason='Exceeded entry signals limit based on EntryHandling and EntriesPerDirection properties'

                Either way, the 1st order is canceled with the higher timeframe (BarsArray[1]) bar completes, as follows:

                Cancelled expired order: BarsInProgress=1: Order='72a3fc58697d412293f5c76385728f45/Replay101' Name='S1' State=Working Instrument='ES 12-08' Action=SellShort Limit price=828.75 Stop price=0 Quantity=1 Strategy='Multi_Test' Type=Limit Tif=Gtc Oco='' Filled=0 Fill price=0 Token='72a3fc58697d412293f5c76385728f45' Gtd='12/1/2099 12:00:00 AM'

                The logic cannot, basic as it is, should not place any orders while BarsInProgress = 1.

                Please advise, there must be something I'm overlooking.

                Comment


                  #9
                  nolantx,

                  I used your strategy and do not experience the behavior you are stating. Please ensure you are on NT6.5.1000.7.

                  This is what I get:
                  Code:
                  12/3/2008 7:18:27 AM BarsInProgress 1
                  12/3/2008 7:18:27 AM BarsInProgress 0
                  12/3/2008 7:18:28 AM Entered internal PlaceOrder() method at 12/3/2008 7:18:28 AM: Action=SellShort OrderType=Limit Quantity=100 LimitPrice=50.00 StopPrice=0 SignalName='S1' FromEntrySignal=''
                  12/3/2008 7:18:28 AM Entered internal PlaceOrder() method at 12/3/2008 7:18:28 AM: Action=SellShort OrderType=Limit Quantity=100 LimitPrice=50.00 StopPrice=0 SignalName='S2' FromEntrySignal=''
                  12/3/2008 7:18:28 AM Entered internal PlaceOrder() method at 12/3/2008 7:18:28 AM: Action=SellShort OrderType=Limit Quantity=100 LimitPrice=50.00 StopPrice=0 SignalName='S3' FromEntrySignal=''
                  12/3/2008 7:18:30 AM BarsInProgress 1
                  12/3/2008 7:18:30 AM BarsInProgress 0
                  12/3/2008 7:18:31 AM Entered internal PlaceOrder() method at 12/3/2008 7:18:31 AM: Action=SellShort OrderType=Limit Quantity=100 LimitPrice=50.00 StopPrice=0 SignalName='S1' FromEntrySignal=''
                  12/3/2008 7:18:31 AM Ignored PlaceOrder() method at 12/3/2008 7:18:31 AM: Action=SellShort OrderType=Limit Quantity=100 LimitPrice=50.00 StopPrice=0 SignalName='S1' FromEntrySignal='' Reason='Exceeded entry signals limit based on EntryHandling and EntriesPerDirection properties'
                  12/3/2008 7:18:31 AM Entered internal PlaceOrder() method at 12/3/2008 7:18:31 AM: Action=SellShort OrderType=Limit Quantity=100 LimitPrice=50.00 StopPrice=0 SignalName='S2' FromEntrySignal=''
                  12/3/2008 7:18:31 AM Ignored PlaceOrder() method at 12/3/2008 7:18:31 AM: Action=SellShort OrderType=Limit Quantity=100 LimitPrice=50.00 StopPrice=0 SignalName='S2' FromEntrySignal='' Reason='Exceeded entry signals limit based on EntryHandling and EntriesPerDirection properties'
                  12/3/2008 7:18:31 AM Entered internal PlaceOrder() method at 12/3/2008 7:18:31 AM: Action=SellShort OrderType=Limit Quantity=100 LimitPrice=50.00 StopPrice=0 SignalName='S3' FromEntrySignal=''
                  12/3/2008 7:18:31 AM Ignored PlaceOrder() method at 12/3/2008 7:18:31 AM: Action=SellShort OrderType=Limit Quantity=100 LimitPrice=50.00 StopPrice=0 SignalName='S3' FromEntrySignal='' Reason='Exceeded entry signals limit based on EntryHandling and EntriesPerDirection properties'
                  12/3/2008 7:18:33 AM BarsInProgress 1
                  You can clearly see BIP1 firing off yet no order cancellation occurred. The next BIP0 call sends the same orders again and of course these are going to be ignored because we are already holding 3 orders.
                  Josh P.NinjaTrader Customer Service

                  Comment


                    #10
                    Josh,

                    You are not testing this strategy on the ES. If I put this strategy on another contract as you have done, it works fine.

                    Please try this on the same contract as the higher timeframe (ES 12-08) with Entries per direction of 3 and try both 'UniqueEntries" and 'Allentries'. I think you'll see different results.

                    Comment


                      #11
                      That is expected behavior. If you are using the same instruments you need to resubmit on all bar series of that instrument, not just the one you submitted to.
                      Josh P.NinjaTrader Customer Service

                      Comment


                        #12
                        Thank you so much Josh, somehow I overlooked this in the documentation. Can you post a link to those guidelines please.

                        Comment


                          #13
                          Josh P.NinjaTrader Customer Service

                          Comment


                            #14
                            Resubmitting orders on both bar series for same instrument

                            Originally posted by NinjaTrader_Josh View Post
                            That is expected behavior. If you are using the same instruments you need to resubmit on all bar series of that instrument, not just the one you submitted to.
                            I am having a similar issue. My strategy runs only on secondary bar series (2 bar series for one instrument):

                            Code:
                             
                            Initialize:
                            //Add tick by tick bars to strategy
                            Add(PeriodType.Tick, 1);
                             
                            OnBarUpdate:
                            // 1 min bars
                            if (BarsInProgress == 0)
                               return;
                             
                            //Enter on tick updates but use primary bars for entry signal
                            //Current tick > Closing price of previous 1 min bar
                            if (BarsInProgress == 1 && Close[0] > Closes[0][1])
                               EnterLongLimit(PositionSize, Close[0], "Buy");
                            A limit order gets submitted and is immediately cancelled and resubmitted on the next tick update. How do I resubmit the order (on both bar series) on each tick update so that it doesn't get cancelled?

                            I thought that would happen automatically since I have not referenced a specific BarsInProgress reference in my EnterLongLimit statement.

                            Comment


                              #15
                              Hello,


                              I recommend checking to see if the "Buy" order is in place and building a bool flag that tells you if the order should be placed based on your trade criteria.. If it is not, place the order.
                              DenNinjaTrader Customer Service

                              Comment

                              Latest Posts

                              Collapse

                              Topics Statistics Last Post
                              Started by tradebot, Yesterday, 01:25 PM
                              3 responses
                              18 views
                              0 likes
                              Last Post NinjaTrader_Gaby  
                              Started by manueldecastro, Yesterday, 10:26 AM
                              5 responses
                              24 views
                              0 likes
                              Last Post NinjaTrader_Gaby  
                              Started by memonic, 05-01-2024, 01:23 PM
                              5 responses
                              31 views
                              0 likes
                              Last Post memonic
                              by memonic
                               
                              Started by dcriador, Yesterday, 10:45 AM
                              2 responses
                              20 views
                              0 likes
                              Last Post dcriador  
                              Started by SnailHorn, Yesterday, 10:49 PM
                              1 response
                              12 views
                              0 likes
                              Last Post SnailHorn  
                              Working...
                              X