Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Issue with Strategy Analyzer

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

    Issue with Strategy Analyzer

    While trying to test my first strategy with the Strategy Analyzer, I discovered that the strategy doesn't kick in until 20 bars have passed, is this normal? I discovered this by putting Print(Close[0]); in the OnBarUpdate() function and looked at the output box. The first value that it printed out was the value of the bar 20 bars from the start of the graph.

    #2
    milemke,

    This would be the BarsRequired setting. You can set it to whatever you want but it defaults to 20.

    Adam P.NinjaTrader Customer Service

    Comment


      #3
      Adam P., you and I are becoming a team it seems here. By a team, I mean you are helping me on every issue I have. Thanks man.

      Comment


        #4
        milemike,

        Always happy to help where we can. Please feel free to contact us any time.
        Adam P.NinjaTrader Customer Service

        Comment


          #5
          Didn't take long, but I have another question:

          I want to set the bars required for my strategy in the Initialize() so I don't have to do it every time when I go to run it, but it won't take this.BarsRequired(5);. I looked through the API, but I couldn't find how to call the function

          Comment


            #6
            milemike,

            Its just :

            BarsRequired = 10;

            Its a integer value so you just assign some integer to it.

            In your code you can check for if ( CurrentBar < BarsRequired) return; for example.

            The main thing here is that you want to watch out for array index out of bounds issues.
            Adam P.NinjaTrader Customer Service

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by Geovanny Suaza, 02-11-2026, 06:32 PM
            0 responses
            666 views
            0 likes
            Last Post Geovanny Suaza  
            Started by Geovanny Suaza, 02-11-2026, 05:51 PM
            0 responses
            377 views
            1 like
            Last Post Geovanny Suaza  
            Started by Mindset, 02-09-2026, 11:44 AM
            0 responses
            110 views
            0 likes
            Last Post Mindset
            by Mindset
             
            Started by Geovanny Suaza, 02-02-2026, 12:30 PM
            0 responses
            575 views
            1 like
            Last Post Geovanny Suaza  
            Started by RFrosty, 01-28-2026, 06:49 PM
            0 responses
            580 views
            1 like
            Last Post RFrosty
            by RFrosty
             
            Working...
            X