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

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 CortexZenUSA, Today, 12:53 AM
          0 responses
          1 view
          0 likes
          Last Post CortexZenUSA  
          Started by CortexZenUSA, Today, 12:46 AM
          0 responses
          1 view
          0 likes
          Last Post CortexZenUSA  
          Started by usazencortex, Today, 12:43 AM
          0 responses
          5 views
          0 likes
          Last Post usazencortex  
          Started by sidlercom80, 10-28-2023, 08:49 AM
          168 responses
          2,265 views
          0 likes
          Last Post sidlercom80  
          Started by Barry Milan, Yesterday, 10:35 PM
          3 responses
          12 views
          0 likes
          Last Post NinjaTrader_Manfred  
          Working...
          X