Shades the area between two existing lines and returns the fill object.
linefill.new(l1, l2, color.new(color.blue, 85)) paints the band between the two lines. The color argument is required, and a transparent one keeps the candles readable underneath.
The fill reads the current end points of both lines, so moving a line with line.set_xy2() reshapes the band while the lines remain independent objects.
Syntax
linefill.new(line1: series line, line2: series line, color: series color) -> series linefillArguments
| Name | Type | Default | Description |
|---|---|---|---|
| line1 | series line | required | One edge of the band. It must be a live line when the fill is created; line.delete() on it later removes the fill too. |
| line2 | series line | required | The opposite edge of the band. The fill follows both lines, so editing either one reshapes the shading. |
| color | series color | required | Fill color between the two lines. A transparency from color.new(c, 85) lets candles show through; an opaque color hides them. |
Returns
series linefill: The new linefill.
Example
//@version=6
indicator("linefill.new: channel fill", overlay = true)
if barstate.islast
upper = line.new(bar_index - 40, high[40], bar_index, high, extend = extend.right)
lower = line.new(bar_index - 40, low[40], bar_index, low, extend = extend.right)
linefill.new(upper, lower, color.new(color.teal, 85))See also
Runs on Sidechair