PROTECTED SOURCE SCRIPT
ATR Adjusted Relative Strength Line

Introduction:
This indicator visualizes the relative strength of a stock versus its benchmark index using ATR-adjusted price changes. It highlights moments when the stock is outperforming or underperforming its benchmark, while also detecting early signs of strength before price follows.
Key Features:
Cumulative ATR-Adjusted Relative Strength: Tracks ongoing outperformance relative to the benchmark over time.
Cumulative & Smoothed: Optionally apply cumulative smoothing to detect trends over longer periods.
Indicator EMA: Shows a moving average of the relative strength for trend confirmation.
New High Detection:
Green Circles: Stock’s relative strength hits a new high, but price hasn’t yet followed.
Pink Circles: Relative strength leads price, signaling potential early breakout opportunities.
Cloud Visualization: The area between the indicator and its EMA is shaded to quickly see bullish (lime) and bearish (red) momentum.
Zero Line Reference: Helps identify when relative strength crosses from negative to positive.
Automatic Benchmark Selection: Picks an index based on the exchange (e.g., DFMGI for DFM stocks, FADGI for ADX) or allows manual selection.
Real-Time Labels: Displays the current benchmark and early signals directly on the chart.
Calculation:
1. Stock and Benchmark Price Changes
The indicator first calculates the change in the stock’s price for each period (daily, hourly, etc.).
You can choose whether to use simple price differences or log returns (percentage-like growth).
The same calculation is done for the benchmark index (auto-selected based on the stock’s exchange or manually chosen).
2. Adjust for Volatility (ATR)
The period-to-period price changes are divided by the Average True Range (ATR) of the stock and the benchmark, respectively.
This normalization step makes changes comparable, regardless of how volatile the stock or index is.
For example, a $1 move in a calm stock is more significant than a $1 move in a very volatile stock.
3. Compute Relative Strength
For each period, the indicator subtracts the benchmark’s ATR-adjusted change from the stock’s ATR-adjusted change.
Positive values indicate the stock is outperforming its benchmark in that period; negative values indicate underperformance.
4. Cumulative Summation
Each period’s relative strength is added to the previous periods’ total.
This makes the indicator cumulative, showing whether the stock has been consistently outperforming or underperforming over time, rather than just in a single period.
Use Cases:
Spot stocks that are outperforming their index before the price confirms.
Confirm trend strength using the EMA and cloud.
Detect potential early breakout opportunities with “RS leads price” signals.
Ideal For: Swing traders, momentum traders, and anyone looking to track stock strength relative to the market in real time.
This indicator visualizes the relative strength of a stock versus its benchmark index using ATR-adjusted price changes. It highlights moments when the stock is outperforming or underperforming its benchmark, while also detecting early signs of strength before price follows.
Key Features:
Cumulative ATR-Adjusted Relative Strength: Tracks ongoing outperformance relative to the benchmark over time.
Cumulative & Smoothed: Optionally apply cumulative smoothing to detect trends over longer periods.
Indicator EMA: Shows a moving average of the relative strength for trend confirmation.
New High Detection:
Green Circles: Stock’s relative strength hits a new high, but price hasn’t yet followed.
Pink Circles: Relative strength leads price, signaling potential early breakout opportunities.
Cloud Visualization: The area between the indicator and its EMA is shaded to quickly see bullish (lime) and bearish (red) momentum.
Zero Line Reference: Helps identify when relative strength crosses from negative to positive.
Automatic Benchmark Selection: Picks an index based on the exchange (e.g., DFMGI for DFM stocks, FADGI for ADX) or allows manual selection.
Real-Time Labels: Displays the current benchmark and early signals directly on the chart.
Calculation:
1. Stock and Benchmark Price Changes
The indicator first calculates the change in the stock’s price for each period (daily, hourly, etc.).
You can choose whether to use simple price differences or log returns (percentage-like growth).
The same calculation is done for the benchmark index (auto-selected based on the stock’s exchange or manually chosen).
2. Adjust for Volatility (ATR)
The period-to-period price changes are divided by the Average True Range (ATR) of the stock and the benchmark, respectively.
This normalization step makes changes comparable, regardless of how volatile the stock or index is.
For example, a $1 move in a calm stock is more significant than a $1 move in a very volatile stock.
3. Compute Relative Strength
For each period, the indicator subtracts the benchmark’s ATR-adjusted change from the stock’s ATR-adjusted change.
Positive values indicate the stock is outperforming its benchmark in that period; negative values indicate underperformance.
4. Cumulative Summation
Each period’s relative strength is added to the previous periods’ total.
This makes the indicator cumulative, showing whether the stock has been consistently outperforming or underperforming over time, rather than just in a single period.
Use Cases:
Spot stocks that are outperforming their index before the price confirms.
Confirm trend strength using the EMA and cloud.
Detect potential early breakout opportunities with “RS leads price” signals.
Ideal For: Swing traders, momentum traders, and anyone looking to track stock strength relative to the market in real time.
Skrip dilindungi
Skrip ini diterbitkan sebagai sumber tertutup. Akan tetapi, anda boleh menggunakannya secara bebas dan tanpa apa-apa had – ketahui lebih di sini.
Penafian
Maklumat dan penerbitan adalah tidak bertujuan, dan tidak membentuk, nasihat atau cadangan kewangan, pelaburan, dagangan atau jenis lain yang diberikan atau disahkan oleh TradingView. Baca lebih dalam Terma Penggunaan.
Skrip dilindungi
Skrip ini diterbitkan sebagai sumber tertutup. Akan tetapi, anda boleh menggunakannya secara bebas dan tanpa apa-apa had – ketahui lebih di sini.
Penafian
Maklumat dan penerbitan adalah tidak bertujuan, dan tidak membentuk, nasihat atau cadangan kewangan, pelaburan, dagangan atau jenis lain yang diberikan atau disahkan oleh TradingView. Baca lebih dalam Terma Penggunaan.