Average Daily Range Labels For ThinkOrSwim


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.

## 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"));
Is there a way to adjust it for forex? To use it in pips instead percentage? And also, to adjust the day to start @ Midnight NY time?

Join useThinkScript to post your question to a community of 21,000+ developers and traders.

Similar threads

Not the exact question you're looking for?

Start a new thread and receive assistance from our community.

87k+ Posts
116 Online
Create Post

Similar threads

Similar threads

The Market Trading Game Changer

Join 2,500+ subscribers inside the useThinkScript VIP Membership Club
  • Exclusive indicators
  • Proven strategies & setups
  • Private Discord community
  • ‘Buy The Dip’ signal alerts
  • Exclusive members-only content
  • Add-ons and resources
  • 1 full year of unlimited support

Frequently Asked Questions

What is useThinkScript?

useThinkScript is the #1 community of stock market investors using indicators and other tools to power their trading strategies. Traders of all skill levels use our forums to learn about scripting and indicators, help each other, and discover new ways to gain an edge in the markets.

How do I get started?

We get it. Our forum can be intimidating, if not overwhelming. With thousands of topics, tens of thousands of posts, our community has created an incredibly deep knowledge base for stock traders. No one can ever exhaust every resource provided on our site.

If you are new, or just looking for guidance, here are some helpful links to get you started.

What are the benefits of VIP Membership?
VIP members get exclusive access to these proven and tested premium indicators: Buy the Dip, Advanced Market Moves 2.0, Take Profit, and Volatility Trading Range. In addition, VIP members get access to over 50 VIP-only custom indicators, add-ons, and strategies, private VIP-only forums, private Discord channel to discuss trades and strategies in real-time, customer support, trade alerts, and much more. Learn all about VIP membership here.
How can I access the premium indicators?
To access the premium indicators, which are plug and play ready, sign up for VIP membership here.