OPEN-SOURCE SCRIPT

RS/Correlation Panel

158
**RS/Correlation Panel**

A single-table dashboard that benchmarks the current chart's symbol against any reference ticker you choose (SPY, QQQ, BTC, or any other symbol) across multiple timeframes — correlation, today's relative performance, short-term relative strength, and a longer IBD-style relative strength rating — plus historical daily move statistics for the symbol itself.

**Inputs**
- **Benchmark Ticker** — the symbol to compare against. Defaults to SPY, but accepts any ticker (QQQ, individual stocks, or crypto via its exchange prefix, e.g. COINBASE:BTCUSD).
- **Correlation Lookback (bars)** — number of bars used for the rolling correlation calculation. Default 20.
- **Daily Stats Lookback (days)** — number of trading days used to calculate average rise/fall and green/red day percentages. Default 60.
- **Short-Term RS/RW Lookback (bars)** — the window used for the medium-term relative strength/weakness reading, sitting between the 1-day and quarterly reads. Default 10.
- **Table Position** — corner of the chart where the table is displayed.

**Table Rows**

- **Correlation** — rolling correlation coefficient between the symbol and the benchmark over the chosen lookback, tagged Strong / Moderate / Weak based on absolute value.
- **Symbol's Today's Move / Benchmark's Today's Move** — each instrument's current-session percent change, calculated from that day's open to the live/last close.
- **RS/RW Today** — the difference between the symbol's and benchmark's daily percent change. Positive means the symbol is outperforming the benchmark today; negative means it's underperforming.
- **N-Bar RS/RW** — the same outperformance/underperformance concept, but measured as the difference in rate-of-change over the user-defined short-term lookback (default 10 bars). This fills the gap between a single day's move and a full quarterly trend.
- **IBD-Style RS** — a quarterly-weighted relative strength calculation modeled on the classic IBD Relative Strength methodology: the symbol's and benchmark's trailing performance are each computed across four rolling quarters (weighted 40/20/20/20, most recent quarter weighted heaviest), then compared as a percentage difference. This is a slower-moving, trend-level strength read — it won't react much to a single day's move, by design.
- **Avg % Rise / Fall** — average percentage gain on up days and average percentage loss on down days, calculated over the Daily Stats Lookback period.
- **Green Days % / Red Days %** — percentage of days in the lookback period that closed up versus down.

**Notes**
- All relative-strength and correlation metrics reference the same user-selected benchmark, so switching the input updates every row consistently.
- The IBD-Style RS calculation is a reproduction of the standard quarterly-weighted RS methodology and is intended to complement — not replace — short-term price action analysis.
- This is a decision-support tool, not a standalone trading signal. Always confirm readings against price structure, volume, and catalysts before acting.

Wyłączenie odpowiedzialności

Informacje i publikacje nie stanowią i nie powinny być traktowane jako porady finansowe, inwestycyjne, tradingowe ani jakiekolwiek inne rekomendacje dostarczane lub zatwierdzone przez TradingView. Więcej informacji znajduje się w Warunkach użytkowania.