I didn't see anything exactly like this, but apologies if I'm duplicating other threads. Below is a script for labels that show the Average Daily Range for the last 20 days, along with how much movement is remaining before today hits that average. I find it helpful to keep me in an intraday trade longer when I can see there is still a lot of the average move remaining. It can also display the standard deviation of the average. Lower standard deviations mean the stock is not as volatile in price movement and more likely to approach the average. If the standard deviation is high, this indicator may not be that helpful. Some more information is in the comment section of the code.
Ruby:
## Average Daily Range (ADR) Labels by theLEMband
## Version 220318.0
## Displays the average percent MOVEMENT of high vs lows
## (not gain/loss) for the past number of days desired
## ADR excludes gaps up/down (as opposed to ATR which
## includes gaps)
## Displays the percent movement for today
## Displays the percent of move remaining before hitting the average
#### inputs
input length = 20;
input showAverageDailyRange = yes;
input showStandardDeviation = no;
input showTodayPercentMove = no;
input showPerecentOfDayRemaining = yes;
#### definitions & calculations ####
def aggregationPeriod = AggregationPeriod.DAY;
## fetch highs/lows for the period
def dailyHigh = high(period = aggregationPeriod);
def dailyLow = low(period = aggregationPeriod);
## calc the average movement for the period
def avgDailyRangeSum = Average((dailyHigh / dailyLow), length);
## convert to a percentage
def averageDailyRange = Round (100 * (avgDailyRangeSum - 1), 2);
def stdDevofADR = stdev(averageDailyRange, length);
## calc today's movement
def todayRange = (dailyHigh / dailyLow);
## convert to a percentage
def todayPercent = Round (100 * (todayRange - 1), 2);
## calculate ratio of today's movement vs average movement
## "what percent of the average movement is remaining"
def todayRatio = (1 - todayRange) / (1 - avgDailyRangeSum);
## convert to a percentage
def todayRemaining = Round (100 *(todayRatio - 1), 2);
#### Output and Style
DefineGlobalColor("ADRColor", CreateColor(50, 200, 255)) ;
AddLabel(showAverageDailyRange, " Average Daily Range for the last " + length + " days = " + averageDailyRange + "%", GlobalColor("ADRColor"));
AddLabel(showStandardDeviation, " Standard Deviation = " + stdDevofADR + " ", GlobalColor("ADRColor"));
AddLabel(showTodayPercentMove, " % Moved Today = " + todayPercent + "%", GlobalColor("ADRColor"));
AddLabel(showPerecentOfDayRemaining, " Percentage of ADR Remaining = " + (1 - todayRemaining)+ "%", GlobalColor("ADRColor"));