Average Daily Rate – ADR
Forums › ProRealTime English forum › ProBuilder support › Average Daily Rate – ADR
- This topic has 14 replies, 2 voices, and was last updated 3 years ago by robertogozzi.
Tagged: ADR, average daily range
-
-
05/05/2020 at 3:36 PM #130062
Hello!
I’m trying to code an Average Daily Rate indicator which includes a trading week of daily prices. I’d like to show it independently below the chart in a separate area.
This is my code
ADR Week12345678910// Default Period = 7//ADR Average Daily RateADR = Average(Average[DHigh(0)-Dlow(0)]+Average[DHigh(1)-Dlow(1)+Average[DHigh(2)-Dlow(2)+Average[DHigh(3)-Dlow(3)+Average[DHigh(4)-Dlow(4)+Average[DHigh(5)-Dlow(5)+Average[DHigh(6)-Dlow(6)]]]]]])r=255g=0b=0return ADR coloured(r,g,b) style(Line, 5) as "ADR"When I try to add this indicator to my chart, I get the following error:
“A positive integer field is expected with Average”
What am I missing here?
Many thanks in advance for your help!
05/05/2020 at 3:43 PM #130063Are you sure you are not confounding with an Average Daily Range? Which is the X days average or each bar range. Recent french topic (and code) about ADR: https://www.prorealcode.com/topic/probleme-sur-indicateur-range-daily/
1 user thanked author for this post.
05/05/2020 at 4:00 PM #130074Hello Nicolas,
Thank you very much for your reply. Yes, I actually meant the “Average Daily Range”. I’ve read the post you pointed out, but I’m still not sure if using the following code (with daily prices) would give me the ADR indicator that I’m looking for, and if this is equivalent to the formula I was using before. I would appreciate if you could confirm.
ADR Week Daily candles123a= Average[7](Dhigh(1)-Dlow(1))Return a coloured(255,102,0) as "Average Daily Range"Thanks!
05/05/2020 at 4:07 PM #130084Your formula was wrong because you were using daily price values as period?
This last code is not good if you want to use it on a timeframe inferior to the daily one. It also includes 7 days prior to the current one, which is not included, I don’t know if you want to include the current day or not?
1 user thanked author for this post.
05/05/2020 at 4:19 PM #130089Hi Nicolas,
I don’t know what was wrong with it, but I’m getting the error “A positive integer field is expected with Average” when I try to use it.
I just need an indicator that returns the Average Daily Range for each trading day up to the previous one. So I’m not interested in the current one. My timeframe is 1 day.
I’m only using daily candles, and I would like to view it below my chart, like some other pre-built indicators I’m currently using.
Many thanks in advance for your reply.
05/05/2020 at 4:41 PM #130095If you just want an average of the last seven days ranges then the last code you posted works just fine.
If you want the average for Mondays and the Average for Tuesdays and the average for Wednesdays then that is something totally different.
1 user thanked author for this post.
05/05/2020 at 4:48 PM #13009706/30/2021 at 12:17 AM #172756How can I display the ADR of a stock for one month on screen as I don’t need this as separate indicator.
Could you please share the code for that? Thanks.
06/30/2021 at 5:18 AM #172757To display whatever om screen you need an indicator.
If you want to display it one month only, simply remove it when no more needed.
I am not sure I understood what you mean, though.
07/01/2021 at 7:27 AM #172857I need to know which one is correct ADR formula for last one month ADR. I have following two codes and there is some variation comes in between these two results:
123c1 = Volume >8900000ADR= Average[20](Dhigh(1)-Dlow(1))SCREENER[c1] (ADR AS "ADR Rating")123c1 = Volume >8900000ADR = average[20,0](range)SCREENER[c1] (ADR AS "ADR Rating")Moderators Edit: Post edited – please use the ‘Insert PRT Button’ when inserting code in your posts.
07/01/2021 at 8:03 AM #172862If used ina Daily TF they are identical, but for the fact that the first one (Dhigh(1)-Dlow(1)) refers not to the last 20 periods, but to the previous 20 periods (not including today). You could use RANGE[1] to the second screener to make them match.
If they are not used in a Daily TF, the first one correctly uses DAILY values (apart from the starting offset as explained above), while the second one refers to the RANGE according to the involved TF.
07/02/2021 at 5:20 AM #17291807/02/2021 at 7:41 AM #172921In the first part of my last post I wrote “for the fact that the first one (Dhigh(1)-Dlow(1)) refers not to the last 20 periods, but to the previous 20 periods”.
The correct version is “due to the fact that the first one (Dhigh(1)-Dlow(1)) refers not to the last 20 periods, but to the previous 20 days”.
Sorry for any misunderstanding this may have caused.
07/03/2021 at 5:15 AM #173027Sorry, I didn’t understand. What’s the difference between 20 periods and 20 days? On Daily chart they both will be same? what about in hourly chart?
07/03/2021 at 6:55 AM #173029The difference is on charts other than the daily one.
-
AuthorPosts
Find exclusive trading pro-tools on