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 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