I've altered the built-in RSI code to add a background of green when above the 50 midpoint, and add a background of red when below the 50 midpoint (background is overlay-ed on the chart, not in a pane).
Additionally, I've set the indicator to the 1 hour time frame, rather than same as chart
. However, when I'm viewing time frames shorter than 1 hour, the background appears as vertical lines, rather than a solid background.
Is it possible to have the background appear as one solid color in this case?
CODE
//@version=4
study(title=Relative Strength Index
, shorttitle=RSI
, overlay=true, format=format.price, precision=2, resolution=")
Length
len = input(14, minval=1, title=)
Source", type = input.source)
src = input(close,
up = rma(max(change(src), 0), len)
down = rma(-min(change(src), 0), len)
rsi = down == 0 ? 100 : up == 0 ? 0 : 100 - (100 / (1 + up / down))
long=rsi>50
short=rsi<50
bgcolor(long ? color.green : color.red, transp=75)