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
larouedegann TIMEFRAME(15minutes) apparemment ne fonctionne pas
Iván Bonjour Je ne comprends pas bien le problème. L'indicateur fonctionne dans n'importe quelle...
larouedegann OUI je le sais, il fonctionne dans toutes les unités de temps. Mais je souhaite utiliser l'i...
finplus Bonjour, une petite demande concernant cet indicateur : comment faire pour que lorsque la bo...
LucasBest Bonjour, la coloration des bandes se fait ligne 111 et 112 à l'aide des instructions colorbe...
Nicolas Je ne rencontre pas ce problème avec le NASDAQ par exemple, ce serait plus simple d'ouvrir u...
YvesRobert Bonjour Nicolas, en effet ca marche, je me suis trompé, j'ai bien tout le tracé. C'est parce...
oliTR Bonjour, les conditions longCond et shortCond ne contiennent-elles pas une condition qui s'a...
Jiacky
2 years ago
Range Factor
Range Factor
0
Indicators
Sever
3 years ago
Stenozar Hi Sever, how can I visualize the coloured areas?
Sever Hi Stenozar, You need to add the color zones yourself , just go to Add Color Zone To set ...
Boris Hi IVMcm, thanks for your amazing work. I have tested all of your indicators and use some of...
IV Mcm With pleasure and thanks!
ashiash how to use this indicator can i use tradingview platform
Seabiscuit Hi! I like this indicator a lot, been using it on a 30 min timeframe and usually confirms my...
Ramahu Bonjour et merci pour cet indicateur ! je l'observe sur les actions du Nasdaq et la plupart ...
StephFor //ind1 = ZigZagPoint[2*averagetruerange[200]](close) avr = 3 //3% ind1 = ZigZag[avr](close...
Manu L. @Steph un grand merci pour ton aide mais :-( J'ai copier le code tel quel mais cependant j...
AlphaMauss Je n'ai pas réussi à faire fonctionner l'indicateur avec le code fourni en commentaire sur P...
IV Mcm Line 68 and 70, you must delete the instruction at the end of the line "" Bordercolor(0,0,0,...
BoutDePain This instruction is for the V11 maybe that you are using V10.3 then you can safely remove it.
Protagonist Bonjour, Je vois l'instruction inRange mais je ne trouve pas sa signification. Pouvez-vous...
Nicolas
4 years ago
Nicolas La définition des couleurs se situent entre les lignes 94 et 118. Selon le type de bougie (h...
Manu35250 Bonjour Nicolas, Est il possible de convertir cet indicateur en screener ? J'essaie depui...
Nicolas Bien sûr, merci de formuler la demande dans le forum approprié en respectant les règles de p...
PHAN100 bonjour, bravo à l'auteur pour cet indicateur visuel sur le graphique, il nous reste à va...
Nicolas Oui c'est possible. Merci de ne pas poster des demandes qui sont hors sujets. Pour les deman...
Igor Merci pour cet itf. Question : comment faire pour instruire un screener ?
Nicolas tester le croisement du Close avec la première valeur de l'indicateur : "TrailingStop", faci...

Top