OPEN-SOURCE SCRIPT

Relative Strength and Momentum

Mis à jour
Relative Strength and Momentum Indicator

Unlock deeper market insights with the Relative Strength and Momentum Indicator—a powerful tool designed to help traders and investors identify the strongest stocks and sectors based on relative performance. This custom indicator displays essential information on relative strength and momentum for up to 15 different symbols, compared against a benchmark index, all within a clear and organized table format.

Key Features:

1. Customizable Inputs: Choose up to 15 symbols to compare, along with a benchmark index, allowing you to tailor the indicator to your trading strategy. The 'Lookback Period' input defines how many weeks of data are analyzed for relative strength and momentum.

2. Relative Strength Calculation: For each selected symbol, the indicator calculates the Relative Strength (RS) against the chosen benchmark. This RS is further refined using an exponential moving average (EMA) to smooth the results, providing a more stable trend overview.

3. Momentum Analysis: Momentum is determined by analyzing the rate of change in relative strength. The indicator calculates a momentum rank for each symbol, based on its relative strength’s improvement or deterioration.

4. Percentile Ranking System: Each symbol is assigned a percentile rank (from 1 to 100) based on its relative strength compared to the others. Similarly, momentum rankings are also assigned from 1 to 100, offering a clear understanding of which assets are outperforming or underperforming.

5. Visual Indicators:
a. Green: Signals improving or stable relative strength and momentum.
b. Red: Indicates declining relative strength or momentum.
c. Aqua: Highlights symbols performing well on both relative strength and momentum—ideal candidates for further analysis.

6. Two Clear Tables:
a. Relative Strength Rank Table: Displays weekly rankings of relative strength for each symbol.

b. Momentum Table: Shows momentum trends, helping you identify which symbols are gaining or losing strength.

7. Color-Coded for Easy Analysis: The tables are color-coded to make analysis quick and straightforward. A green color means the symbol is performing well in terms of relative strength or momentum, while red indicates weaker performance. Aqua marks symbols that are excelling in both areas.

Use Case:
a. Sector Comparison: Identify which sectors or indexes are showing both relative strength and momentum to pick high-potential stocks. This allows you to align with broader market trends for improved trade entries.

b. Stock Selection: Quickly compare symbols within the same sector to find the stronger performers.
Notes de version
Avoid displaying ticker information for the benchmark index.
Notes de version

  • The script now supports all time periods.
  • Removed specific references to "Week" as the script has been updated to work across all time frames.
Notes de version
Bug Fix.
Notes de version
Updated the code to display RS and Momentum data for 20 symbols, an increase from the previous limit of 15.
Notes de version
Bug Fix.
Notes de version
Bug Fix.
Notes de version
Previously, the script assigned a percentile rank to each symbol by evaluating its performance in comparison to other symbols. This approach caused abrupt spikes in the percentile rank when a symbol performed exceptionally well for a single week, creating a misleading impression that the symbol had started outperforming consistently.

The current update uses a Weighted Moving Average (WMA) to smooth the percentile rank values. While the percentile rank is still calculated in the same way, the final rank is now smoothed using WMA. This change ensures:

  1. A single week of exceptional performance will not cause a dramatic spike in the rank.
  2. The use of WMA gives more weight to recent performance, meaning if a symbol continues to outperform over consecutive bars, it will still quickly achieve an improved ranking.
indexanalysisMomentum Indicator (MOM)momentumindicatormomentumtradingrelativestrengthRelative Strength Comparisonsector_analysissectorrotationstrengthandweaknessswingtradingTrend Analysis

Script open-source

Dans le plus pur esprit TradingView, l'auteur de ce script l'a publié en open-source, afin que les traders puissent le comprendre et le vérifier. Bravo à l'auteur! Vous pouvez l'utiliser gratuitement, mais la réutilisation de ce code dans une publication est régie par nos Règles. Vous pouvez le mettre en favori pour l'utiliser sur un graphique.

Vous voulez utiliser ce script sur un graphique ?

Clause de non-responsabilité