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 - calculate the ATR ticks for the last 7 days

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

    ATR - calculate the ATR ticks for the last 7 days

    I wish to calculat the Avearge - ATR for the last 7 days from inside a strategy.

    it is mulitframe, the primary bars are intraday - 89 tick

    so i would:
    Add(PeriodType.Minute,
    60);

    Then i want to get the average value for the ATR for the last 7 days -

    convet it into ticks and use it to set my targets dynamically...


    #2
    This can be done through custom programming. There are several threads discussing using ATR for trailing stops and things like that. Please take a look at them and see if they help you.
    Josh P.NinjaTrader Customer Service

    Comment


      #3
      I have had a look at quite a few and inspected the code -and drew a blank - as they are mostly indicators and the such like - all i want is a pattern/ method to obtain the ATR for the last 7 days... as a tick value.
      I will keep looking

      Comment


        #4
        Not sure what you mean "tick value". ATR will come out as some range value as determined by the high - low calculation for the various days.
        Josh P.NinjaTrader Customer Service

        Comment


          #5
          essentially i wish to get the number of ticks an instrument moves per day - using the last 7 days as the period - but calculate it from a intraday period (so it can achieved in a intrady stratefy)...
          Eg.
          last 7 day ES was 20 points per day or 80 ticks

          i can use the 80 ticks as the basic tradeable oppurtunity.
          i thought ATR migh assist in this - maybe i need to look at another pattern
          Last edited by tomleeson; 07-21-2009, 03:20 PM.

          Comment


            #6
            i found this:
            http://www.ninjatrader-support2.com/...e+Range&page=2

            somevalue= (ATR(
            14)[1] * 0.25) * 100);
            i believe the * 100 is there to convert it to to a number versus degrees?
            what is the 0.25 (ticks?)

            Comment


              #7
              Tom, what you outlined in your first post would work, but the larger timeframe must be the primary instrument.
              AustinNinjaTrader Customer Service

              Comment


                #8
                Originally posted by tomleeson View Post

                somevalue= (ATR(
                14)[1] * 0.25) * 100);
                i believe the * 100 is there to convert it to to a number versus degrees?
                what is the 0.25 (ticks?)
                Not sure what the * 100 and the *0.25 mean... If I remember my basic math properties, multiplication is associative so (ATR(14) * 0.25) * 100 = ATR(14) * 25.

                In addition, there is a helpful function in NinjaTrader that rounds a value to the nearest tick size. Here is the reference page for Round2TickSize.
                AustinNinjaTrader Customer Service

                Comment


                  #9
                  Thanks for your replies:

                  The smaller time has to be the primary.
                  The system has been tested with a weekly atr average value.
                  NT strategy wotn allow me to mix intrady series with weekly series - so i guess i will have to count evrery bar and take an average for each 7 day period.. or create it on another chart and then commuicate this to the running strategy module..:-) through a common static class, a data cache, or maybe even post via a windowsmessage...:-)

                  Comment


                    #10
                    tomlesson,

                    NT for sure does allow you to mix intraday with weekly. You just need to ensure you reach the min. bars required requirement on all bar series. By default this means you need 20 bars which would be a lot of time to achieve 20 weekly bars.
                    Josh P.NinjaTrader Customer Service

                    Comment


                      #11
                      Tom, I wasn't sure of your programming skills, so I didn't suggest anything too complicated from the start.

                      You can try this: run your ATR calculations from a daily chart, and then have your strategy communicate with that daily chart to retrieve the values. Here is a reference sample that demonstrates how to expose indicator values. The sample includes a strategy and an indicator--they work together and are a great example.
                      AustinNinjaTrader Customer Service

                      Comment


                        #12
                        Originally posted by NinjaTrader_Josh View Post
                        tomlesson,

                        NT for sure does allow you to mix intraday with weekly. You just need to ensure you reach the min. bars required requirement on all bar series. By default this means you need 20 bars which would be a lot of time to achieve 20 weekly bars.
                        yes i think i can see how that would work :-)

                        Comment


                          #13
                          Originally posted by NinjaTrader_Austin View Post
                          Tom, I wasn't sure of your programming skills, so I didn't suggest anything too complicated from the start.

                          You can try this: run your ATR calculations from a daily chart, and then have your strategy communicate with that daily chart to retrieve the values. Here is a reference sample that demonstrates how to expose indicator values. The sample includes a strategy and an indicator--they work together and are a great example.
                          I am checking this out.
                          thank you!

                          Comment


                            #14
                            Originally posted by NinjaTrader_Josh View Post
                            tomlesson,

                            NT for sure does allow you to mix intraday with weekly. You just need to ensure you reach the min. bars required requirement on all bar series. By default this means you need 20 bars which would be a lot of time to achieve 20 weekly bars.
                            the default of 20 - can i change that programmatically? is that set when the strategy is added to a chart?

                            Comment


                              #15
                              BarsRequired = 20;

                              It can also be set via the UI when you add a strategy.
                              Josh P.NinjaTrader Customer Service

                              Comment

                              Latest Posts

                              Collapse

                              Topics Statistics Last Post
                              Started by cls71, Today, 04:45 AM
                              0 responses
                              1 view
                              0 likes
                              Last Post cls71
                              by cls71
                               
                              Started by mjairg, 07-20-2023, 11:57 PM
                              3 responses
                              213 views
                              1 like
                              Last Post PaulMohn  
                              Started by TheWhiteDragon, 01-21-2019, 12:44 PM
                              4 responses
                              544 views
                              0 likes
                              Last Post PaulMohn  
                              Started by GLFX005, Today, 03:23 AM
                              0 responses
                              3 views
                              0 likes
                              Last Post GLFX005
                              by GLFX005
                               
                              Started by XXtrader, Yesterday, 11:30 PM
                              2 responses
                              12 views
                              0 likes
                              Last Post XXtrader  
                              Working...
                              X