I would like to incorporate a 1D RSI into a 4H timeframe. I've tried using resolution or the security functions but these both updated at the candle closure of the daily timeframe and stayed constant until the next day. To get an approximate 20SMA from the 1D chart, I would plot a 120SMA in the 4H chart. It's not the exact same because of the more inputs but it's a bit more precise and more reactive. But if I plot a 1D 14RSI in a 4H chart as an 84RSI I just get a useless indicator floating constantly around the 50 zone.
Is there a way I can get results similar to what I get with the SMA?
//@version=4
study(title="Relative Strength Index", shorttitle="RSI", format=format.price, precision=2, resolution="")
len = input(14, minval=1, title="Length")
src = input(close, "Source", type = input.source)
rma_(src, length) =>
alpha = 1/length
sum = 0.0
sum := na(sum[1]) ? sma(src, length) : alpha * src + (1 - alpha) * nz(sum[1])
rsi_(x, y) =>
u = max(x - x[1], 0)
d = max(x[1] - x, 0)
rs = rma_(u, y) / rma_(d, y)
res = 100 - 100 / (1 + rs)
res
rsi = rsi_(src, len)
plot(rsi, "RSI", color=color.blue, linewidth = 1)
band1 = hline(70, "Upper Band", color=#C0C0C0)
band0 = hline(30, "Lower Band", color=#C0C0C0)
fill(band1, band0, color=#9915FF, transp=90, title="Background")
TIA

