Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Is there a max value for Period in Add()?

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

    Is there a max value for Period in Add()?

    Hi,
    I'm adding additional time series to my ninjascript using the following line..

    Add(Instrument.FullName, PeriodType.Minute, 5, MarketDataType.Ask);

    When the period value is small, like 5 or 10, my script runs successfully in Backtest.
    However if I raise the period to be 1440 then my script does not run successfully. In backtest it finishes with no trades

    Is there a upper limit on the Period length when using Add() ?

    #2
    Hello,

    Thanks for your post.

    The fact that your strategy did not place any trades but was run without error would suggest the issue is more likely the strategy itself.

    To answer your question, you would be able to configure most practical sized bars using minute bars using Add.

    I don't know what instrument you are using but does using the "Ask" data of a daily bar make sense in the application?

    Comment


      #3
      Solved it myself. The "minimum bars required" appears to cover all added timeframes in a strategy and not just the timeframe of BarsInProgress==0. So I just needed to lower the "minimum bars required" to a value that is less that the number of available bars in the instrument, for the highest timeframe in the strategy.

      "Ask" is valid as it's a forex strategy.
      Also I did mention that the strategy worked with lower timeframes and with "Ask".

      Comment


        #4
        I am getting this error:


        Add(PeriodType.Minute, timeFrameOne);
        Add(PeriodType.Minute, timeFrameTwo);

        if (CurrentBars[0] <= BarsRequired || CurrentBars[1] <= BarsRequired || CurrentBars[2] <= BarsRequired)
        return;

        Is there anything else required for multi timeframe? I seem to run into this issue when adding more than 1 extra timeframe.

        Comment


          #5
          Hello brucelevy,

          Thanks for your post.

          What I recommend is that you add print statements to your code that will give you feedback (via the Tools>output window) as to where and when your code is producing the run time errors listed. Here is a link to debugging in Ninjatrader: http://ninjatrader.com/support/forum...ead.php?t=3418

          In addition, this section of the helpguide is the best reference for Multi time frame coding: http://ninjatrader.com/support/helpG...nstruments.htm

          Comment

          Latest Posts

          Collapse

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