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

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.


    JesseNinjaTrader Customer Service

    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.
        JimNinjaTrader Customer Service

        Comment


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

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by r68cervera, Today, 05:29 AM
          0 responses
          3 views
          0 likes
          Last Post r68cervera  
          Started by geddyisodin, Today, 05:20 AM
          0 responses
          6 views
          0 likes
          Last Post geddyisodin  
          Started by JonesJoker, 04-22-2024, 12:23 PM
          6 responses
          35 views
          0 likes
          Last Post JonesJoker  
          Started by GussJ, 03-04-2020, 03:11 PM
          12 responses
          3,241 views
          0 likes
          Last Post Leafcutter  
          Started by AveryFlynn, Today, 04:57 AM
          0 responses
          7 views
          0 likes
          Last Post AveryFlynn  
          Working...
          X