OPEN-SOURCE SCRIPT

Relative Strength Beta-Adjusted

410
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!

免責事項

これらの情報および投稿は、TradingViewが提供または承認する金融、投資、取引、またはその他の種類の助言もしくは推奨であることを意図したものではなく、またこれらに該当するものでもありません。詳細は利用規約をご覧ください。