OPEN-SOURCE SCRIPT
RS Rating Multi-Timeframe MAs

RS Rating Multi-Timeframe MAs
A relative strength rating indicator that measures how a stock performs against a benchmark index (default: S&P 500), displayed as a 1-99 rating with five customizable multi-timeframe moving averages for trend analysis and crossover signals.
What is RS Rating?
The RS (Relative Strength) Rating compares a stock's price performance to a benchmark index over four weighted time periods:
63 days (1 quarter) — 40% weight
126 days (2 quarters) — 20% weight
189 days (3 quarters) — 20% weight
252 days (1 year) — 20% weight
The raw relative strength score is then converted to a 1-99 rating scale, where higher values indicate stronger outperformance versus the benchmark.
Rating Zones
90-99 (Elite): Exceptional relative strength, top performers
80-89 (Strong): Solid outperformance, institutional quality
50-79 (Neutral): Average performance relative to benchmark
30-49 (Weak): Underperforming the market
1-29 (Laggard): Significant underperformance
Multi-Timeframe Moving Averages
This indicator includes five fully customizable moving averages, each operating on its own timeframe:
MADefault TimeframeDefault LengthPurposeMA11 Hour5Fastest, short-term momentumMA24 Hour5Intraday trendMA3Daily10Swing trade referenceMA4Weekly4Intermediate trendMA5Monthly3Long-term trend, slowest
Each MA can be configured with:
Custom timeframe
Custom length
SMA or EMA calculation
Individual color
Crossover Signals
Select two MA pairs to monitor for crossover signals:
Cross Pair 1: Triangles (lime up / red down)
Cross Pair 2: Circles (aqua up / orange down)
Common configurations:
MA1/MA2 for fast scalp signals
MA2/MA3 for swing entries
MA3/MA4 for trend confirmation
MA4/MA5 for major trend changes
Stack Alignment
When all five MAs align in order (fastest to slowest), the background highlights the trend:
Green background: Bullish stack (MA1 > MA2 > MA3 > MA4 > MA5)
Red background: Bearish stack (MA1 < MA2 < MA3 < MA4 < MA5)
This identifies strong trending conditions where momentum aligns across all timeframes.
Information Table
The top-right table displays:
Current RS Rating with color coding
Trend status (Bullish / Bearish / Mixed)
All five MA values
Whether RS Rating is above (▲) or below (▼) each MA
Raw RS score for reference
Alerts
Cross Pair 1 Bullish/Bearish
Cross Pair 2 Bullish/Bearish
Bullish Stack Alignment
Bearish Stack Alignment
RS Above 80
RS Below 30
How to Use
Trend Following: Look for stocks with RS Rating above 80 and bullish MA stack alignment
Pullback Entries: When RS Rating pulls back to a rising MA3 (daily) in an uptrend
Trend Reversals: Watch for MA crossovers combined with RS Rating crossing key thresholds (80/30)
Avoid Laggards: Stocks with RS below 30 and bearish stack alignment are underperforming
Settings
Benchmark Index: Change the comparison index (default: SP:SPX)
MA 1-5: Configure timeframe, length, type, and color for each moving average
Signal Pairs: Select which MA pairs trigger crossover signals
Display Options: Toggle table and individual MAs on/off
Credits
Based on the IBD Relative Strength Rating methodology with multi-timeframe MA enhancements for active traders.
A relative strength rating indicator that measures how a stock performs against a benchmark index (default: S&P 500), displayed as a 1-99 rating with five customizable multi-timeframe moving averages for trend analysis and crossover signals.
What is RS Rating?
The RS (Relative Strength) Rating compares a stock's price performance to a benchmark index over four weighted time periods:
63 days (1 quarter) — 40% weight
126 days (2 quarters) — 20% weight
189 days (3 quarters) — 20% weight
252 days (1 year) — 20% weight
The raw relative strength score is then converted to a 1-99 rating scale, where higher values indicate stronger outperformance versus the benchmark.
Rating Zones
90-99 (Elite): Exceptional relative strength, top performers
80-89 (Strong): Solid outperformance, institutional quality
50-79 (Neutral): Average performance relative to benchmark
30-49 (Weak): Underperforming the market
1-29 (Laggard): Significant underperformance
Multi-Timeframe Moving Averages
This indicator includes five fully customizable moving averages, each operating on its own timeframe:
MADefault TimeframeDefault LengthPurposeMA11 Hour5Fastest, short-term momentumMA24 Hour5Intraday trendMA3Daily10Swing trade referenceMA4Weekly4Intermediate trendMA5Monthly3Long-term trend, slowest
Each MA can be configured with:
Custom timeframe
Custom length
SMA or EMA calculation
Individual color
Crossover Signals
Select two MA pairs to monitor for crossover signals:
Cross Pair 1: Triangles (lime up / red down)
Cross Pair 2: Circles (aqua up / orange down)
Common configurations:
MA1/MA2 for fast scalp signals
MA2/MA3 for swing entries
MA3/MA4 for trend confirmation
MA4/MA5 for major trend changes
Stack Alignment
When all five MAs align in order (fastest to slowest), the background highlights the trend:
Green background: Bullish stack (MA1 > MA2 > MA3 > MA4 > MA5)
Red background: Bearish stack (MA1 < MA2 < MA3 < MA4 < MA5)
This identifies strong trending conditions where momentum aligns across all timeframes.
Information Table
The top-right table displays:
Current RS Rating with color coding
Trend status (Bullish / Bearish / Mixed)
All five MA values
Whether RS Rating is above (▲) or below (▼) each MA
Raw RS score for reference
Alerts
Cross Pair 1 Bullish/Bearish
Cross Pair 2 Bullish/Bearish
Bullish Stack Alignment
Bearish Stack Alignment
RS Above 80
RS Below 30
How to Use
Trend Following: Look for stocks with RS Rating above 80 and bullish MA stack alignment
Pullback Entries: When RS Rating pulls back to a rising MA3 (daily) in an uptrend
Trend Reversals: Watch for MA crossovers combined with RS Rating crossing key thresholds (80/30)
Avoid Laggards: Stocks with RS below 30 and bearish stack alignment are underperforming
Settings
Benchmark Index: Change the comparison index (default: SP:SPX)
MA 1-5: Configure timeframe, length, type, and color for each moving average
Signal Pairs: Select which MA pairs trigger crossover signals
Display Options: Toggle table and individual MAs on/off
Credits
Based on the IBD Relative Strength Rating methodology with multi-timeframe MA enhancements for active traders.
Mã nguồn mở
Theo đúng tinh thần TradingView, tác giả của tập lệnh này đã công bố nó dưới dạng mã nguồn mở, để các nhà giao dịch có thể xem xét và xác minh chức năng. Chúc mừng tác giả! Mặc dù bạn có thể sử dụng miễn phí, hãy nhớ rằng việc công bố lại mã phải tuân theo Nội quy.
Thông báo miễn trừ trách nhiệm
Thông tin và các ấn phẩm này không nhằm mục đích, và không cấu thành, lời khuyên hoặc khuyến nghị về tài chính, đầu tư, giao dịch hay các loại khác do TradingView cung cấp hoặc xác nhận. Đọc thêm tại Điều khoản Sử dụng.
Mã nguồn mở
Theo đúng tinh thần TradingView, tác giả của tập lệnh này đã công bố nó dưới dạng mã nguồn mở, để các nhà giao dịch có thể xem xét và xác minh chức năng. Chúc mừng tác giả! Mặc dù bạn có thể sử dụng miễn phí, hãy nhớ rằng việc công bố lại mã phải tuân theo Nội quy.
Thông báo miễn trừ trách nhiệm
Thông tin và các ấn phẩm này không nhằm mục đích, và không cấu thành, lời khuyên hoặc khuyến nghị về tài chính, đầu tư, giao dịch hay các loại khác do TradingView cung cấp hoặc xác nhận. Đọc thêm tại Điều khoản Sử dụng.