Average (Daily) Range

Average (Daily) Range

Hello all,

I was very surprised that I couln’t find the “Average Daily Range” indicator, although it is a very simple and important one.

This simplified code can draw the ADR, but can also be applied to any timeframe.
So it would be the average range of the “p” last bars.

Beware, it is not the Average True Range.

Share this

Risk disclosure:

No information on this site is investment advice or a solicitation to buy or sell any financial instrument. Past performance is not indicative of future results. Trading may expose you to risk of loss greater than your deposits and is only suitable for experienced investors who have sufficient financial means to bear such risk.

ProRealTime ITF files and other attachments : How to import ITF files into ProRealTime platform?

PRC is also on YouTube, subscribe to our channel for exclusive content and tutorials

  1. David • 06/10/2016 #

    Hi Doc. Thanks for sharing. To me there’s isn’t much difference between this and the ATR and your code is not set for “daily” unless you use the daily chart?
    I’m looking at developing the Average Daily Range to use on lower time-frames like I did here for the Moving Average Daily here: http://www.prorealcode.com/topic/daily-moving-average-with-customclose-on-non-daily-timeframe/#post-18761 
    I might try to make it during the holidays but thought you might be interested in making it the meantime if you have free time. 

    • Nicolas • 06/10/2016 #

      Hi David, this code is not the proper daily ATR, which is calculated as follow according to the probuilder documentation: 
      True range is the highest data in absolute value among :
      (today’s high – today’s low)
      (today’s high – yesterday’s close)
      (today’s low – yesterday’s close)
      To calculate the Average True Range, it is necessary to apply a Wilder moving average of the True Range.
      The code should be:
      period = 14

      //True range calculation
      d1 = Dhigh(0)-Dlow(0)
      d2 = abs(Dhigh(0)-Dclose(1))
      d3 = abs(Dlow(0)-Dclose(1))

      dailyTR =max(d1,max(d2,d3))

      c = wilderaverage[period](dailyTR)

      RETURN c as \"Daily Timeframe ATR\"
      But there is still a problem to calculate the Wilder Average of daily values array into a lower timeframe.. Understand, that this code don’t give you the good value because in this case the WilderAverage of 14 periods use the last 14 candlesticks of the timeframe on which the indicator is attached, not the last 14 daily values.

  2. David • 06/10/2016 #

    Thanks for the explanation Nicolas.

  3. freecat1899 • 06/10/2016 #

    Hello, I wanted to create a percent ADR based on this indicator, so I wrote this code that IMO it looks ok:

    // AVERAGE DAILY RANGE PERCENTAGE

    PMAXAVG = average[p](high)
    PMINAVG = average[p](low)
    PAVG = average [p] (close)
    ADRP = (PMAXAVG – PMINAVG)/PAVG*100

    return ADRP as “Average Daily Range Percent”

    However, when I use it, it doesn’t seem to give out correct values as it is giving me a higher value than the ATRP described in this post for the same 20 daily periods:

    https://www.prorealcode.com/prorealtime-indicators/average-true-range-percent-atrp/#:~:text=The%20Average%20True%20Range%20Percent,variation%20and%20not%20prices%20itselves.

    From my understanding of ADRP and ATRP, ADRP should always be lower than ATRP as it doesn’t include gaps.

    Can someone help me out? thanks

  4. revstrat • 06/10/2016 #

    At first glance, I see this mistake. You shouldn’t average the highs and the lows. You should be averaging the ranges.

avatar
Register or

Likes

avatar avatar avatar avatar avatar
Related users ' posts
Doctrading Hello,  The strategy should be improved, no doubt. But it was just one of my ideas, which h...
ALEALE Yes Nicolas is very difficult, macro economic data can destroy any work!!  
styrke depends which.. I personally think that it's much more easier to trade on XBTUSD, try to co...
GraHal Ooops got that excited I sent that last one twice! ha (and can't delete it, sorry) I got it...
Eric n = 3  dont forget to allow 3 contract in proorder
UkCoopDownUnder Tried EURUSD GMT and GMT -1, as far back as I can go, Nov 2018 on 15mn Tf, 22% loss
Investment Account Wow great thanks ... looks good! Do I set the colour shades up from within the indicator 's...
avatar
Anonymous Thanks for your comments and yes, that is exactly how I set up the colour levels.
Vish Thanks I have added this in my watch list. Has anyone tried it yet ? Does it work on currenc...
Nicolas
9 years ago
trabucaire Hello, what does it mean the 20 and 40 number on this code ? Thank you !
robertogozzi I modified it to make parameters customizable and to Draw a Grey candlestick when a range is...

Top