Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Moving Average Plots

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

    Moving Average Plots

    Hi,

    I noticed that the NT moving averages begin to plot on the charts after 20 bars. Is there any way to change this. Yes, I know about BarsRequired but this only works on custom coded indicators. I really do not want to recode what is already in place.

    Thank you.

    #2
    Hello Zeos6,

    Thanks for your post.

    Unfortunately there is no user available setting that can be adjusted to change that, without coding.

    Comment


      #3
      Thanks Paul. I guess I will have to replicate what you already have there. It would be nice to allow us to change this behavior so we don't have to replicate the work aleady done.

      Comment


        #4
        Originally posted by Zeos6 View Post
        Thanks Paul. I guess I will have to replicate what you already have there. It would be nice to allow us to change this behavior so we don't have to replicate the work aleady done.
        That's a very interesting question, Zeos6. I'd never noticed that before.

        The restriction isn't in the coding of the NT7 in-built indicators as there's no mention 20 bars are required. (I've just checked SMA and WMA.)

        Paul - is it the case that there's something deeper within NT7 that stops an indicator plotting before bar 20? If so, the coding required to get round this would be very advanced indeed, I would imagine.

        Thanks.

        Comment


          #5
          Originally posted by arbuthnot View Post
          That's a very interesting question, Zeos6. I'd never noticed that before.

          The restriction isn't in the coding of the NT7 in-built indicators as there's no mention 20 bars are required. (I've just checked SMA and WMA.)

          Paul - is it the case that there's something deeper within NT7 that stops an indicator plotting before bar 20? If so, the coding required to get round this would be very advanced indeed, I would imagine.

          Thanks.
          It is a built-in default, so there is no need to code it. It can be overridden very simply.
          Code:
          BarsRequired = 1;
          will start the Plot from the very first bar if you so want.

          The parameter is documented.

          ref: http://www.ninjatrader.com/support/h...rsrequired.htm

          Comment


            #6
            Originally posted by koganam View Post
            It is a built-in default, so there is no need to code it. It can be overridden very simply.
            Code:
            BarsRequired = 1;
            will start the Plot from the very first bar if you so want.

            The parameter is documented.

            ref: http://www.ninjatrader.com/support/h...rsrequired.htm
            http://www.ninjatrader.com/support/h...srequired2.htm
            Thanks very much as always, Koganam.

            It really is that simple - I imagined wrong!

            Comment


              #7
              Hello arbuthnot,

              Thanks for your post. As koganam advised is it simply the BarsRequired. Zeos6 was, in my view, looking for an external way to change the BarsRequired such as UI setting.

              Comment


                #8
                Please be advised that the first values on your chart plotted via a moving average are simply nonsense and cannot be used for any trade decisions or backtests.

                For example if you use a SMA(34), it will only plot correct values starting with bar 35. You could therefore enter a line

                Code:
                BarsRequired = period;
                in the Initialize section, which will make sure that no nonsense plots are generated.

                If you apply an EMA(34) to your chart, things are getting more complex. Typically the training period of an EMA is much longer than the training period of a comparable SMA. This is because it is an infinite impulse response (IIR) filter, for which the current value depends on an infinite number of prior bars.

                For practical purposes the EMA(34) will be fairly accurate after 3 x 34 = 102 bars. Therefore for the EMA you could add a line

                Code:
                BarsRequired = 3*period;
                I have never understood that default value of 20 for all indicators. It does not make a lot of sense, and if indicators were coded in a proper way, the plots would only be shown, once the results are reliable.

                I would not set the parameter BarsRequired to 0, just for the good looks of my chart. Maybe if you trade for entertainment and not for profits, this is the way to go.
                Last edited by Harry; 03-13-2015, 04:43 AM.

                Comment


                  #9
                  Wow, so much discussion about a very simple thing. Thank you all for your input.

                  First, Paul, no you are not correct. I was NOT looking for an external way to change the setting.

                  Of course Harry is correct in what he states, regarding the validity of the average after a proper number (based on the period of the average) of bars have passed. This also was not the question asked. The question simply was how to plot a built-in NT average (even if not accurate) starting on a bar earlier than bar 20.

                  If you read my post, I state that I am aware of BarsRequired. Yes, BarsRequired works BUT only on plots added via Add() in the Initialize() method. BarsRequired DOES NOT work with the built in indicators that are not added in the Initialize(). I have tested it this morning again. The question was whether it is possible to plot built-in indicators NOT added via Add() in the Initialize() method prior to bar 20. It does not appear possible. The question whether the average makes sense is of course valid but it is not the point of this question.

                  Comment

                  Latest Posts

                  Collapse

                  Topics Statistics Last Post
                  Started by Geovanny Suaza, 02-11-2026, 06:32 PM
                  0 responses
                  578 views
                  0 likes
                  Last Post Geovanny Suaza  
                  Started by Geovanny Suaza, 02-11-2026, 05:51 PM
                  0 responses
                  334 views
                  1 like
                  Last Post Geovanny Suaza  
                  Started by Mindset, 02-09-2026, 11:44 AM
                  0 responses
                  101 views
                  0 likes
                  Last Post Mindset
                  by Mindset
                   
                  Started by Geovanny Suaza, 02-02-2026, 12:30 PM
                  0 responses
                  553 views
                  1 like
                  Last Post Geovanny Suaza  
                  Started by RFrosty, 01-28-2026, 06:49 PM
                  0 responses
                  551 views
                  1 like
                  Last Post RFrosty
                  by RFrosty
                   
                  Working...
                  X