Relocates the start of a line to a new bar and price in one call.
It replaces a line.set_x1() plus line.set_y1() pair. Use it when an anchor jumps to a new pivot, so the whole start moves and the other end stays.
The other end is untouched, so the slope and any extension change with the jump. A na line is left alone.
Syntax
line.set_xy1(id: series line, x: series int, y: series int/float) -> void
line.set_xy1(x: series int, y: series int/float) -> voidArguments
| Name | Type | Default | Description |
|---|---|---|---|
| id | series line | required | The line whose first point jumps to a new bar and price. |
| x | series int | required | Bar index, or millisecond timestamp on a bar_time line, of the new first point. |
| y | series int/ | required | Price of the new first point, in chart price units. |
Returns
Nothing.
Example
//@version=6
indicator("line.set_xy1: re-anchor", overlay = true)
pl = ta.pivotlow(low, 5, 5)
var line ln = line.new(bar_index, close, bar_index + 1, close, extend = extend.right)
if not na(pl)
line.set_xy1(ln, bar_index - 5, pl)
line.set_xy2(ln, bar_index, close)See also
Runs on Sidechair