AddLabel(visibility option, your text, color);
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
# # 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 LoungeLabels with symbol [source]
## TICK Label AddLabel(1, "$TIKI =" + close(Symbol = "$TIKI")); def c = close(Symbol = "vix"); ## vix difference Label AddLabel(1, "VIX diff =" + (c - c)); ## 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
############ 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);