Sidechair

line.set_first_point()

Browse the reference

Replaces the start of a line with a chart.point, bar and price together.

Try it in the editor

A chart.point carries a bar index, a time and a price, so one value moves the start on both axes. Build it with chart.point.new(), chart.point.from_index() or chart.point.from_time().

It is the point-based counterpart of line.set_xy1(), handy when swing points are stored as chart.point values.

Syntax

Pine Script
line.set_first_point(id: series line, point: chart.point) -> void
line.set_first_point(point: chart.point) -> void

Arguments

NameTypeDefaultDescription
idseries linerequiredThe line whose first end is replaced by the point.
pointchart.pointrequiredA chart.point carrying the new index or time and the price for the first end.

Returns

Nothing.

Example

Pine ScriptAnchor a line at a pointOpen in editor
//@version=6
indicator("line.set_first_point: anchor", overlay = true)
var line ln = line.new(bar_index, close, bar_index + 1, close)
line.set_first_point(ln, chart.point.from_index(bar_index - 10, low))

See also

Runs on Sidechair