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 protegido
Esse script é publicada como código fechado. No entanto, você pode usar ele livremente e sem nenhuma limitação – saiba mais aqui.
Aviso legal
As informações e publicações não devem ser e não constituem conselhos ou recomendações financeiras, de investimento, de negociação ou de qualquer outro tipo, fornecidas ou endossadas pela TradingView. Leia mais em Termos de uso.
Script protegido
Esse script é publicada como código fechado. No entanto, você pode usar ele livremente e sem nenhuma limitação – saiba mais aqui.
Aviso legal
As informações e publicações não devem ser e não constituem conselhos ou recomendações financeiras, de investimento, de negociação ou de qualquer outro tipo, fornecidas ou endossadas pela TradingView. Leia mais em Termos de uso.