ATR ADR Indicator (with %) For ThinkOrSwim

jngy2k

Member
I couldn't find one in this forum that was simple and showed percentages of the price. Plots both ADR and ATR with their percentages as labels.

Let me know if it can be improved.

Code:
declare lower;

input length = 14;

plot ATR = MovingAverage(AverageType.wilders, TrueRange(high, close, low), length);
ATR.SetDefaultColor(GetColor(8));

AddLabel (yes, "ATR:" + Round((ATR / close) * 100, 3) + "%", Color.WHITE);


AddLabel (yes, "ATR:" + round((ATR) , 3), Color.white);


plot ADR = MovingAverage(AverageType.wilders, high-low, length);
ADR.SetDefaultColor(GetColor(6));

AddLabel (yes, "ADR:" + round((ADR) , 3), Color.light_green);

AddLabel (yes, "ADR:" + Round((ADR / close) * 100, 3) + "%", Color.light_green);

ky8H7enh.jpg
 
Last edited:

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

Hi,

Does anyone have a label to display the Average Daily range as a percentage?

Edit: Thanks, I will play with it. Appreciate it. This community is great.
 
I couldn't find one in this forum that was simple and showed percentages of the price. Plots both ADR and ATR with their percentages as labels.

Let me know if it can be improved.

Code:
declare lower;

input length = 14;

plot ATR = MovingAverage(AverageType.wilders, TrueRange(high, close, low), length);
ATR.SetDefaultColor(GetColor(8));

AddLabel (yes, "ATR:" + Round((ATR / close) * 100, 3) + "%", Color.WHITE);


AddLabel (yes, "ATR:" + round((ATR) , 3), Color.white);


plot ADR = MovingAverage(AverageType.wilders, high-low, length);
ADR.SetDefaultColor(GetColor(6));

AddLabel (yes, "ADR:" + round((ADR) , 3), Color.light_green);

AddLabel (yes, "ADR:" + Round((ADR / close) * 100, 3) + "%", Color.light_green);

ky8H7enh.jpg
is ADR here also DTR? I see some use ATR vs DTR; what are the difference?
 
@MColb Yes. Try the below code, make sure to change the length to however many bars you wish to use as the average.

Code:
# Scan for Average Daily Range of 14 bars to be > 5%
def length = 14;
plot scan = (average(high - low, length)/close*100) > 5;
Is 14 the common bar amount to use?
 
@MColb It depends on the user. Some I see use 5 bars (a week on the daily chart), others use 20-22 bars, which is around a month. Its all up to your personal preference. I myself use 20 bars on a daily aggregation as part of my scans, but that doesnt mean I would recommend doing so, its just what I prefer.
 
@MColb Yes, 14 is a common number... I, on the other hand, use Fibonacci Numbers and primarily, 3, 5, 8, 13, 21, 34, 55, and 89...
 
Here is one I use on my trading chart so I can see where % range is for today relative to an average of day:

Code:
#Avg Day Range %
#@rlohmeyer
def Hi = high(period = AggregationPeriod.DAY);
def Lo = low(period = AggregationPeriod.DAY);
def DRngP = Round((Hi - Lo) / Lo * 100, 2);
input Avg = AverageType.Exponential;
input Lngth = 5;
def ADRP = Round(MovingAverage(Avg, DRngP, Lngth),2);
AddLabel(yes,"ADR| " + "Type: "+ Avg +"  Lngth: " + Lngth + "  Avg: " + ADRP + "%" + "  Today: " + DRngP + "%", color.light_gray);
 
declare lower; input length = 14; plot ATR = MovingAverage(AverageType.wilders, TrueRange(high, close, low), length); ATR.SetDefaultColor(GetColor(8)); AddLabel (yes, "ATR:" + Round((ATR / close) * 100, 3) + "%", Color.WHITE); AddLabel (yes, "ATR:" + round((ATR) , 3), Color.white); plot ADR = MovingAverage(AverageType.wilders, high-low, length); ADR.SetDefaultColor(GetColor(6)); AddLabel (yes, "ADR:" + round((ADR) , 3), Color.light_green); AddLabel (yes, "ADR:" + Round((ADR / close) * 100, 3) + "%", Color.light_green);
Hi , thanks for this cool indicator, super useful. I was wondering if you could help me how to use it in a scan and add it to my watchlist. I'm new to TOS . Thanks!
 
