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

ATR(MA) Progamming

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

    ATR(MA) Progamming

    Hi,

    I am plotting an MA of ATR in a sub-window, but the canned ATR can only do i think the SMA of an MA. I want to make the MA exponential. Any help on how to code that, should be fairly simple, but I'm pretty new. Thanks!

    #2
    Hi,

    You want the MA of the ATR to be EMA? Or you would like the ATR to be calculated exponentially?
    MatthewNinjaTrader Product Management

    Comment


      #3
      Originally posted by NinjaTrader_Matthew View Post
      Hi,

      You want the MA of the ATR to be EMA? Or you would like the ATR to be calculated exponentially?
      The MA, which is the only way right? So, say ATR(5)...I want the 5MA to be exponentially.

      Comment


        #4
        The ATR itself is an exponential average... meaning the actual smoothing period used for the ATR will be calculated exponentially.

        Do you perhaps have an external reference we can look at to compare what you're trying to accomplish?
        MatthewNinjaTrader Product Management

        Comment


          #5
          Originally posted by NinjaTrader_Matthew View Post
          The ATR itself is an exponential average... meaning the actual smoothing period used for the ATR will be calculated exponentially.

          Do you perhaps have an external reference we can look at to compare what you're trying to accomplish?
          I am trying to bring over my template from Ensign to Ninja. In Ensign, you can choose your MA to be simple, exponential, weighted, etc of the ATR. In comparing my ATR(100) in Enisgn which is exponential to Ninja ATR(100), they are slightly off. I asked about this awhile back and was told the built in MA in Ninja is a simple moving average of the ATR and I would need to custom program it. I am coming back around to try this again. I can show screenshots of my Ensign chart and properties.

          Also, from what I understand of ATR, if you do ATR(5), is returns the average true range for the last 5 days. Which should just be a simple average. Just looking to make the average exponential. In Tradestation it also lets you customized the MA of the ATR. Thanks for all your help!

          Comment


            #6
            Thinking about it, yes, I want an exponential moving average of the ATR (which is already exponentially calculated). Sorry for the confusing.

            Comment


              #7
              Originally posted by Stok View Post
              Thinking about it, yes, I want an exponential moving average of the ATR (which is already exponentially calculated). Sorry for the confusing.
              Do you also want to see the ATR itself, or only the EMA of the ATR?

              Comment


                #8
                In additional to koganam's question, do you perhaps have a screen shot of your Ensign chart/template?

                If possible, please include a daily period of any of your favorite instruments, and I'll be happy to help determine if this is something we can accommodate.
                MatthewNinjaTrader Product Management

                Comment


                  #9
                  The average true range was developed by Welles Wilder. The formula uses a variation of the exponential moving average known as Wilder's average. While a modern EMA uses a smoothing constant of 2/(n+1), Wilder used a smoothing constant of 1/n, where n is the lookback period of the indicator.

                  NinjaTrader uses Wilder's original formula and neither a simple moving average nor a standard exponential moving average.

                  According to the documentation Ensign uses an exponential moving average of the true range. It is unclear, whether they use the smoothing constant 2/(n+1) or 1/n to calculate the ATR.

                  Technically it is possible to calculate an average true range or simple range by using any type of moving average.

                  If you want to transfer your template from Ensign to NinjaTrader, you would need to show us

                  -> a daily chart of one of the DJIA stocks with the ATR applied
                  -> the indicator code of the ATR, so we can check how it is calculated
                  Last edited by Harry; 01-07-2014, 06:48 PM.

                  Comment


                    #10
                    Thanks for all the reply's and help.

                    I uploaded a chart and then just the setting for ATR in Ensign (Ensign does not provide the source code, just asked). While I plot the ATR(100) at the bottom, I close that and you can see in the upper left, I have the ATR there (I use ATR for profit/loss targets is all, not as an indicator). And it all may be a moot point because the ATR readings are slightly off, but I have been using them in my trading for 4 years, so would really like to recreate it exactly in NT.

                    Also, as you can see in the chart, I use what looks like zigzag but it's pesavento patterns. I have been able to recreate it with zigzag in NT, but would need some customization on a few tweaks. Recommendations on someone I could hire or help? Would be a minor project.
                    Attached Files

                    Comment


                      #11
                      Originally posted by Stok View Post
                      Thanks for all the reply's and help.

                      I uploaded a chart and then just the setting for ATR in Ensign (Ensign does not provide the source code, just asked). While I plot the ATR(100) at the bottom, I close that and you can see in the upper left, I have the ATR there (I use ATR for profit/loss targets is all, not as an indicator). And it all may be a moot point because the ATR readings are slightly off, but I have been using them in my trading for 4 years, so would really like to recreate it exactly in NT.

                      Also, as you can see in the chart, I use what looks like zigzag but it's pesavento patterns. I have been able to recreate it with zigzag in NT, but would need some customization on a few tweaks. Recommendations on someone I could hire or help? Would be a minor project.
                      We cannot check the ATR, if you don't display it on your chart. Just one value in the upper left corner is not enough, but it is necessary to plot the ATR over the entire chart in a separate indicator panel.

                      And if possible, do NOT use a FOREX chart. FOREX data comes from different electronic networks, and the FOREX feed that you used for Ensign will likely not match the FOREX feed that we can use to check your chart. Even worse, daily FOREX bars depend on the cutoff time. Some FOREX providers use 5:00 PM EST, others use midnight GMT.

                      Please show us a daily chart - or a 60 min chart - from a centralized exchange aloowing us to apply the ATR to the same data as you did. And make sure that you have added the ATR indicator to your chart.

                      We cannot help you, if you do not provide the necessary information.

                      Comment


                        #12
                        For the Pesavento patterns, also have a look at the PriceActionSwing indicator:

                        The best futures trading community on the planet: futures trading, market news, trading charts, trading platforms, trading strategies

                        Comment


                          #13
                          Originally posted by Harry View Post
                          We cannot check the ATR, if you don't display it on your chart. Just one value in the upper left corner is not enough, but it is necessary to plot the ATR over the entire chart in a separate indicator panel.

                          And if possible, do NOT use a FOREX chart. FOREX data comes from different electronic networks, and the FOREX feed that you used for Ensign will likely not match the FOREX feed that we can use to check your chart. Even worse, daily FOREX bars depend on the cutoff time. Some FOREX providers use 5:00 PM EST, others use midnight GMT.

                          Please show us a daily chart - or a 60 min chart - from a centralized exchange aloowing us to apply the ATR to the same data as you did. And make sure that you have added the ATR indicator to your chart.

                          We cannot help you, if you do not provide the necessary information.
                          I attached a chart and plotted the ATR at the bottom. Since it is a 100EMA, it will be smooth like that. If I plot it in a sub-window, it hardly shows.
                          Attached Files

                          Comment


                            #14
                            Originally posted by Stok View Post
                            I attached a chart and plotted the ATR at the bottom. Since it is a 100EMA, it will be smooth like that. If I plot it in a sub-window, it hardly shows.
                            Continuous contracts like the one that you used are built in a different way by different data providers. They depend on method and rollover date / offset selected. It would be better to select a single month contract.

                            The ATR does not show any values on the chart, so it cannot be compared to anything. We do not need a period of 100 to compare, why can't we start with a simple case

                            -> a daily chart of a stock or a futures contract with the ATR(14) added on a separate channel, maybe with a data box attached, so that we can see the price values and indicator values for the current day
                            -> 60 min chart with the ATR(14) added on a separate panel

                            With your chart nothing can be compared! It is important to see the indicator shape, that is highs and lows and the indicator values! No need to add any other indicators, just a virgin chart and the ATR(14)!

                            Comment


                              #15
                              Originally posted by Harry View Post
                              We cannot check the ATR, if you don't display it on your chart. Just one value in the upper left corner is not enough, but it is necessary to plot the ATR over the entire chart in a separate indicator panel.

                              And if possible, do NOT use a FOREX chart. FOREX data comes from different electronic networks, and the FOREX feed that you used for Ensign will likely not match the FOREX feed that we can use to check your chart. Even worse, daily FOREX bars depend on the cutoff time. Some FOREX providers use 5:00 PM EST, others use midnight GMT.

                              Please show us a daily chart - or a 60 min chart - from a centralized exchange aloowing us to apply the ATR to the same data as you did. And make sure that you have added the ATR indicator to your chart.

                              We cannot help you, if you do not provide the necessary information.
                              OK, here is ES H4. The bottom cyan is the daily ATR and the read line is the 14EMA. This only updates EOD, so in the data panel to the upper left the red number is ATR(14) as of yesterday. I can plot the ATR(14)SMA on top as well to see the differences if need be. Thanks for your help!
                              Attached Files

                              Comment

                              Latest Posts

                              Collapse

                              Topics Statistics Last Post
                              Started by PaulMohn, Today, 05:00 AM
                              0 responses
                              6 views
                              0 likes
                              Last Post PaulMohn  
                              Started by ZenCortexAuCost, Today, 04:24 AM
                              0 responses
                              5 views
                              0 likes
                              Last Post ZenCortexAuCost  
                              Started by ZenCortexAuCost, Today, 04:22 AM
                              0 responses
                              2 views
                              0 likes
                              Last Post ZenCortexAuCost  
                              Started by SantoshXX, Today, 03:09 AM
                              0 responses
                              16 views
                              0 likes
                              Last Post SantoshXX  
                              Started by DanielTynera, Today, 01:14 AM
                              0 responses
                              3 views
                              0 likes
                              Last Post DanielTynera  
                              Working...
                              X