Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

Partner 728x90

Collapse

Historic Data in Multi-Bars Strategy

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

    Historic Data in Multi-Bars Strategy

    Hello,

    I have made a very simple Script:
    protected override void Initialize()
    {
    CalculateOnBarClose = true;
    // Add(PeriodType.Day, 1);
    }

    protected override void OnBarUpdate()
    {
    Print(Time[0]+": "+High[1]);
    }

    This does work and shows the Highs of the last 15 Days of ES 06-09 (60Min).
    If I activate the Add()-Line, only the data of the last Bar is printed. Shouldn't it also work with historical data?
    Thank you
    / Manuel

    #2
    Not sure I follow you. If you activate that line it will process, but it now requires you to have at least 20 daily bars before processing.
    Josh P.NinjaTrader Customer Service

    Comment


      #3
      Why 20 Days?

      I have now loaded 25 Days - Still same result. Only 1 Line in Output Window.

      Thank you

      Comment


        #4
        By default, min bars required is 20 for each series. You need at least 20 bars in each series before anything will calculate. 25 days may not be 20 bars since weekends are likely included in that data set. Please increase your start/end dates to get enough data loaded.
        Josh P.NinjaTrader Customer Service

        Comment


          #5
          Ok - it works now after loading 35 Days in History. Is it possible to reduce the min Bars?
          The Output shows data from 25.May until now. Still not really 35 Days but only 5.

          Thank you

          Comment


            #6
            When you start your strategy, there is a property called "Min bars required". Change that to what you want.
            Josh P.NinjaTrader Customer Service

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by cyberpete76, 03-27-2023, 12:29 AM
            7 responses
            267 views
            1 like
            Last Post slightly  
            Started by renewsaltwater, Today, 01:15 AM
            0 responses
            2 views
            0 likes
            Last Post renewsaltwater  
            Started by slightly, Today, 12:49 AM
            0 responses
            4 views
            0 likes
            Last Post slightly  
            Started by sdauteuil, 09-23-2021, 10:16 AM
            4 responses
            1,210 views
            0 likes
            Last Post jacobpescaia44  
            Started by agclub, 04-21-2024, 08:57 PM
            5 responses
            37 views
            0 likes
            Last Post agclub
            by agclub
             
            Working...
            X