indicator · own pane · open source
Beta
Running…
Loading chart…
About
Beta here is the ratio of the bar-to-bar price change covariance to the rolling price variance — a single-instrument serial sensitivity number.
- Beta > 1 = today's move amplified the prior bar (momentum continuation).
- Beta < 1 = today's move dampened the prior bar (mean-reversion tendency).
- Use alongside a market benchmark input for true market beta.
Source code
//@version=5
indicator("Beta", overlay=false)
len = input.int(20, "Lookback", minval=2, maxval=252)
src = input.source("close", "Source")
cov = ta.cum(ta.change(src) * ta.change(src)[1]) / len
var1 = math.pow(ta.stdev(src, len), 2)
beta = cov / var1
hline(1, "Parity", color=color.gray)
p_Beta = plot(beta, "Beta", color=color.purple, linewidth=2)
No comments yet.
Sign in to comment.