Sidechair

line.set_y1()

Browse the reference

Moves only the starting price of a line, up or down.

Try it in the editor

The bar of the first point stays, so the line tilts around its second point. An extended line swings as a whole, because its slope changes.

line.get_price() at the second x is unchanged by the call, while the price at the first x becomes the new value.

Syntax

Pine Script
line.set_y1(id: series line, y: series int/float) -> void
line.set_y1(y: series int/float) -> void

Arguments

NameTypeDefaultDescription
idseries linerequiredThe line whose first price changes while its bars stay where they are.
yseries int/floatrequiredNew price for the first point, in chart price units. An int works too; na stops the line drawing.

Returns

Nothing.

Remarks

  • On Sidechair: an int is accepted for the price, and na stops the line drawing until a number is set.

Example

Pine ScriptTilt a ray by moving its start priceOpen in editor
//@version=6
indicator("line.set_y1: tilt a ray", overlay = true)
if barstate.islast
    ln = line.new(bar_index - 20, close[20], bar_index, close, extend = extend.right, color = color.purple)
    line.set_y1(ln, ta.lowest(low, 20))

See also

Runs on Sidechair