OPEN-SOURCE SCRIPT
Telah dikemas kini Relative Strength Table

Relative Strength Table
1. Overview and Key Features
The Relative Strength Table is an indicator that compares multiple tickers against a benchmark (default: SPY) and displays their relative strength.
It is designed to help analyze stock leadership, sector trends, and portfolio performance in one consolidated table.
You can freely input up to 20 tickers from the Inputs panel, allowing flexible comparisons.
(If 20 tickers feel too limited, let me know in the comments — I’ll expand it.)
2. How the RS Percentile Is Calculated and What It Means
The RS Percentile shows how strong the current price ratio is compared to past data, expressed as a percentile rank.
First, the indicator calculates the price ratio by dividing the ticker’s close by the benchmark’s close.
Then, it compares the latest ratio with historical ratio data and determines its percentile value.
Examples:
・80% or higher → relatively strong
・Around 50% → neutral
・40% or below → relatively weak
3. Indicator Features and Customization
3-1. RS Lookback Settings
You can set up to four lookback periods for RS calculation and customize the bar count for each.
Default values are 5, 21, 63, and 126 bars.
You can choose which column to sort by, and the selected column is marked with an asterisk.
Each RS column can be shown or hidden individually via checkboxes.
3-2. Visual Highlight Settings
Relative strength can be color-coded for clarity.
You can freely customize:
・Highlight colors
・Threshold values
・On/off toggles for each highlight layer
3-3. Default Tickers and Reset Function
These 16 sector ETFs are included as the default ticker set:
QQQ, QQQE, RSP, DIA, IWM, XLV, XLE, XLF, XLRE, XLB, XLP, XLU, XLY, XLK, XLC, XLI
You can return to the default list anytime by pressing the refresh button next to the ticker fields.
4. Use Cases and Analysis Examples
4-1. Sector Rotation Analysis
By comparing RS across multiple periods, you can easily identify:
・Sectors gaining short-term strength
・Sectors with steady long-term inflows
A sharp rise in short-term RS may signal the early stages of a rotation.
4-2. Identifying Leaders Within a Sector
You can compare up to 20 tickers at once, making it easy to spot true sector leaders.
4-3. Objective Evaluation of Portfolio Holdings
By entering your portfolio tickers, you can instantly see:
・Whether each name is outperforming or underperforming
・Which timeframes show strength
・How each ticker compares to the benchmark
1. Overview and Key Features
The Relative Strength Table is an indicator that compares multiple tickers against a benchmark (default: SPY) and displays their relative strength.
It is designed to help analyze stock leadership, sector trends, and portfolio performance in one consolidated table.
You can freely input up to 20 tickers from the Inputs panel, allowing flexible comparisons.
(If 20 tickers feel too limited, let me know in the comments — I’ll expand it.)
2. How the RS Percentile Is Calculated and What It Means
The RS Percentile shows how strong the current price ratio is compared to past data, expressed as a percentile rank.
First, the indicator calculates the price ratio by dividing the ticker’s close by the benchmark’s close.
Then, it compares the latest ratio with historical ratio data and determines its percentile value.
Examples:
・80% or higher → relatively strong
・Around 50% → neutral
・40% or below → relatively weak
3. Indicator Features and Customization
3-1. RS Lookback Settings
You can set up to four lookback periods for RS calculation and customize the bar count for each.
Default values are 5, 21, 63, and 126 bars.
You can choose which column to sort by, and the selected column is marked with an asterisk.
Each RS column can be shown or hidden individually via checkboxes.
3-2. Visual Highlight Settings
Relative strength can be color-coded for clarity.
You can freely customize:
・Highlight colors
・Threshold values
・On/off toggles for each highlight layer
3-3. Default Tickers and Reset Function
These 16 sector ETFs are included as the default ticker set:
QQQ, QQQE, RSP, DIA, IWM, XLV, XLE, XLF, XLRE, XLB, XLP, XLU, XLY, XLK, XLC, XLI
You can return to the default list anytime by pressing the refresh button next to the ticker fields.
4. Use Cases and Analysis Examples
4-1. Sector Rotation Analysis
By comparing RS across multiple periods, you can easily identify:
・Sectors gaining short-term strength
・Sectors with steady long-term inflows
A sharp rise in short-term RS may signal the early stages of a rotation.
4-2. Identifying Leaders Within a Sector
You can compare up to 20 tickers at once, making it easy to spot true sector leaders.
4-3. Objective Evaluation of Portfolio Holdings
By entering your portfolio tickers, you can instantly see:
・Whether each name is outperforming or underperforming
・Which timeframes show strength
・How each ticker compares to the benchmark
Nota Keluaran
Updated to Pine Script version 6.Skrip sumber terbuka
In true TradingView spirit, the creator of this script has made it open-source, so that traders can review and verify its functionality. Kudos to the author! While you can use it for free, remember that republishing the code is subject to our House Rules.
Penafian
The information and publications are not meant to be, and do not constitute, financial, investment, trading, or other types of advice or recommendations supplied or endorsed by TradingView. Read more in the Terms of Use.
Skrip sumber terbuka
In true TradingView spirit, the creator of this script has made it open-source, so that traders can review and verify its functionality. Kudos to the author! While you can use it for free, remember that republishing the code is subject to our House Rules.
Penafian
The information and publications are not meant to be, and do not constitute, financial, investment, trading, or other types of advice or recommendations supplied or endorsed by TradingView. Read more in the Terms of Use.