Sidechair

linefill.new()

Browse the reference

Shades the area between two existing lines and returns the fill object.

Try it in the editor

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

Pine Script
linefill.new(line1: series line, line2: series line, color: series color) -> series linefill

Arguments

NameTypeDefaultDescription
line1series linerequiredOne edge of the band. It must be a live line when the fill is created; line.delete() on it later removes the fill too.
line2series linerequiredThe opposite edge of the band. The fill follows both lines, so editing either one reshapes the shading.
colorseries colorrequiredFill 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

Pine ScriptFill between a high line and a low line, both extended rightOpen in editor
//@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