OPEN-SOURCE SCRIPT
已更新 Relative Strength Regime Meter (SPY/QQQ/Peer Auto)

RS Dash v2 is a relative strength (RS) dashboard designed to quickly answer one question:
Is this asset leading or lagging vs (1) the market, (2) Nasdaq/growth, and (3) its peer group?
What it measures
For the current chart symbol, it calculates RS ratios:
RS vs SPY (market baseline)
RS vs QQQ (Nasdaq / growth baseline)
RS vs PEER ETF (sector/industry baseline)
RS ratio is simply:
RS = Symbol Close / Benchmark Close
Then it compares each RS ratio to its moving average (MA):
✅ if RS > RS_MA
Optional stricter rule: ✅ only if RS > RS_MA and RS_MA is rising
Peer ETF: Manual or Auto
You can pick the peer ETF in two ways:
MANUAL mode
Choose from labeled options like:
XLK – TECH, XLE – ENERGY, SMH – SEMIS, etc.
AUTO mode (default)
The script selects the peer ETF whose returns have the highest correlation to the symbol over a lookback window, with guardrails:
Min correlation threshold: if correlation is too low, it falls back to your chosen fallback peer.
Sticky switching: it only changes peer when the new best peer is better by a set margin (reduces “flicker”).
The table shows what AUTO picked, and it also prints the correlation as a trust meter.
Dashboard + Score
A table (bottom-left) shows:
SPY ✅/❌
QQQ ✅/❌
PEER ✅/❌ (with chosen peer name)
Total score 0–3
Interpretation:
3/3 = strong leadership (outperforming market + Nasdaq + peers)
2/3 = mixed leadership
0–1/3 = weak / lagging regime
Plot modes (solves scaling issues)
Because raw RS ratios can be on very different numeric scales, there are three plot modes:
Signal (% vs RS MA) (recommended)
Plots each RS as % above/below its RS MA where 0 = neutral.
Indexed (Base 100)
Normalizes each RS to start at 100 so you can compare “performance curves.”
Raw (single)
Shows only one RS ratio at a time (SPY / QQQ / PEER) for inspection.
Leadership line (Regime meter)
The Leadership line is a step line that visualizes the 0–3 score as a regime meter (it only has 4 states, by design). It helps you spot regime shifts without reading the table.
Divergences (optional)
Optional bullish/bearish divergence markers compare price pivots vs RS pivots on your chosen benchmark (SPY/QQQ/PEER). These are confirmation tools, not signals by themselves.
What this indicator is NOT
It does not predict tops/bottoms.
It does not replace fundamentals or risk management.
“AUTO peer” is correlation-based; in unusual regimes it can pick a peer that’s statistically close but not conceptually perfect — override with MANUAL when needed.
Suggested workflow
Keep plot mode on Signal (% vs RS MA)
Use AUTO peer for speed; flip to MANUAL if the chosen peer doesn’t make sense.
Use score changes + divergences as context, then use your main price/volume system for entries/exits.
Open-source, modify as you like.
Shorter description
RS Dash v2 compares the current symbol’s relative strength vs SPY, QQQ, and a Peer ETF (manual or auto-selected).
Each benchmark gets a ✅/❌ based on whether RS > RS_MA (optional: MA rising). The dashboard shows a 0–3 score and a Leadership step line that visualizes regime shifts.
Includes 3 plot modes to fix scaling: Signal (% vs MA), Indexed Base 100, and Raw single. Optional RS divergences.
Settings explanation
RS MA length: smoothing for RS trend. Higher = slower, fewer flips.
Auto return length / correlation lookback: controls how AUTO chooses the peer. Higher = more stable but slower to adapt.
Min corr / switch delta: guardrails to prevent nonsense picks and rapid switching.
Plot mode: choose Signal for decision clarity, Indexed for comparison curves, Raw for inspection.
Blunt “professional honesty” note
Correlation-based peer selection is a statistical best guess, not a fundamental sector classifier. That’s why the indicator is transparent: it shows the selected peer and correlation so users can override.
Is this asset leading or lagging vs (1) the market, (2) Nasdaq/growth, and (3) its peer group?
What it measures
For the current chart symbol, it calculates RS ratios:
RS vs SPY (market baseline)
RS vs QQQ (Nasdaq / growth baseline)
RS vs PEER ETF (sector/industry baseline)
RS ratio is simply:
RS = Symbol Close / Benchmark Close
Then it compares each RS ratio to its moving average (MA):
✅ if RS > RS_MA
Optional stricter rule: ✅ only if RS > RS_MA and RS_MA is rising
Peer ETF: Manual or Auto
You can pick the peer ETF in two ways:
MANUAL mode
Choose from labeled options like:
XLK – TECH, XLE – ENERGY, SMH – SEMIS, etc.
AUTO mode (default)
The script selects the peer ETF whose returns have the highest correlation to the symbol over a lookback window, with guardrails:
Min correlation threshold: if correlation is too low, it falls back to your chosen fallback peer.
Sticky switching: it only changes peer when the new best peer is better by a set margin (reduces “flicker”).
The table shows what AUTO picked, and it also prints the correlation as a trust meter.
Dashboard + Score
A table (bottom-left) shows:
SPY ✅/❌
QQQ ✅/❌
PEER ✅/❌ (with chosen peer name)
Total score 0–3
Interpretation:
3/3 = strong leadership (outperforming market + Nasdaq + peers)
2/3 = mixed leadership
0–1/3 = weak / lagging regime
Plot modes (solves scaling issues)
Because raw RS ratios can be on very different numeric scales, there are three plot modes:
Signal (% vs RS MA) (recommended)
Plots each RS as % above/below its RS MA where 0 = neutral.
Indexed (Base 100)
Normalizes each RS to start at 100 so you can compare “performance curves.”
Raw (single)
Shows only one RS ratio at a time (SPY / QQQ / PEER) for inspection.
Leadership line (Regime meter)
The Leadership line is a step line that visualizes the 0–3 score as a regime meter (it only has 4 states, by design). It helps you spot regime shifts without reading the table.
Divergences (optional)
Optional bullish/bearish divergence markers compare price pivots vs RS pivots on your chosen benchmark (SPY/QQQ/PEER). These are confirmation tools, not signals by themselves.
What this indicator is NOT
It does not predict tops/bottoms.
It does not replace fundamentals or risk management.
“AUTO peer” is correlation-based; in unusual regimes it can pick a peer that’s statistically close but not conceptually perfect — override with MANUAL when needed.
Suggested workflow
Keep plot mode on Signal (% vs RS MA)
Use AUTO peer for speed; flip to MANUAL if the chosen peer doesn’t make sense.
Use score changes + divergences as context, then use your main price/volume system for entries/exits.
Open-source, modify as you like.
Shorter description
RS Dash v2 compares the current symbol’s relative strength vs SPY, QQQ, and a Peer ETF (manual or auto-selected).
Each benchmark gets a ✅/❌ based on whether RS > RS_MA (optional: MA rising). The dashboard shows a 0–3 score and a Leadership step line that visualizes regime shifts.
Includes 3 plot modes to fix scaling: Signal (% vs MA), Indexed Base 100, and Raw single. Optional RS divergences.
Settings explanation
RS MA length: smoothing for RS trend. Higher = slower, fewer flips.
Auto return length / correlation lookback: controls how AUTO chooses the peer. Higher = more stable but slower to adapt.
Min corr / switch delta: guardrails to prevent nonsense picks and rapid switching.
Plot mode: choose Signal for decision clarity, Indexed for comparison curves, Raw for inspection.
Blunt “professional honesty” note
Correlation-based peer selection is a statistical best guess, not a fundamental sector classifier. That’s why the indicator is transparent: it shows the selected peer and correlation so users can override.
版本注释
# RS Window Returns - Multi-Benchmark Relative Strength RegimeA relative-strength (RS) regime indicator that combines rolling RS returns, trend structure, acceleration, persistence, normalization, and multi-benchmark confirmation.
The goal is simple:
**Is the symbol showing real leadership, or just bouncing?**
## Key Features
### Two RS Modes
**Ratio Chart Close**
* Use on ratio charts such as `BOAT/SPY`, `NVDA/QQQ`, or `HIMS/XBI`.
* Reads the chart ratio directly.
**Symbol / Benchmarks**
* Use on normal stock or ETF charts.
* Calculates RS versus:
* SPY (market)
* QQQ (growth/risk-on)
* User-selected peer benchmark
### True Weekly RS
Optional weekly aggregation keeps RS windows consistent across timeframes:
* RS 6
* RS 13
* RS 20
* RS 26
Can use either:
* Live weekly values (updates during the week)
* Last confirmed weekly close
### RS Regime Engine
Measures:
* Rolling RS returns
* Log-return acceleration
* 20/40 RS trend structure
* Persistence above trend
* Percentile rank
* Z-score normalization
### RS Score (0-100)
Weighted score based on:
* Trend
* Returns
* Acceleration
* Persistence
* Normalization
Typical interpretation:
* **80+** Strong Leader
* **65-79** Leader
* **50-64** Improving / Mixed
* **35-49** Weak / Mixed
* **<35** Laggard
### Multi-Benchmark Confirmation
Evaluates leadership versus:
* SPY
* QQQ
* Peer benchmark
Evidence:
* **0/3** No confirmation
* **1/3** Isolated strength
* **2/3** Confirmed strength
* **3/3** Broad leadership
### Built-In Safety Checks
* Warns when using the wrong chart mode.
* Detects invalid peer benchmarks.
* Excludes peer comparisons when the peer equals the chart symbol.
## RS States
* Strong Leader
* Leader
* Fresh Rotation
* Leader Pullback
* Fading Leader
* Laggard Bounce
* Structural Laggard
* Neutral / Mixed
## Event Markers
Core markers:
* **START** – Early RS improvement
* **CONF** – Leadership confirmed
* **FADE** – Leadership weakening
* **BRK** – RS breakdown
Optional advanced markers:
* New RS highs
* Multi-benchmark confirmations
* Peer confirmations
* Multi-benchmark fades
## Recommended Use
For most users:
* Mode: **Symbol / Benchmarks**
* Market Benchmark: **SPY**
* Growth Benchmark: **QQQ**
* Peer Benchmark: Matching sector/theme ETF
* True Weekly Calculation: **ON**
Examples:
* SMH = Semiconductors
* XBI = Biotech
* XLK = Technology
* XLE = Energy
* XLF = Financials
* XLI = Industrials
* IYT = Transports
## Best Use Cases
* Finding market leaders
* Identifying early rotations
* Separating leadership from weak bounces
* Comparing symbols against market, growth, and sector benchmarks
* Monitoring whether leadership is broad or isolated
## Important
This is **not** a buy/sell system.
Relative strength should be used alongside price structure, trend, volume, and risk management.
**Price first. Relative strength second. Sector confirmation third.**
Not financial advice.
开源脚本
秉承TradingView的精神,该脚本的作者将其开源,以便交易者可以查看和验证其功能。向作者致敬!您可以免费使用该脚本,但请记住,重新发布代码须遵守我们的网站规则。
Researching companies, industries & charts with custom indicators. This is not financial advice.
免责声明
这些信息和出版物并非旨在提供,也不构成TradingView提供或认可的任何形式的财务、投资、交易或其他类型的建议或推荐。请阅读使用条款了解更多信息。
开源脚本
秉承TradingView的精神,该脚本的作者将其开源,以便交易者可以查看和验证其功能。向作者致敬!您可以免费使用该脚本,但请记住,重新发布代码须遵守我们的网站规则。
Researching companies, industries & charts with custom indicators. This is not financial advice.
免责声明
这些信息和出版物并非旨在提供,也不构成TradingView提供或认可的任何形式的财务、投资、交易或其他类型的建议或推荐。请阅读使用条款了解更多信息。