To understand beta, refer Investopedia link: https://www.investopedia.com/terms/b/bet...
A beta value of 1 means the stock is directly correlated to benchmark index - would be same as overall market.
Beta value less than 1 and greater than 0 means the stock is less volatile than the market.
Beta value more than 1 would mean the stock is more volatile than the market.
A beta value of 1.2 would roughly translate to the stock being 20% more volatile than the overall market.
A negative beta value indicates the stock is inversely correlated to market.
In the example chart, you can see the Beta value change in NSE:RELIANCE with respect to NSE:NIFTY.
In true TradingView spirit, the author of this script has published it open-source, so traders can understand and verify it. Cheers to the author! You may use it for free, but reuse of this code in a publication is governed by House Rules. You can favorite it to use it on a chart.
By the way, I also get another script, which is showing the same result.
a = tickerid
b = input("NIFTY", type=symbol)
as = security(a, period, close)
bs = security(b, period, close)
chg = roc(as, 1)
chgbase = roc(bs, 1)
N = input(252)
chgbasedouble = chgbase * chgbase
sumchgbasedouble = sum( chgbase, N ) * sum( chgbase, N )
beta = (N * sum( chg * chgbase , N ) - sum( chg, N ) * sum( chgbase, N ) ) / ( N * sum( chgbasedouble, N ) - sumchgbasedouble )