Appearance
linefill
How do you shade the space between two lines? Call linefill.new with both lines and a colour. The fill follows the lines wherever they move, and goes when either line is deleted.
pine
//@version=6
indicator("50-bar channel", overlay = true)
hi = ta.highest(high, 50)
lo = ta.lowest(low, 50)
var line top = line.new(na, na, na, na, color = color.green)
var line bot = line.new(na, na, na, na, color = color.green)
if barstate.isfirst
// Made once: moving the lines moves the fill.
linefill.new(top, bot, color.new(color.green, 85))
if barstate.islast
line.set_xy1(top, bar_index - 49, hi)
line.set_xy2(top, bar_index, hi)
line.set_xy1(bot, bar_index - 49, lo)
line.set_xy2(bot, bar_index, lo)A linefill made on the same two lines as a live one, in either order, replaces it. One whose line was deleted, or that was replaced or deleted itself, leaves the chart and linefill.all, and its getters read na. A line the line count takes leaves its linefill in place.
linefill.new
pine
linefill.new(line1, line2, color) → series linefillFills the space between two lines, and returns the fill's handle.
| Parameter | Description |
|---|---|
line1series line | The first line. |
line2series line | The second line. |
colorseries color | The fill's colour. |
linefill.get_line1
pine
linefill.get_line1(id) → series lineAlso a method: id.get_line1().
The fill's first line.
| Parameter | Description |
|---|---|
idseries linefill | The linefill. |
linefill.get_line2
pine
linefill.get_line2(id) → series lineAlso a method: id.get_line2().
The fill's second line.
| Parameter | Description |
|---|---|
idseries linefill | The linefill. |
linefill.set_color
pine
linefill.set_color(id, color) → voidAlso a method: id.set_color(color).
Sets the fill's colour.
| Parameter | Description |
|---|---|
idseries linefill | The linefill. |
colorseries color | The colour. |
linefill.delete
pine
linefill.delete(id) → voidAlso a method: id.delete().
Takes the fill off the chart and out of linefill.all. The lines stay.
| Parameter | Description |
|---|---|
idseries linefill | The linefill. |
linefill.all
pine
array<linefill> linefill.allAn array of every linefill the script has on the chart, oldest first.