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

Min Bars Required to Plot a Series

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

    Min Bars Required to Plot a Series

    Hi,

    So I am building my custom indicator code and wondering why it is not plotting. I start experimenting with some basic series when I notice the following: A 2 bar EMA on a chart does not begin to plot until bar 20. This is on CL 5 min futures bar chart. Can anyone please illuminate me why it takes 20 bars before a 2 bar EMA starts to plot? Thank you.

    #2
    Hello,

    Thanks for the note.

    This has to do with the bars required setting.which is defaulted to 20 in NinjaTrader. As you will get an error if you try to reference a bar back that you dont have data for.



    and also, http://www.ninjatrader.com/support/f...ead.php?t=3229

    Let me know if I can be of further assistance.

    Comment


      #3
      Hi Brett,

      How do I change the setting?
      Also, will this same setting apply to any custom series I create and plot?

      Comment


        #4
        I figured out the BarsRequired. It is set in the Initialize(). Thanks Brett. However, how do I set it for your precoded series like EMA? I don't want to create my own EMA code.
        Last edited by Zeos6; 06-13-2011, 02:34 PM.

        Comment


          #5
          Originally posted by Zeos6 View Post
          I figured out the BarsRequired. It is set in the Initialize(). Thanks Brett. However, how do I set it for your precoded series like EMA? I don't want to create my own EMA code.
          Any suggestions on how I can set my own BarsRequired value for precoded series like EMA? Or, do I have to build my own versions? Thanks.

          Comment


            #6
            Hi Zeos,

            You can save a copy of the system EMA if you want to set a different BarsRequired value. Right click in editor > Save As.

            You can also use CurrentBar to only allows calculations after a certain number of bars have passed.

            if (CurrentBar > 50) //do your EMA calcs here.
            Ryan M.NinjaTrader Customer Service

            Comment


              #7
              Thanks Ryan. It seems a lot of needless effort to duplicate a system EMA just to have it plot earlier than the 20 bar default. I get the calculated values earlier. This was just a cosmetic thing for me. I simply wanted to know if there was a way to reset the default BarsRequired value for system moving avrages, and the answer is no - you have to create your own veersion. Thanks for letting me know.

              Comment

              Latest Posts

              Collapse

              Topics Statistics Last Post
              Started by wzgy0920, 04-20-2024, 06:09 PM
              2 responses
              26 views
              0 likes
              Last Post wzgy0920  
              Started by wzgy0920, 02-22-2024, 01:11 AM
              5 responses
              32 views
              0 likes
              Last Post wzgy0920  
              Started by wzgy0920, 04-23-2024, 09:53 PM
              2 responses
              49 views
              0 likes
              Last Post wzgy0920  
              Started by Kensonprib, 04-28-2021, 10:11 AM
              5 responses
              193 views
              0 likes
              Last Post Hasadafa  
              Started by GussJ, 03-04-2020, 03:11 PM
              11 responses
              3,235 views
              0 likes
              Last Post xiinteractive  
              Working...
              X