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

Access daily ATR from intraday chart

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

    Access daily ATR from intraday chart

    Hello,

    Is there a way to access daily ATR (prior day's ATR) from 15 or 5 minute chart? Or is it possible through an indicator? Thank you.

    SR

    #2
    Multi-time framed indicators are currently unavailable. What you could do in this instance is recreate the ATR calculations through another indicator and use the values from PriorDayOHLC() to give the values needed to run those ATR calculations. That way you can have prior day ATR on your intraday charts.

    Josh P.NinjaTrader Customer Service

    Comment


      #3
      Hi Josh,

      Thank you.

      SR

      Comment


        #4
        So what does it return?

        So what does it return when an indicator is being used in a multi time frame strategy? For example, is the multi time frame code below comparing the ATR of the last 10 15-min bars if UI data is set to 15 min.

        if(BarsInProgress == 0
        && ATR(10)[0] <= 6)
        Do something;


        Thank you.

        Originally posted by NinjaTrader_Josh View Post
        Multi-time framed indicators are currently unavailable. What you could do in this instance is recreate the ATR calculations through another indicator and use the values from PriorDayOHLC() to give the values needed to run those ATR calculations. That way you can have prior day ATR on your intraday charts.

        http://www.ninjatrader-support.com/H...orDayOHLC.html

        Comment


          #5
          If you are using multi-time frames you should be using the BarsArray[] index to determine that.

          ATR(BarsArray[0], 10)[0]
          Josh P.NinjaTrader Customer Service

          Comment


            #6
            Sorry.
            I should have checked the time stamp on the original posters post and your response to it. There have been many new builds since then.

            FYI - the help page for "ATR" doesn't indicate it's use for multi time frame strategies which probably led to some of my confusion too.

            Comment


              #7
              8DTK8,

              The information on using indicators inside a multi-time frame strategy is available here: http://www.ninjatrader-support.com/H...struments.html

              It applies to all indicators.
              Josh P.NinjaTrader Customer Service

              Comment


                #8
                Thank you for the link. I had visited it in the past and forgot about it. One thing that I'm stuck on is the following part of that page.

                What is important to understand in the above sample code is that we have "if" branches that check to see what Bars object is calling the OnBarUpdate() method in order to process relevant trading logic. If we only wanted to process the events from the primary Bars we could write our first statement as follows:


                if (BarsInProgress != 0)
                return;


                What is also important to understand is the concept of context. When the OnBarUpdate() method is called, it will be called within the context of the calling Bars object. This means that if the primary Bars triggers the OnBarUpdate() method, all indicator methods and price data will point to that Bars object's data. Looking at the above example, see how the statement "if (Close[0] > Open[0]" exists under each "if" branch? The values returned by Close[0] and Open[0] will be the close and open price values for the calling Bars object. So when the BarsInProgress == 0 (primary Bars) the close value returned is the close price of the MSFT 1 minute bar. When the BarsInProgress == 1 the close value returned is the close price of the MSFT 3 minute Bars object.

                Am I understanding correctly that even if I add another time frame in the Initialize() section of an existing single time frame strategy and the very first condition in the Initialize() section is if (BarsInProgress != 0)
                return; then the backtest should yield the same results as before I added them?

                That's how I interpreted it, but the results speak otherwise.

                Thanks again.


                Originally posted by NinjaTrader_Josh View Post
                8DTK8,

                The information on using indicators inside a multi-time frame strategy is available here: http://www.ninjatrader-support.com/H...struments.html

                It applies to all indicators.

                Comment


                  #9
                  It really depends on the strategy as a whole. You cannot isolate out the overall behavior just to that, but generally speaking having that if-statement should yield the same results.
                  Josh P.NinjaTrader Customer Service

                  Comment

                  Latest Posts

                  Collapse

                  Topics Statistics Last Post
                  Started by Rapine Heihei, 04-23-2024, 07:51 PM
                  2 responses
                  30 views
                  0 likes
                  Last Post Max238
                  by Max238
                   
                  Started by Shansen, 08-30-2019, 10:18 PM
                  24 responses
                  943 views
                  0 likes
                  Last Post spwizard  
                  Started by Max238, Today, 01:28 AM
                  0 responses
                  9 views
                  0 likes
                  Last Post Max238
                  by Max238
                   
                  Started by rocketman7, Today, 01:00 AM
                  0 responses
                  4 views
                  0 likes
                  Last Post rocketman7  
                  Started by wzgy0920, 04-20-2024, 06:09 PM
                  2 responses
                  28 views
                  0 likes
                  Last Post wzgy0920  
                  Working...
                  X