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

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?
    Paul H.NinjaTrader Customer Service

    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
          Paul H.NinjaTrader Customer Service

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by usazencort, Today, 01:16 AM
          0 responses
          1 view
          0 likes
          Last Post usazencort  
          Started by kaywai, 09-01-2023, 08:44 PM
          5 responses
          603 views
          0 likes
          Last Post NinjaTrader_Jason  
          Started by xiinteractive, 04-09-2024, 08:08 AM
          6 responses
          22 views
          0 likes
          Last Post xiinteractive  
          Started by Pattontje, Yesterday, 02:10 PM
          2 responses
          21 views
          0 likes
          Last Post Pattontje  
          Started by flybuzz, 04-21-2024, 04:07 PM
          17 responses
          230 views
          0 likes
          Last Post TradingLoss  
          Working...
          X