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

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.
    JimNinjaTrader Customer Service

    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.
        JimNinjaTrader Customer Service

        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.
            JesseNinjaTrader Customer Service

            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.
                JesseNinjaTrader Customer Service

                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.
                    JesseNinjaTrader Customer Service

                    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:	241
Size:	188.5 KB
ID:	1286590Click image for larger version

Name:	image.png
Views:	254
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.

                        JesseNinjaTrader Customer Service

                        Comment

                        Latest Posts

                        Collapse

                        Topics Statistics Last Post
                        Started by Haiasi, 04-25-2024, 06:53 PM
                        2 responses
                        17 views
                        0 likes
                        Last Post Massinisa  
                        Started by Creamers, Today, 05:32 AM
                        0 responses
                        5 views
                        0 likes
                        Last Post Creamers  
                        Started by Segwin, 05-07-2018, 02:15 PM
                        12 responses
                        1,786 views
                        0 likes
                        Last Post Leafcutter  
                        Started by poplagelu, Today, 05:00 AM
                        0 responses
                        3 views
                        0 likes
                        Last Post poplagelu  
                        Started by fx.practic, 10-15-2013, 12:53 AM
                        5 responses
                        5,408 views
                        0 likes
                        Last Post Bidder
                        by Bidder
                         
                        Working...
                        X