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 junkone, Today, 11:37 AM
          2 responses
          14 views
          0 likes
          Last Post junkone
          by junkone
           
          Started by frankthearm, Yesterday, 09:08 AM
          12 responses
          44 views
          0 likes
          Last Post NinjaTrader_Clayton  
          Started by quantismo, 04-17-2024, 05:13 PM
          5 responses
          35 views
          0 likes
          Last Post NinjaTrader_Gaby  
          Started by proptrade13, Today, 11:06 AM
          1 response
          7 views
          0 likes
          Last Post NinjaTrader_Clayton  
          Started by love2code2trade, 04-17-2024, 01:45 PM
          4 responses
          35 views
          0 likes
          Last Post love2code2trade  
          Working...
          X