Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Average True Range (ATR) - Tics vs Points

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

    Average True Range (ATR) - Tics vs Points

    Hello, ATR is a measure of market volatility and often used in target setting.
    Many traders use tics rather than points for setting targets, however the current ATR only shows points.
    Therefore, it would be useful to be able to choose between tics and points in the ATR indicator.
    Kind Regards
    Brett

    #2
    Welcome to the forums Brett73!

    ATR will read price values which are in Points.

    If you want to convert the value to Ticks, you can dive the ATR plot by TickSize. For example, the below will show the ATR value converted to Ticks.

    Print(ATR(14)[0] / TickSize);

    We look forward to assisting.

    Comment


      #3
      Hello, I'm using the ATR indicator to compare the range today vs. the average range. If today's range is close to the ATR, I will stop trading.
      When trading RTY or YM, no problem. The ATR chart indicates a whole number of ticks/units.
      When trading ZN or ZB, there's a problem. The ATR chart indicates a decimal value not a whole number.
      For example: ZB has 32 ticks to a point. Do I multiply the decimal times 32 to determine the ATR?
      I read the above instruction, but your assistance would be helpful. Thanks
      Last edited by steveg; 02-23-2022, 11:36 AM.

      Comment


        #4
        Hello steveg,

        ZB and ZN are displayed in 32nds. (Their TickSize is 0.3125)

        So if you have an ATR of 14 bars, and you divide that result by 0.3125 (aka, multiply by 32) this would convert the ATR unit from Points to Ticks.

        Comment


          #5
          Originally posted by NinjaTrader_Jim View Post
          Welcome to the forums Brett73!

          ATR will read price values which are in Points.

          If you want to convert the value to Ticks, you can dive the ATR plot by TickSize. For example, the below will show the ATR value converted to Ticks.

          Print(ATR(14)[0] / TickSize);

          We look forward to assisting.
          how can i do that? where can i put this string?

          thanks in advance.

          Comment


            #6
            Hello ummagumma,

            That is a Print which is a way to output information to the NinjaScript output window. If you wanted to print that value you can put that in your scripts OnBarUpdate method.

            Comment


              #7
              Originally posted by NinjaTrader_Jesse View Post
              Hello ummagumma,

              That is a Print which is a way to output information to the NinjaScript output window. If you wanted to print that value you can put that in your scripts OnBarUpdate method.
              Since I don't know how to code I still don't know how to do that.

              I need to put that in the code right?

              Is it possible to paste the entire code with this or just share in script format so I can just import it on ninja trader?

              Thanks in advance

              Comment


                #8
                Hello ummagumma,

                Yes that is NinjaScript code. This specifically would need to be manually added inside an Indicator or Strategy script.

                If you use the NinjaScript editor to make a new indicator or strategy you can leave the code that is generated and paste that line inside the OnBarUpdate method that is already in the script. That would look like:

                Code:
                protected override void OnBarUpdate()
                {
                    Print(ATR(14)[0] / TickSize);
                }
                You would need to compile the script using F5 and then open the Control center -> new -> Ninja Script output before you apply the script to a chart.
                Last edited by NinjaTrader_Jesse; 01-12-2024, 02:47 PM.

                Comment


                  #9
                  i am trying doing that:

                  1- opening ATR and copy the code
                  2- creating a new indicator em pasting the code

                  after press F5 to compile ai see a lot of message erros and cant go ahead.

                  Could you please give detailed steps to have this working? thanks in advance

                  Comment


                    #10
                    Hello ummagumma,

                    You do not need to copy the ATR code, you can leave that step out. The code you are asking about is calling the built in ATR indicator. You just need to make a new indicator and leave the code that is generated in the file with 0 changes. The only change you would make is to add that 1 line of code to the empty OnbarUpdate method which will make it look exactly like what I posted in post 8. The specific steps to do this are listed in post 8.

                    Comment


                      #11
                      ​what is wrong now? plus it is possible with just another one line make the indicator show the distance of the atr value from the price above and bellow the price?


                      Click image for larger version

Name:	image.png
Views:	1520
Size:	188.5 KB
ID:	1286590Click image for larger version

Name:	image.png
Views:	1561
Size:	30.8 KB
ID:	1286589

                      Comment


                        #12
                        Hello ummagumma,

                        As mentioned in post 6 that code is just to print out the value to the NinjaScript output window. That code is not for the intention of plotting a value. You would have to use AddPlot to plot a value if you wanted to visualize it.

                        Comment

                        Latest Posts

                        Collapse

                        Topics Statistics Last Post
                        Started by Geovanny Suaza, 02-11-2026, 06:32 PM
                        0 responses
                        560 views
                        0 likes
                        Last Post Geovanny Suaza  
                        Started by Geovanny Suaza, 02-11-2026, 05:51 PM
                        0 responses
                        325 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
                        547 views
                        1 like
                        Last Post Geovanny Suaza  
                        Started by RFrosty, 01-28-2026, 06:49 PM
                        0 responses
                        547 views
                        1 like
                        Last Post RFrosty
                        by RFrosty
                         
                        Working...
                        X