anchoredText
Places a text label anchored to a specific bar and price. Ideal for short notes tied to exact candles (entries, exits, confirmations). You can add background, border, and word-wrap so it stays readable over the chart.
Syntax (one line)
anchoredText(time, price, styles?, value?)
Parameters
time (number) · Candle time where the text is anchored (e.g., time(0)).
price (number) · Price level where the text sits (e.g., closeC(0)).
styles (TextLineToolOverrides) · Visual and layout options:
backgroundColor(RGBAColor | BaseColors) · Box fill color behind the text.backgroundTransparency(number) · 0–100 box opacity (higher = lighter).bold(boolean) · Make the text bold.borderColor(RGBAColor | BaseColors) · Border color around the box.color(RGBAColor | BaseColors) · Text color.drawBorder(boolean) · Show a thin border around the box.fillBackground(boolean) · Fill the background area behind the text.fixedSize(boolean) · Keep the on-screen size constant when zooming.fontsize(number) · Font size of the text.italic(boolean) · Make the text italic.wordWrap(boolean) · Wrap long text onto multiple lines.wordWrapWidth(number) · Pixel width used for wrapping whenwordWrapis true.value(string) · The message to display (e.g.,"Breakout").
Return Value
(string) · The drawing ID of the created Anchored Text.
Example
What this does: Every 46 candles, places an anchored text label at the current close with a soft background, thin border, and wrapped message. All visuals live in one const style.
Tips
Use wordWrap + wordWrapWidth to keep multi-line notes tidy and readable.
Choose high-contrast
colorvsbackgroundColorso text stays visible over candles.Set
fixedSize: trueif you want labels to remain the same size while zooming.
Warning
Very long paragraphs can cover price action — keep messages short and increase
backgroundTransparencyif needed.
Good Practice
Keep a few presets (info/warning/checklist) as reusable
const styleobjects.Align your anchored text color scheme with other annotations (notes, callouts) for a consistent look.
Last updated