Resource icon

thinkScript AddLabel: Adding Custom Labels to your Chart

Here is how you can add a text label to your chart in ThinkorSwim. Keep in mind that custom labels are automatically placed at the top left corner.

Usage

Code:
AddLabel(visibility option, your text, color);

Example

Ruby:
AddLabel(yes, "DO NOT overtrade", color.red);

Here, I'm placing a custom text label to remind myself not to overtrade.

Indicators with declarations such as declare lower; can also use AddLabel

Ruby:
#
# TD Ameritrade IP Company, Inc. (c) 2007-2020
#

declare lower;

plot ImpVol = IMP_VOLATILITY();
AddLabel(yes, Concat("IV = ", ImpVol), color.orange);

The code above displays the stock's Implied Volatility line. We included the AddLabel script to show the current value of IV.

Additional scripts related to AddLabel

Useful Notes from the thinkScript Lounge

Labels with symbol [source]

Code:
## TICK Label
AddLabel(1, "$TIKI =" + close(Symbol = "$TIKI"));
def c = close(Symbol = "vix");
## vix difference Label
AddLabel(1, "VIX diff =" + (c - c[1]));
## vix Label
AddLabel(1, "VIX =" + c);

A coder's point worth noting [source]

When coding a watchlist column, an 'AddLabel' can be substituted for a plot statement, but only one of the two can be used. When using a plot statement, TS looks for double-precision values only for input (no text) while the AddLabel approach accepts text and double-value-numbers which are combined using the 'concat' function. Good to remember!

Used in Squeeze WL
Code:
############
AddLabel(yes,if plot_value == 13 then Concat(">=" , Sq_Count) else if plot_value == 0 then concat("", Sq_Count) else concat("=", Sq_Count)) ;

Assignbackgroundcolor (if (Sq_Count == 0) then color.current
else if Sq_Count > 11 then color.Dark_red
else color.dark_red);
Author
BenTen
Views
24,011
First release
Last update
Rating
0.00 star(s) 0 ratings

More resources from BenTen

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