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 CarlTrading, 03-31-2026, 09:41 PM
            1 response
            68 views
            0 likes
            Last Post NinjaTrader_ChelseaB  
            Started by CarlTrading, 04-01-2026, 02:41 AM
            0 responses
            36 views
            0 likes
            Last Post CarlTrading  
            Started by CaptainJack, 03-31-2026, 11:44 PM
            0 responses
            61 views
            1 like
            Last Post CaptainJack  
            Started by CarlTrading, 03-30-2026, 11:51 AM
            0 responses
            62 views
            0 likes
            Last Post CarlTrading  
            Started by CarlTrading, 03-30-2026, 11:48 AM
            0 responses
            53 views
            0 likes
            Last Post CarlTrading  
            Working...
            X