Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Only getting one bar for ROC indicator on daily timeframe

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

    Only getting one bar for ROC indicator on daily timeframe

    Hi,
    I've put the standard ROC indicator (Period set to 1) that comes with Ninjatrader 8 on a daily chart.
    I only want to to do the calculation for the last 10 bars (with the Indicator property Calculate set to 'On price change').
    The problem is however Ninjatrader needs me to add 28 bars to display the indicator only for the last (current) bar. There is NO indicator value plotted for the previous 27 bars. If I want to display more bars with the indicator displayed Including the current daily bar), I need to add more bars on the chart..
    Does anyone know why this is?
    Thanks,
    iq

    #2
    Hello iq200,

    Thank you for the post.

    All indicators by default have 20 bars required to plot so that is likely part of what you are seeing. If you wanted to bypass that you could make a duplicate of the ROC indicator and then program into it BarsRequiredToPlot = 0; and that would allow the new indicator to plot immediately. This does not work with all indicators, in some cases they utilize the BarsRequiredToPlot or other parameters to prevent calculating before enough data is present.



    I look forward to being of further assistance.


    Comment


      #3
      Hi Jesse - Thanks for your reply. Is the default value of 20 documented anywhere?
      Regards,
      iq

      Comment


        #4
        Hello iq200,

        The default value is not documented but can be quickly observed by printing the value in State.DataLoaded. I have asked that a note for the default gets added in newer versions of the Help Guide.

        We look forward to assisting
        Last edited by NinjaTrader_Jim; 04-10-2020, 09:28 AM.

        Comment


          #5
          Jesse/Jim,
          Thank-you for your help.
          Regards,
          iq

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by Geovanny Suaza, 02-11-2026, 06:32 PM
          0 responses
          637 views
          0 likes
          Last Post Geovanny Suaza  
          Started by Geovanny Suaza, 02-11-2026, 05:51 PM
          0 responses
          366 views
          1 like
          Last Post Geovanny Suaza  
          Started by Mindset, 02-09-2026, 11:44 AM
          0 responses
          107 views
          0 likes
          Last Post Mindset
          by Mindset
           
          Started by Geovanny Suaza, 02-02-2026, 12:30 PM
          0 responses
          569 views
          1 like
          Last Post Geovanny Suaza  
          Started by RFrosty, 01-28-2026, 06:49 PM
          0 responses
          571 views
          1 like
          Last Post RFrosty
          by RFrosty
           
          Working...
          X