Hi , thanks for this cool indicator, super useful. I was wondering if you could help me how to use it in a scan and add it to my watchlist. I'm new to TOS . Thanks!
#column
plot ATR = MovingAverage(AverageType.wilders, TrueRange(high, close, low), 14);

#scan
def ATR = MovingAverage(AverageType.wilders, TrueRange(high, close, low), 14);
plot scan=atr>3;
 
I couldn't find one in this forum that was simple and showed percentages of the price. Plots both ADR and ATR with their percentages as labels.

Let me know if it can be improved.

Code:
declare lower;

input length = 14;

plot ATR = MovingAverage(AverageType.wilders, TrueRange(high, close, low), length);
ATR.SetDefaultColor(GetColor(8));

AddLabel (yes, "ATR:" + Round((ATR / close) * 100, 3) + "%", Color.WHITE);


AddLabel (yes, "ATR:" + round((ATR) , 3), Color.white);


plot ADR = MovingAverage(AverageType.wilders, high-low, length);
ADR.SetDefaultColor(GetColor(6));

AddLabel (yes, "ADR:" + round((ADR) , 3), Color.light_green);

AddLabel (yes, "ADR:" + Round((ADR / close) * 100, 3) + "%", Color.light_green);

ky8H7enh.jpg
Thank you for this very useful code.
I was wondering if there was a way to plot the ADR percentage instead of the dollar value?
 
Can you be more concise in your question?
Very confused to what you are asking
Thank you, sorry for the confusion
I am looking for scan ATR is greater than first 5 minutes candle (9:30to 9:35)range( high minus low )
For example : stock X ATR is 5
And range of 5 minutes candle range is 6
Its will not show up in results
But if ATR is 5
And the range of 5 minute candle range is 4
It will show up in results .
 
@drmog1800 yeah it is super simple

plot scan= atr>5 and high-low<atr;

You are going to have to understand simple scipts if you going to master KQ and EG methods on TOS
 
@MColb Yes. Try the below code, make sure to change the length to however many bars you wish to use as the average.

Code:
# Scan for Average Daily Range of 14 bars to be > 5%
def length = 14;
plot scan = (average(high - low, length)/close*100) > 5;
Pensar how do I edited the scan to show stocks that have a "today %" higher than the " Avg %"
 
I couldn't find one in this forum that was simple and showed percentages of the price. Plots both ADR and ATR with their percentages as labels.

Let me know if it can be improved.

Code:
declare lower;

input length = 14;

plot ATR = MovingAverage(AverageType.wilders, TrueRange(high, close, low), length);
ATR.SetDefaultColor(GetColor(8));

AddLabel (yes, "ATR:" + Round((ATR / close) * 100, 3) + "%", Color.WHITE);


AddLabel (yes, "ATR:" + round((ATR) , 3), Color.white);


plot ADR = MovingAverage(AverageType.wilders, high-low, length);
ADR.SetDefaultColor(GetColor(6));

AddLabel (yes, "ADR:" + round((ADR) , 3), Color.light_green);

AddLabel (yes, "ADR:" + Round((ADR / close) * 100, 3) + "%", Color.light_green);

ky8H7enh.jpg
This is a great code! Is there a way to display this indicator in the same box with the volume bars underneath the chart? I hope this question makes sense.
 
This is a great code! Is there a way to display this indicator in the same box with the volume bars underneath the chart? I hope this question makes sense.
I think you mean volume bars in the same area as the atr indicator which you can but because the volume need their own numbers on the right hand side and atr needs their own numbers on the right hand side the ATR indicator will be compressed real low because their numbers are scaled to the volume numbers. You can use this indicator and add VolumeAvg indicator from TOS to the lower chart.
 
Is 14 the common bar amount to use?

@MColb Yes. Try the below code, make sure to change the length to however many bars you wish to use as the average.

Code:
# Scan for Average Daily Range of 14 bars to be > 5%
def length = 14;
plot scan = (average(high - low, length)/close*100) > 5;
How do I add input choices so I do not have to edit code for changes like length and the ATR% ???
 
How do I add input choices so I do not have to edit code for changes like length and the ATR% ???
Ruby:
# Scan for Average Daily Range of 14 bars to be > 5%
input length = 14;
input adr = 5 ;
plot scan = (average(high - low, length)/close*100) > adr;
 

Similar threads

Not the exact question you're looking for?

Start a new thread and receive assistance from our community.

87k+ Posts
355 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.
Back
Top