ADR Label on chart
Forums › ProRealTime English forum › ProBuilder support › ADR Label on chart
- This topic has 9 replies, 3 voices, and was last updated 4 days ago by
JS.
-
-
02/13/2025 at 8:42 PM #243805
Hi. I have a script that calculates and returns an ADR result(ADR in dollars, across the last 20 daily candles).
Also, I’m sure there is an easier way to calculate this, but this is what I’m currently working with:
DR=High-Low
ADR=(DR[0]+DR[1]+DR[2]+DR[3]+DR[4]+DR[5]+DR[6]+DR[7]+DR[8]+DR[9]+DR[10]+DR[11]+DR[12]+DR[13]+DR[14]+DR[15]+DR[16]+DR[17]+DR[18]+DR[19])/20
Return ADRMy questions are:
- Is it possibly to get this result to show on the price chart in a label or bubble or similar, to appear near top of chart or near description or other, instead of regular chart type?
- Can I use TimeFrame to somehow show the Daily ADR as a DAILY average only, not changing with selected chart timeframe?
Thanks
02/14/2025 at 9:44 AM #243828Hi, here is another way to calculate ADR.
123456789defparam drawonlastbaronly=truedr=high-lowadr=summation[20](dr)/20if islastbarupdate thendrawtext("ADR=#adr#",-100,-100)anchor(topright,xshift,yshift)endifReturnHere are some examples with the timeframe: https://www.prorealcode.com/documentation/timeframe-probacktest-proorder/
02/14/2025 at 2:18 PM #24383702/15/2025 at 9:34 AM #24386102/15/2025 at 10:13 AM #243862If you want to use multiple timeframes, you can place the calculation of the indicator under the desired timeframe (in this case, daily) and the output (text, plot, print) under the “Default” timeframe…
ADR MTF1234567891011DefParam DrawOnLastBarOnly=TrueTimeFrame(Daily, UpdateOnClose)Period=20DR=High-Low //or DR=RangeADR=Average[Period](DR)TimeFrame(Default)drawtext("ADR=#adr#",-100,-100)anchor(topright,xshift,yshift)Return02/15/2025 at 9:33 PM #24389302/15/2025 at 9:53 PM #243894If I have understood everything correctly, you want to display the daily ADR label in the chart while the chart’s timeframe can change…
At least, this is what the code is written for and what it also executes…
When I load the indicator into the chart (on the price), the ADR label appears in the top right corner of the chart. Now, if I change the chart’s timeframe, for example, to 1 hour (15k units), the label remains in the same position, and the value also stays the same…02/15/2025 at 10:01 PM #243896Thank you. Not sure what other setting is different on my end, but I get errors when changing timeframes. I even tried changing units as well in case that made a difference. Copied and pasted also to be sure i didn’t mistype.
02/15/2025 at 10:03 PM #24389802/15/2025 at 10:49 PM #243899 -
AuthorPosts
Find exclusive trading pro-tools on