Use the box()
functions instead and set the bgcolor as the equivalent of a color fill.
lb = input(30)
hh = highest(high, lb)
ll = lowest(low, lb)
mid = avg(hh, ll)
var box box_up = box.new(left = na, top = na, right = na, bottom = na, border_color = #00000000)
var box box_dn = box.new(left = na, top = na, right = na, bottom = na, border_color = #00000000)
var line l_hh = line.new(x1 = na, y1 = na, x2 = na, y2 = na, color = color.white)
var line l_mid = line.new(x1 = na, y1 = na, x2 = na, y2 = na, color = color.white)
var line l_ll = line.new(x1 = na, y1 = na, x2 = na, y2 = na, color = color.white)
up_col = close > mid ? color.new(color.lime, 30) : #00000000
dn_col = close < mid ? color.new(color.red, 30) : #00000000
box.set_lefttop(box_up, left = bar_index - lb, top = hh)
box.set_rightbottom(box_up, right = bar_index, bottom = mid)
box.set_bgcolor(box_up, color = up_col)
box.set_lefttop(box_dn, left = bar_index - lb, top = mid)
box.set_rightbottom(box_dn, right = bar_index, bottom = ll)
box.set_bgcolor(box_dn, color = dn_col)
line.set_xy1(l_hh, x = bar_index - lb, y = hh)
line.set_xy2(l_hh, x = bar_index, y = hh)
line.set_xy1(l_mid, x = bar_index - lb, y = mid)
line.set_xy2(l_mid, x = bar_index, y = mid)
line.set_xy1(l_ll, x = bar_index - lb, y = ll)
line.set_xy2(l_ll, x = bar_index, y = ll)
With your condition, so as above with up_col
you could do the condition something along the lines of
up_col = hh - ll >= 10 ? color.new(color.lime, 30) : #00000000