ATR Label for ThinkorSwim

roger80k

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

Code:
#
# Copyright 2014 Scott J. Johnson (https://scottjjohnson.com)
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#      http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS-IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#

#
# ATRLabel
#
# Displays Average True Range over the last 40 periods and the current period
#
input ATRLength = 40;

# historical ATR
def ATRValue = Average(TrueRange(high,  close,  low),  ATRLength);
def ATRPercent = ATRValue / close * 100;

# current period range
def ATRLastBar = TrueRange(high,  close,  low);

AddLabel(yes, ATRLength + " Period ATR = $" + Round(ATRValue, 2) + " (" + Round(ATRPercent, 2) + "%), Current Period Range = $" + Round(ATRLastBar, 2) + " (" + Round(ATRLastBar / close * 100, 2) + "%)", CreateColor(153, 153, 0));
 
Solution
@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 =...
Hello,

The script below shows me a label for the ATR from 1 bar ago. The only issue is that the value changes when I change the time frame. Is it possible to change it to show only the daily ATR. So for example, if the daily ATR from yesterday is 1 and I change to a 5 minute time frame the label will still show 1. Thank you.

input length = 14;
input averageType = AverageType.WILDERS;
plot ATR = MovingAverage(averageType, TrueRange(high, close, low), length);
AddLabel(yes, Concat("ATR1 = ", ATR[1]), Color.YELLOW);

Basically I want the label to show me the daily ATR from 1 bar ago on all time frames. So the value stays the same, it never changes.
 
Hey, All - I'm just looking for a simple ATR label so I can save some screen space for the indicator pane. Looking for all the normal settings options for ATR, but want to display it as a numerical label rather than as an indicator. I'm not up to speed on ThinkScript and think this is probably a fairly easy label to make so thought it might be in here. I haven't found anything in searching, though, so hoping someone might be able to provide some help. Thanks!
 
Hey, All - I'm just looking for a simple ATR label so I can save some screen space for the indicator pane. Looking for all the normal settings options for ATR, but want to display it as a numerical label rather than as an indicator. I'm not up to speed on ThinkScript and think this is probably a fairly easy label to make so thought it might be in here. I haven't found anything in searching, though, so hoping someone might be able to provide some help. Thanks!

Your Post was moved to this thread. Here there are several different examples of ATR labels.
Try them out and see what suits you best.
 
In case anyone is still looking for a script: ATR with DTR Label
@khpro59 Is there a way to use this label on a ticker but reference another ticker?

For example: If I wanted to have it display on /ES but show the DTRvsATR of the Nasdaq100? I thought using something like this would do it but not quite. Any help you could provide would be great.

Def Ndad = (price = close(symbol = "/nd"));
 
Last edited by a moderator:

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
244 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