Recolors the shaded band between a fill's two lines without touching the lines.
Only the fill changes; the lines keep their own colors. Use color.new(c, transparency) so the candles stay visible beneath the band.
Recolor it per bar to show state, such as green when the last close is above the band's midpoint and red when below.
Syntax
linefill.set_color(id: series linefill, color: series color) -> void
linefill.set_color(color: series color) -> voidArguments
| Name | Type | Default | Description |
|---|---|---|---|
| id | series linefill | required | The linefill to recolor; the colors of its two bounding lines do not change. |
| color | series color | required | New fill color. The transparency inside color.new() decides how much of the chart shows through the band. |
Returns
Nothing.
Example
//@version=6
indicator("linefill.set_color: direction", overlay = true)
var linefill f = na
if barstate.islast
f := linefill.new(line.new(bar_index - 20, high, bar_index, high), line.new(bar_index - 20, low, bar_index, low), color.gray)
linefill.set_color(f, close > open ? color.new(color.green, 85) : color.new(color.red, 85))See also
Runs on Sidechair