Sidechair

label.set_point()

Browse the reference

Moves a label to a position given as a chart.point, replacing x and y in one value.

Try it in the editor

A chart.point bundles a bar index, a time and a price. The label reads the index when its xloc is xloc.bar_index and the time when it is xloc.bar_time, then takes the price as y.

It stands in for label.set_xy() in scripts that already pass points around. Build the point with chart.point.new(), chart.point.from_index() or chart.point.now().

Syntax

Pine Script
label.set_point(id: series label, point: chart.point) -> void
label.set_point(point: chart.point) -> void

Arguments

NameTypeDefaultDescription
idseries labelrequiredThe label to relocate from a point. Its text, colors and style stay as they were.
pointchart.pointrequiredA chart.point giving the new position: its index for xloc.bar_index labels, its time for xloc.bar_time labels, and its price.

Returns

Nothing.

Example

Pine ScriptMove a label to the current bar's pointOpen in editor
//@version=6
indicator("label.set_point: from a point", overlay = true)
var label l = label.new(bar_index, high, "p")
label.set_point(l, chart.point.now(high))

See also

Runs on Sidechair