Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Minimum Bars required

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

    Minimum Bars required

    What is the significance of Minimum Bars required in a Ninjascript strategy.
    Does it affect whether the strategy will perform correctly running in real time?

    #2
    Just sets the min number of bars before OnBarUpdate() starts being called.
    RayNinjaTrader Customer Service

    Comment


      #3
      - indicators might be wacky as you start them starting with bar=0 (just try)
      - yes, it has relevance for realtime strategies too

      Comment


        #4
        Minimum Bars Required

        Min. bars required
        Sets the minimum number of bars required before the backtest will start processing


        Above is what it says in help files.
        It implies that it only has to do with backtesting?

        Comment


          #5
          Minimum Bars required

          I am running a Forex strategy based on 2 hour Bars starting at 10:00Pm and ending at 8:00Am next day, 5 bars.
          How does the minimum bars required set to 20 affect this?
          Also, should I set it to 0, and if so, how to code that in strategy?

          Comment


            #6
            Will ammend Help Guide.
            You would need 20 2 hour bars on your chart.
            BarsRequired = 0;
            RayNinjaTrader Customer Service

            Comment


              #7
              Minimum Bars required

              So, setting bars required to 0, would insure stategy runs and submits orders, where it is based on looking back for 1 bar, correct?

              Comment


                #8
                Not sure I follow. Here is the code -

                OnBarUpdate will trigger if CurrentBar >= BarsRequired
                RayNinjaTrader Customer Service

                Comment


                  #9
                  Minimum Bars required

                  I am going to test the strategy with Minimum Bars required set to 0, and see if it works okay.
                  Thanks,
                  Jim

                  Comment


                    #10
                    Can you please speak generally about what it means

                    when i set the bars to 1 minimum bars required will it only take account of the last bar to get me entry into the strategy? like 0 bars required would be employed if i want to have the strategy update on the current bar?

                    Many thanks,

                    Cam

                    Comment


                      #11
                      Hello cameo86,

                      Thank you for your note.

                      BarsRequired is how many bars on the chart (left to right) are needed before calculation is began for your indicator or strategy. Setting this to one does not mean one bar back, nor does zero mean current bar.

                      For this you would either want to use CalculateOnBarClose = True to calculate on the close of a bar, or CalculateOnBarClose = False to calculate on each incoming tick (current bar).

                      For information on CalculateOnBarClose please visit the following link: http://www.ninjatrader.com/support/h...onbarclose.htm

                      Please let me know if I may be of further assistance.

                      Comment

                      Latest Posts

                      Collapse

                      Topics Statistics Last Post
                      Started by Geovanny Suaza, 02-11-2026, 06:32 PM
                      0 responses
                      651 views
                      0 likes
                      Last Post Geovanny Suaza  
                      Started by Geovanny Suaza, 02-11-2026, 05:51 PM
                      0 responses
                      370 views
                      1 like
                      Last Post Geovanny Suaza  
                      Started by Mindset, 02-09-2026, 11:44 AM
                      0 responses
                      109 views
                      0 likes
                      Last Post Mindset
                      by Mindset
                       
                      Started by Geovanny Suaza, 02-02-2026, 12:30 PM
                      0 responses
                      574 views
                      1 like
                      Last Post Geovanny Suaza  
                      Started by RFrosty, 01-28-2026, 06:49 PM
                      0 responses
                      577 views
                      1 like
                      Last Post RFrosty
                      by RFrosty
                       
                      Working...
                      X