• If this is your first visit, you will have to register before you can post. To view messages, please scroll below and select the forum that you would like to visits. Questions? Be sure to check out the Forum FAQ.

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?
    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:
        https://gyazo.com/c58e9ee05913d199c2e37d48847d737a

        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 quinton77, Yesterday, 09:59 PM
          1 response
          5 views
          0 likes
          Last Post NinjaTrader_EricB  
          Started by akuntysh, Today, 12:02 AM
          0 responses
          2 views
          0 likes
          Last Post akuntysh  
          Started by Revan, Yesterday, 11:53 PM
          0 responses
          3 views
          0 likes
          Last Post Revan
          by Revan
           
          Started by allangl, Yesterday, 10:50 PM
          0 responses
          7 views
          0 likes
          Last Post allangl
          by allangl
           
          Started by jeffm, Yesterday, 10:47 PM
          0 responses
          4 views
          0 likes
          Last Post jeffm
          by jeffm
           
          Working...
          X