PROTECTED SOURCE SCRIPT
Relative Strength by jsm

1) Compare any stock against an Indian sector/index quickly and clearly.
2) Quickly gauge if your stock is outperforming or lagging its sector.
3) Instant relative strength tracker for Indian stocks & indices.
4) See 30D / 60D / 90D returns vs NIFTY, BANKNIFTY & more.
5) Smart visual tool to spot sector outperformance at a glance.
What it shows
A compact one-line readout (top-right by default):
TICKER vs INDEX | 30D +x.x% ▲ | 60D +y.y% ▼ | 90D +z.z% ▲
- +x.x% → stock return over the past 30 trading days (always uses daily bars).
- Arrow indicates relative performance vs the selected index: green ▲ = stock outperformed, red ▼ = stock underperformed, - = neutral (within tolerance).
- Percent values are shown with one decimal and a leading + for positives (e.g. +3.4%, -1.2%).
How it works
Apply the indicator to the stock chart (bottom chart in a dual-chart layout).
Choose the sector/index to compare from the “Compare with any Indian Index / Sector” dropdown. The indicator immediately calculates:
- Stock % change over 30 / 60 / 90 daily bars
- Index % change over the same periods
- Displays an arrow that reflects stock% − index% (colored only on the arrow to keep the numbers readable).
Inputs
- Pick Sector : preset list of Indian indices/sectors (no free-text by default).
- Box placement : Top/Bottom × Left/Right.
- Box Size : Tiny / Small / Normal / Large / Huge (controls font size).
- Dark Mode : toggles text color for dark/light charts.
- Show 30D / Show 60D / Show 90D : enable/disable individual periods.
- Equality tolerance (%) : small tolerance window to treat values as “equal” (shows neutral symbol).
Behavior & design choices
- Uses daily series for lookbacks (so 30D/60D/90D = 30/60/90 trading days) — works correctly on intraday charts too.
- Arrow only is colored (green/red/gray) for quick visual scanning; numbers remain neutral for readability.
- No intrusive background box by default — flat overlay that blends with your chart.
- Defaults: Bottom-right placement, Normal size, Light mode = off (so dark charts show white text).
Limitations / notes
- Not financial advice — use as a quick comparative visual, not a trade signal.
- The indicator calculates using the preset index symbols; if your broker/data feed lacks a symbol, the cell shows n/a.
- Due to TradingView table rendering, a tiny pixel gap may appear between a percent and its colored arrow (kept minimal on purpose).
Example
On SMSPHARMA chart with NSE:NIFTY selected:
SMSPHARMA vs NIFTY | 30D +13.0% ▲ | 60D +18.5% ▲ | 90D +13.5% ▲
— stock has outperformed NIFTY in all periods.
Script protégé
Ce script est publié en source fermée. Toutefois, vous pouvez l'utiliser librement et sans aucune restriction - en savoir plus ici.
Clause de non-responsabilité
Les informations et les publications ne sont pas destinées à être, et ne constituent pas, des conseils ou des recommandations en matière de finance, d'investissement, de trading ou d'autres types de conseils fournis ou approuvés par TradingView. Pour en savoir plus, consultez les Conditions d'utilisation.
Script protégé
Ce script est publié en source fermée. Toutefois, vous pouvez l'utiliser librement et sans aucune restriction - en savoir plus ici.
Clause de non-responsabilité
Les informations et les publications ne sont pas destinées à être, et ne constituent pas, des conseils ou des recommandations en matière de finance, d'investissement, de trading ou d'autres types de conseils fournis ou approuvés par TradingView. Pour en savoir plus, consultez les Conditions d'utilisation.