mr13

relative strength to SPX500

250
This is the indicators showing the stock relative strength comparing with SPX500.
positive means the stock is strong than spx500
negative means weak than spx500
Open-source script

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.

Disclaimer

The information and publications are not meant to be, and do not constitute, financial, investment, trading, or other types of advice or recommendations supplied or endorsed by TradingView. Read more in the Terms of Use.

Want to use this script on a chart?
study("relative strength to SPX500", shorttitle="mrs") 
a = tickerid 
b = input("FX:SPX500", type=symbol) 
as = security(a, period, (close-close[1])/close[1]*100+100) 
bs = security(b, period, (close-close[1])/close[1]*100+100) 
rs=(as-bs)/bs*1000
plot(rs, title="mrs", color=navy)
len=input(13)
plot(sma(rs, len), color=green)
hline(0, title="Zero", color=gray, linestyle=dashed)
hline(-30, title="down", color=gray, linestyle=dashed)
hline(30, title="up", color=gray, linestyle=dashed)