Moves a label to a position given as a chart.point, replacing x and y in one value.
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
label.set_point(id: series label, point: chart.point) -> void
label.set_point(point: chart.point) -> voidArguments
| Name | Type | Default | Description |
|---|---|---|---|
| id | series label | required | The label to relocate from a point. Its text, colors and style stay as they were. |
| point | chart. | required | A 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
//@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