Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

liveUntilCancelled to which barsInProgressIndex

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

    liveUntilCancelled to which barsInProgressIndex

    if (BarsInProgress == 0)
    EnterLongLimit(1, false, 5, Close[0] - 3 * TickSize, "BuyLmt1");

    Assumption: false for liveUntilCancelled will cancel the order (if not filled) when the bar it was submitted to closes.?

    With the above order being called from the primary BarsInProgress, but sent to the seconday BarsInProgress, will the order cancel at the close of the primary or secondary BarsInProgress timeframe?

    #2
    To keep the order alive you need to resubmit on each OnBarUpdate() event.
    Josh P.NinjaTrader Customer Service

    Comment


      #3
      The real question was... will the order cancel at the close of the primary or secondary BarsInProgress timeframe?

      Comment


        #4
        To keep the order alive you need to resubmit on every OnBarUpdate() event. That means all BarsInProgress contexts.
        Josh P.NinjaTrader Customer Service

        Comment


          #5
          I don't want to keep the order alive. What I'm after is when exactly will the order cancel? I'll rephrase the question with more detail.

          The help guide states for the liveUntilCancelled parameter "The order will NOT expire at the end of a bar ..." (if set to true). Sense I am setting to false, I am trying to determine which Bars object the order will cancel on, because my strategy has two Bars objects for granular back testing. Is the order canceled on the primary Bars object from which the order is called, or the secondary Bars object where the order is sent to?

          (The script will be run on 6 minute Bars)
          Initialize()
          Add(PeriodType.Minute, 1) <- Create secondary bars object

          OnBarUpdate()
          if (BarsInProgress == 0) <- Process primary Bars object
          EnterLongLimit(1, false, 5, Close[0] - 3 * TickSize, "BuyLmt1");
          ....................^-- Send order to secondary Bars

          With the above long limit order being called from the 6 minute Bars object, but sent to the 1 minute Bars object, will the order cancel on the close of the 6 minute bar or the 1 minute bar?
          Last edited by zacharydw00; 02-21-2009, 01:19 AM.

          Comment


            #6
            Hello,

            I want to be sure you get a quality answer. I will have someone respond to your post on Monday.
            DenNinjaTrader Customer Service

            Comment


              #7
              Hi zacharydw00, it is advised to only to execute orders against the first series when running a multi series strategy on one instrument. So this will then be the deciding series when your limit orders will expire, you can also run this with TraceOrders = true, it will then indicate on which BarsObject orders were placed.

              Comment


                #8
                Thanks for the advice Bertrand. I agree. I would never do that in live trading. I am asking, because I am modifying my strategy specifically for Strategy Analyzer so I can analyze intrabar action if I apply a stoploss to the strategy. Therefore, I need to know the behavior of sending an order to a secondary Bars object.
                So, could someone please answer the question in post #5.
                Thanks.

                Comment


                  #9
                  zacharydw00,

                  It cancels at the NEXT OnBarUpdate() if you do not resubmit. If the next one is a primary then it cancels on the primary. If the next one is a secondary then it cancels on a secondary.
                  Josh P.NinjaTrader Customer Service

                  Comment


                    #10
                    Thanks Josh!

                    Comment


                      #11
                      Originally posted by NinjaTrader_Josh View Post
                      zacharydw00,

                      It cancels at the NEXT OnBarUpdate() if you do not resubmit. If the next one is a primary then it cancels on the primary. If the next one is a secondary then it cancels on a secondary.
                      What would the code look like to do that? I.e., keep it alive for a certain number of bars?

                      Comment


                        #12
                        Just keep calling your limit order for every bar you want to keep alive. You can use a counter to count how many bars it has been and when you want to stop, don't resubmit and it will expire.
                        Josh P.NinjaTrader Customer Service

                        Comment


                          #13
                          Originally posted by NinjaTrader_Josh View Post
                          Just keep calling your limit order for every bar you want to keep alive. You can use a counter to count how many bars it has been and when you want to stop, don't resubmit and it will expire.
                          Thank you Josh, appreciate it! Hadn't thought of that.

                          Comment

                          Latest Posts

                          Collapse

                          Topics Statistics Last Post
                          Started by Geovanny Suaza, 02-11-2026, 06:32 PM
                          0 responses
                          558 views
                          0 likes
                          Last Post Geovanny Suaza  
                          Started by Geovanny Suaza, 02-11-2026, 05:51 PM
                          0 responses
                          324 views
                          1 like
                          Last Post Geovanny Suaza  
                          Started by Mindset, 02-09-2026, 11:44 AM
                          0 responses
                          101 views
                          0 likes
                          Last Post Mindset
                          by Mindset
                           
                          Started by Geovanny Suaza, 02-02-2026, 12:30 PM
                          0 responses
                          545 views
                          1 like
                          Last Post Geovanny Suaza  
                          Started by RFrosty, 01-28-2026, 06:49 PM
                          0 responses
                          547 views
                          1 like
                          Last Post RFrosty
                          by RFrosty
                           
                          Working...
                          X