Moves only the starting price of a line, up or down.
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
line.set_y1(id: series line, y: series int/float) -> void
line.set_y1(y: series int/float) -> voidArguments
| Name | Type | Default | Description |
|---|---|---|---|
| id | series line | required | The line whose first price changes while its bars stay where they are. |
| y | series int/ | required | New 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
//@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