• If this is your first visit, you will have to register before you can post. To view messages, please scroll below and select the forum that you would like to visits. Questions? Be sure to check out the Forum FAQ.

Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Moving Average that resets every day

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

    Moving Average that resets every day

    Hello is there moving average indicator, which calculation begins from every new day start?

    #2
    Hello Brcln9301,

    Thanks for your post and welcome to the NinjaTrader forums.

    If you haven't already you may want to look through the file sharing section to see if there is anything that will meet your needs or for future reference: http://www.ninjatrader.com/support/f...1&pp=15&page=2

    I am not aware of an indicator that starts at 0 on each trading day however if you are interested in creating one in Ninjascript I would be glad to get you started.

    Please let me know if I can be of further assistance.
    Paul H.NinjaTrader Customer Service

    Comment


      #3
      Originally posted by Brcln9301 View Post
      Hello is there moving average indicator, which calculation begins from every new day start?
      I would imagine that you'd like to do this because of the gaps that often occur between the close of one day and the open of the next.

      One of the problems you'll face is that if, for example, you were to do this and you were using a 14 Period Simple Moving Average*, then your average wouldn't be fully precise until 14 bars have been printed, and that could be a time when you'd like to do some trading.

      Another idea (and I think there's something proprietary which does this) is to adjust yesterday's close to the same level as today's open. This shouldn't be too difficult to do in code but would maybe be a job for more advanced coders.

      Best of luck with your trading!

      * Remember: there are many different moving averages to choose from.
      Last edited by arbuthnot; 01-13-2015, 03:58 PM.

      Comment


        #4
        The concept really depends on the moving average that you wish to select.

        For example for a SMA(n), I would prefer a version that

        - calculates a SMA(1) for the opening bar
        - calculates a SMA(2) for the next bar
        .....
        - calculates a SMA(n) for the nth bar
        - then continues to calculate a SMA(n)

        This version would be better than a gapless SMA, as the gapless SMA suffers from the impact of bars dropping out from the prior trading day.

        However, for an EMA(n), I would eventually prefer a gapless EMA. The EMA does not suffer from dropouts, and the fact using a gapless EMA attaches it to the opening price of the first bar of the session. This gets you a less nervous indicator for the first n bars.

        Both types of indicator can be easily coded, but need to take into account session breaks.

        Comment


          #5
          For example for a SMA(n), I would prefer a version that

          - calculates a SMA(1) for the opening bar
          - calculates a SMA(2) for the next bar
          .....
          - calculates a SMA(n) for the nth bar
          - then continues to calculate a SMA(n)
          Thanks, as always, Harry, for your ideas.

          I remember that, years ago, I did actually try the precise idea you describe as quoted. (In Excel, not Ninja, though.) However, let's say your normal SMA parameter is 14, the quality of of the SMA until you get to or near the 14th bar will be seriously inadequate and so probably unusable for the first 10 bars, say.

          Very good ideas, Harry, about a gapless EMA. Cheers.
          Last edited by arbuthnot; 01-15-2015, 07:40 AM.

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by gngmpwdws, Today, 09:58 PM
          0 responses
          2 views
          0 likes
          Last Post gngmpwdws  
          Started by darkgreen, Today, 03:35 PM
          1 response
          14 views
          0 likes
          Last Post lmatiukas  
          Started by imalil, Today, 09:46 PM
          1 response
          7 views
          0 likes
          Last Post Epistemophilic  
          Started by SAITON, Today, 09:03 PM
          0 responses
          6 views
          0 likes
          Last Post SAITON
          by SAITON
           
          Started by suprsnipes, Today, 08:26 PM
          0 responses
          5 views
          0 likes
          Last Post suprsnipes  
          Working...
          X