# Looking for a Daily Trading Range vs ATR Indicator

R

#### roger80k

##### New member
Hi Guys if anyone has DTR VS ATR indicator and can post a script for TOS would really appreciate it.

#### BenTen

Staff
VIP
ATR is already available in ThinkorSwim. I'm not sure about DTR but there is one called Average Daily Range posted here.

R

#### roger80k

##### New member
ATR is already available in ThinkorSwim. I'm not sure about DTR but there is one called Average Daily Range posted here.

It looks like this

#### markos

##### Well-known member
VIP
@roger80k If you have a picture of it, then it's on your system. Click the little beaker to look up the code. Please let us know what it is then, please!

Last edited:
R

#### roger80k

##### New member
It’s not my screen shot it someone in the trading community using it on their tos platform

#### horserider

##### Well-known member
VIP
@roger80k Not exactly what you wanted but might work, Just combined two already existing studies and just gives you the labels.

Code:
``````input aggPeriod = AggregationPeriod.DAY;

input length = 20;

input multiplier = 2;

def studyPrice = close(period = aggPeriod);

def hi = high(period = aggPeriod);

def lo = low(period = aggPeriod);

def r = hi - lo;

def avgRange = Average(r, length);

def avg = Average(studyPrice, length);

AddLabel(yes, Concat("average daily range: ", avgRange), color.ORANGE);

# Average True Range Label

# Mobius

# V01.10.2013

input nATR = 21;

input SdPeriods = 252;

def AggD = AggregationPeriod.Day;

def hD = high(period = AggD);

def lD = low(period = AggD);

def cD = close(period = AggD);

def TR = TrueRange(high, close, low);

def ATR = Average(TR, nATR);

def ATRd = Average(TrueRange(hD, cD, lD), nATR);

def SDatr = StDev(ATRd, SdPeriods);

def hhATR = highest(SDatr, SdPeriods);

def llATR = lowest(SDatr, SdPeriods);

def ATRpercentile = (SDatr - llATR) / (hhATR - llATR);

AddLabel(yes, "(Chart Agg. TR = \$" +

TR +

" //  ATR Perids: " +

nATR +

" = \$" +

(Round(ATR / TickSize(), 0) * TickSize()) +

");  ATR Daily = \$" +

(Round(ATRd / TickSize(), 0) * TickSize()) +

";  ATR YR. Percentile: " +

AsPercent(ATRpercentile),

if ATR > ATR[1]

then Color.Green

else if ATR < ATR[1]

then Color.Red

else Color.White);``````

Last edited by a moderator:
R

Thanks

#### markos

##### Well-known member
VIP
@roger80k try this ATR label out for size.... DTR vs. ATR(5)
Code:
``````# TS ATR
# Version 1
# 4/23/2015
# This software is licensed for individual use only.
# Here is a label for the thinkorswim charts that will display what the atr is and also display the day trade range based of the high – the low

declare upper;

input ATRLength = 5;
input averagetype = AverageType.WILDERS;
input BasePeriod = AggregationPeriod.DAY;
input showlabel = yes;

def ATR = MovingAverage (averagetype, TrueRange(high(period = BasePeriod)[1], close(period = BasePeriod)[1], low(period = BasePeriod)[1]), ATRLength);

def Today_High = Highest(high(period = baseperiod)[0], 1);
def Today_Low = Lowest(low(period =baseperiod)[0], 1);

def DR = Today_High - Today_Low;

AddLabel(showlabel, "DTR: " + Round(DR , 2) + " vs. ATR(5):" +round(ATR,2), Color.LIGHT_GRAY);``````

R

Thanks

2019 Donor