OPEN-SOURCE SCRIPT
Relative Strength Beta-Adjusted

BETA-ADJUSTED RELATIVE STRENGTH INDICATOR
This indicator removes broad market influence from a stock's returns to reveal its true, standalone performance over time.
WHAT IT TRACKS:
• Idiosyncratic Return (True RS): The portion of a stock's daily return that cannot be explained by its Beta exposure to the benchmark.
• Cumulative RS Line: A running total of these residual returns, starting at 100, showing the stock's pure alpha trend.
HOW IT WORKS:
The indicator calculates a rolling Beta between your chart symbol and a benchmark (default: SPY), then computes the "expected return" — what the stock should have done based on market movement alone. The difference between the actual return and expected return is the idiosyncratic return. These residuals are accumulated bar by bar into a cumulative line, with a moving average overlay (EMA or SMA).
When the RS line is above the MA, the area fills to indicate positive alpha momentum. When below, the fill shifts to signal deteriorating stock-specific strength.
SETTINGS:
• Benchmark Symbol: Index or ETF to measure against (default: SPY)
• Beta Length: Rolling window for Beta calculation (default: 60)
• MA Type: EMA or SMA (default: EMA)
• MA Length: Smoothing period for the moving average (default: 21)
• Colors: Fully customizable RS line, MA line, and fill colors
USAGE:
Use this to separate genuine stock performance from market noise. A rising line means the stock is generating real alpha. A falling line means it is underperforming what its market sensitivity alone would predict.
The MA crossover helps identify shifts in alpha momentum:
• RS above MA: Stock-specific strength is trending positive — favorable for long positions
• RS below MA: Stock-specific strength is fading — exercise caution or look elsewhere
• Rising line in a falling market: Stock is holding up on its own merits despite broad weakness
• Falling line in a rising market: Stock is being masked by market tailwinds — underlying weakness present
Other potential uses to explore:
• Stock picking: Find stocks generating genuine alpha versus those simply riding a bull market
• Rotation signals: Spot turning points in true relative strength before they show on the price chart
• Sector comparison: Apply to sector ETFs to identify fundamental leaders versus laggers
• Risk management: Reduce exposure when the RS line rolls over, even if price looks stable
• Pair analysis: Compare RS lines across related stocks to find the strongest name in a group
• Other Markets: Such as Crypto Markets set Bitcoin as the benchmark and any altcoin as the chart symbol to measure true relative performance against BTC — useful for identifying altcoins generating genuine strength versus those simply following Bitcoin's momentum
Experiment with different Beta lengths and MA settings to match your trading timeframe and style.
If you discover effective ways to use this indicator, please share in the comments below — your insights could help other traders!
This indicator removes broad market influence from a stock's returns to reveal its true, standalone performance over time.
WHAT IT TRACKS:
• Idiosyncratic Return (True RS): The portion of a stock's daily return that cannot be explained by its Beta exposure to the benchmark.
• Cumulative RS Line: A running total of these residual returns, starting at 100, showing the stock's pure alpha trend.
HOW IT WORKS:
The indicator calculates a rolling Beta between your chart symbol and a benchmark (default: SPY), then computes the "expected return" — what the stock should have done based on market movement alone. The difference between the actual return and expected return is the idiosyncratic return. These residuals are accumulated bar by bar into a cumulative line, with a moving average overlay (EMA or SMA).
When the RS line is above the MA, the area fills to indicate positive alpha momentum. When below, the fill shifts to signal deteriorating stock-specific strength.
SETTINGS:
• Benchmark Symbol: Index or ETF to measure against (default: SPY)
• Beta Length: Rolling window for Beta calculation (default: 60)
• MA Type: EMA or SMA (default: EMA)
• MA Length: Smoothing period for the moving average (default: 21)
• Colors: Fully customizable RS line, MA line, and fill colors
USAGE:
Use this to separate genuine stock performance from market noise. A rising line means the stock is generating real alpha. A falling line means it is underperforming what its market sensitivity alone would predict.
The MA crossover helps identify shifts in alpha momentum:
• RS above MA: Stock-specific strength is trending positive — favorable for long positions
• RS below MA: Stock-specific strength is fading — exercise caution or look elsewhere
• Rising line in a falling market: Stock is holding up on its own merits despite broad weakness
• Falling line in a rising market: Stock is being masked by market tailwinds — underlying weakness present
Other potential uses to explore:
• Stock picking: Find stocks generating genuine alpha versus those simply riding a bull market
• Rotation signals: Spot turning points in true relative strength before they show on the price chart
• Sector comparison: Apply to sector ETFs to identify fundamental leaders versus laggers
• Risk management: Reduce exposure when the RS line rolls over, even if price looks stable
• Pair analysis: Compare RS lines across related stocks to find the strongest name in a group
• Other Markets: Such as Crypto Markets set Bitcoin as the benchmark and any altcoin as the chart symbol to measure true relative performance against BTC — useful for identifying altcoins generating genuine strength versus those simply following Bitcoin's momentum
Experiment with different Beta lengths and MA settings to match your trading timeframe and style.
If you discover effective ways to use this indicator, please share in the comments below — your insights could help other traders!
오픈 소스 스크립트
트레이딩뷰의 진정한 정신에 따라, 이 스크립트의 작성자는 이를 오픈소스로 공개하여 트레이더들이 기능을 검토하고 검증할 수 있도록 했습니다. 작성자에게 찬사를 보냅니다! 이 코드는 무료로 사용할 수 있지만, 코드를 재게시하는 경우 하우스 룰이 적용된다는 점을 기억하세요.
면책사항
해당 정보와 게시물은 금융, 투자, 트레이딩 또는 기타 유형의 조언이나 권장 사항으로 간주되지 않으며, 트레이딩뷰에서 제공하거나 보증하는 것이 아닙니다. 자세한 내용은 이용 약관을 참조하세요.
오픈 소스 스크립트
트레이딩뷰의 진정한 정신에 따라, 이 스크립트의 작성자는 이를 오픈소스로 공개하여 트레이더들이 기능을 검토하고 검증할 수 있도록 했습니다. 작성자에게 찬사를 보냅니다! 이 코드는 무료로 사용할 수 있지만, 코드를 재게시하는 경우 하우스 룰이 적용된다는 점을 기억하세요.
면책사항
해당 정보와 게시물은 금융, 투자, 트레이딩 또는 기타 유형의 조언이나 권장 사항으로 간주되지 않으며, 트레이딩뷰에서 제공하거나 보증하는 것이 아닙니다. 자세한 내용은 이용 약관을 참조하세요.