Sidechair

label.set_size()

Browse the reference

Changes the size of a label's text, and of its marker when the style is a shape.

Try it in the editor

Pick from size.tiny, size.small, size.normal, size.large, size.huge or size.auto. The label box grows or shrinks with the text, and a shape style grows with it.

size.auto lets the chart choose a size to suit its zoom level. Stepping through sizes by a count or a score is a quick way to make a label show strength.

Syntax

Pine Script
label.set_size(id: series label, size: series int/string) -> void
label.set_size(size: series int/string) -> void

Arguments

NameTypeDefaultDescription
idseries labelrequiredThe label whose text size changes. Its position and colors stay the same.
sizeseries int/stringrequiredsize.tiny, size.small, size.normal, size.large, size.huge or size.auto. Larger sizes grow the box and any shape marker.

Returns

Nothing.

Remarks

  • On Sidechair: tiny to huge draw text at 9, 10, 12, 15 and 19 px and shape markers at 6, 9, 13, 20 and 28 px. size.auto draws text at 11 px, and a plain number is read as size.normal.

Example

Pine ScriptSize steps up with each consecutive up closeOpen in editor
//@version=6
indicator("label.set_size: up-run", overlay = true)
var label l = label.new(bar_index, high, "run")
var int run = 0
run := close > close[1] ? run + 1 : 0
label.set_xy(l, bar_index, high)
label.set_text(l, str.tostring(run))
label.set_size(l, run >= 4 ? size.huge : run >= 2 ? size.large : size.small)

See also

Runs on Sidechair