mgoblue33
mgoblue33

Reputation: 97

fill background color between 2 lines.new in pinescript

I am trying to fill the background color between these 2 lines and I am getting the following error messages:

line 104: Syntax error at input 'bullEngulfLow'.

I am using the following code.

if barstate.islastconfirmedhistory
    fillColor = switch
    bullEngulfOpen > bullEngulfLow => color.green
    => color.silver
linefill.new(bullEngulfOpen, bullEngulfLow, color.new(fillColor, 90))

bullEngulfOpen := line.new(bar_index - 1, resopen[1], bar_index, resopen[1], extend=extend.right, color=color.black)
bullEngulfLow := line.new(bar_index - 1, bullEngulfLowPrice, bar_index, bullEngulfLowPrice, extend=extend.right, color=#01ff00)

How do I fill the background color between these 2 lines?

Upvotes: 0

Views: 4958

Answers (1)

beeholder
beeholder

Reputation: 1699

The fill() function can only fill the space between plots or hlines. If you want to fill space between lines created via line.new(), you need to use the functions in the linefill.* namespace, more info here.

Upvotes: 2

Related Questions