Announcement

Collapse
No announcement yet.

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.
    BrettNinjaTrader Product Management

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