PROTECTED SOURCE SCRIPT

[co.n.g.] ADR 5/10/14/20

Average Daily Range (ADR) over 5/10/14/20 Days

What it is
One of the oldest measurements of price volatility that is being used in technical and statistical trading is the range of a specific period of past days to estimate probability of chances, risk and price movements, as seen f.e. in
Molodovsky, N. (1967). Building a Stock Market Measure—A Case Study. Financial Analysts Journal, 23:3, 43-46, DOI: 10.2469/faj.v23.n3.43.

Problem
After having tried all available community scripts I've encountered various indifferences, especially since Pine v5.
First, the anchor period changed, when I've switched between regular and extended trading hours.
- This meant, that the anchor switched between the official open of the day and the first bar of a new day beginnig at 00:00 UTC (or the corresponding timezone).
Second, thus in some scripts also changed the calculated average range, including or excluding pre market and after hours.
And therefor third, in many cases the distance between open and ADR high/low was indiffferent, putting one closer and the other further away.

Why is that?
After having tried seven different modes of calulation - from ta. to array, it appeared that especially since Pine v5 the calulation is lagging when calling
the request.security function and is thus rendering the calculations indifferent.
Especially the open is lagging and plotting delayed, about 15 minutes on a M1-chart or about 45 minutes on a M15 chart, which made id difficult to spot open (test) drives
- as f.e. described in Dalton, J. F., Jones, E. T., & Dalton, R. B. (1990). Mind over markets: power trading with market generated information. 1st edition. Probus. -
and estimating extremely strong or weak open moves.

While switching between regular and extended intraday charts, the open was either calculated on the open as request of "D" (open of the regular session)
and "1440" (which means full intraday since 00:00 UTC or the corresponding timezone), leading to undesired anchoring.

After having tried about five different anchoring periods and comparing the adr to TradingView 's stock screener, there was no proper calulation or plotting possible,
if not partially hardcoded (being the least desired, elegant or flexible method).

Visualizing the problem

As described in the picture:
snapshot

  • sherwind 's ADR is plotting entirely wrong! I couldn't even figure out (even the source is available) whre the problem is rooted.
  • treypeng 's ADR is anchored properly, but unfortunately the calculation is wrong.



Originality
As evident in the attached picture - and you are able to compare this to TradingView 's stock screener - in this script as well the ADR is calculated PROPERLY
as well as the anchoring is set PROPERLY within the first tick of the session.
As matter of fact, you don't have to examine different timeframes, charts or sessions simoultaneously to see the correct levels and
you're able to ease observations and focus on your trading.

Innovation
There is no innovative approach, as described above, simply because this statistical approach is around since the 1960's.
Considering coding, neither is, but it is properly calculated and anchored.

What this script does
  • Anchoring at the first tick of the new New York session
  • Plotting the actual - not the past nor future - average day range (gray lines in picture)
  • Plotting the actual - not the past nor future - 75% average day range ( silver lines in picture)
  • Vizualising ADR breakouts by colouring the backround green (long breakout) or read (short breakout)


Selection methods
Keeping it simple stupid, as of now:
Abiliy to chose between 5/10/14/20 days

Additional
Theory says, that we are staying within the ADR of 75% every day.
_
Alas, there are some exceptions.
If price is breaking out of the ADR, we are likely to move in this direction for the rest of the day.
If price has broken out of the ADR on the previous day, ist highly unlikely to expect another ADR breakout day,
which doesn't mean that there might not appear a strong or weak second day.

Notes
Designed for intraday stock trading of the U.S. market.
Best (and easiest) chances are to be spotted in special conditions.

//Cheers,
//Constantine
ADRaverageChart patternsdaytradingintradaylevelsprofessionalstatisticstatisticstrendVolatilityvolatilitydaily

Protected script

This script is published closed-source and you may privately use it freely.

Want to use this script on a chart?


Also on:

Disclaimer