arrow
The arrow method places a custom arrow at a specific time and price. Unlike arrowUp or arrowDown, this one uses the BasicLineToolOverrides style, which gives you extended display options like showing ranges, labels, or angle stats. It’s useful when you want a more detailed annotation rather than just a simple marker.
Syntax (one line)
arrow(time, price, styles?, text?)
Parameters
time (number) · Candle time where the arrow is placed (e.g., time(0) for current bar).
price (number) · Price level where the arrow is anchored (e.g., closeC(0)).
styles (BasicLineToolOverrides) · Extended visual and label options:
alwaysShowStats(boolean) · Always display the measurement stats box.bold(boolean) · Make text bold.extendLeft(boolean) · Extend the arrow line to the left.extendRight(boolean) · Extend the arrow line to the right.fontsize(number) · Font size for labels.horzLabelsAlign(string) · Align labels horizontally.italic(boolean) · Italicize text.leftEnd(number) · Control position of left endpoint.linecolor(RGBAColor | BaseColors) · Line/arrow color.linestyle(number) · Line style (0=solid, 1=dotted, 2=dashed…).linewidth(number) · Thickness of the arrow line.rightEnd(number) · Control position of right endpoint.showAngle(boolean) · Show angle stats on the line.showBarsRange(boolean) · Show the number of bars covered.showDateTimeRange(boolean) · Show the datetime range covered.showDistance(boolean) · Show the distance value.showLabel(boolean) · Display a text label.showMiddlePoint(boolean) · Mark the midpoint of the line.showPercentPriceRange(boolean) · Display price change in %.showPipsPriceRange(boolean) · Display price change in pips.showPriceLabels(boolean) · Show labels for price points.showPriceRange(boolean) · Display absolute price change.statsPosition(number) · Position of the stats box.textcolor(RGBAColor | BaseColors) · Text color.vertLabelsAlign(string) · Align labels vertically.text(string) · Optional label text next to the arrow.
Return Value
(string) · The drawing ID of the created arrow.
Example
What this does: Every 50 candles, it places a blue arrow at the current close, shows a label, and enables range stats.
Tips
Enable
showPriceRange+showDateTimeRangefor a quick read on both size and duration of a move.Use
alwaysShowStatsto keep information visible, even when the arrow isn’t selected.
Warning
Overusing too many stats (price, % change, pips, distance, etc.) at once can clutter the chart. Pick only what you need.
Good Practice
Keep consistent color coding (e.g., blue arrows for notes, green/red for directional arrows) to make annotations clear.
Store style presets in a
const stylefor reusability across your scripts.
Last updated