Reference
Lines
Line segments between two points.
line.copy(id)
A copy of the line.
Returns: line
| Parameter | Type |
|---|---|
id | line |
line.delete(id)
Removes the line.
Returns: nothing
| Parameter | Type |
|---|---|
id | line |
line.get_price(id, x)
The line's price at bar x.
Returns: a number
| Parameter | Type |
|---|---|
id | line |
x | num |
line.get_x1(id)
First point x.
Returns: a whole number
| Parameter | Type |
|---|---|
id | line |
line.get_x2(id)
Second point x.
Returns: a whole number
| Parameter | Type |
|---|---|
id | line |
line.get_y1(id)
First point y.
Returns: a number
| Parameter | Type |
|---|---|
id | line |
line.get_y2(id)
Second point y.
Returns: a number
| Parameter | Type |
|---|---|
id | line |
line.new(x1, y1, x2, y2, xloc="bar_index", extend="none", color=na, style="solid", width=1)
Creates a line and returns its id.
Returns: line
| Parameter | Type | Notes |
|---|---|---|
x1 | num | |
y1 | num | |
x2 | num | |
y2 | num | |
xloc | string | Default "bar_index" |
extend | string | Default "none" |
color | color | Default na |
style | string | Default "solid" |
width | int | Default 1 |
line.set_color(id, color)
Changes the color.
Returns: nothing
| Parameter | Type |
|---|---|
id | line |
color | color |
line.set_extend(id, extend)
Extends the line left, right, both or none.
Returns: nothing
| Parameter | Type |
|---|---|
id | line |
extend | string |
line.set_style(id, style)
Changes the style.
Returns: nothing
| Parameter | Type |
|---|---|
id | line |
style | string |
line.set_width(id, width)
Changes the width.
Returns: nothing
| Parameter | Type |
|---|---|
id | line |
width | int |
line.set_x1(id, x)
Moves the first point horizontally.
Returns: nothing
| Parameter | Type |
|---|---|
id | line |
x | num |
line.set_x2(id, x)
Moves the second point horizontally.
Returns: nothing
| Parameter | Type |
|---|---|
id | line |
x | num |
line.set_xloc(id, x1, x2, xloc)
Changes x1, x2 and how they are read.
Returns: nothing
| Parameter | Type |
|---|---|
id | line |
x1 | num |
x2 | num |
xloc | string |
line.set_xy1(id, x, y)
Moves the first point.
Returns: nothing
| Parameter | Type |
|---|---|
id | line |
x | num |
y | num |
line.set_xy2(id, x, y)
Moves the second point.
Returns: nothing
| Parameter | Type |
|---|---|
id | line |
x | num |
y | num |
line.set_y1(id, y)
Moves the first point vertically.
Returns: nothing
| Parameter | Type |
|---|---|
id | line |
y | num |
line.set_y2(id, y)
Moves the second point vertically.
Returns: nothing
| Parameter | Type |
|---|---|
id | line |
y | num |
Education only. Not financial advice. Examples are teaching samples, not trading results.
