Im trying to plot the percentage change from previous daily close to current price. Everything works fine, but when a new candle closes the value returns to 0 and only plots the current bar change instead of the daily change. If I refresh the page then its back to normal, until another candle closes.
study("Percent change from daily", precision=2)
a = input(title="Symbol", type=input.symbol, defval="ftx:btcperp")
b = input(title="Resolution", type=input.resolution, defval="D")
c = security(a, b, close)
d = (close - c[1]) / c[1] * 100
plot(d)