OPEN-SOURCE SCRIPT

Rainbow MA Width

76
█ OVERVIEW
Rainbow MA Width is a companion indicator for Rainbow MA Cloud. It displays ribbon width as a normalized Z-Score, allowing traders to visualize trend momentum expansion and contraction relative to recent history.


█ CONCEPTS
Z-Score Normalization:
Rather than displaying raw width values (which vary by asset and timeframe),
this indicator normalizes the ribbon width using Z-Score calculation:

Z-Score = (Current Width - Average Width) / Standard Deviation

Z-Score Interpretation:
• 0 = Average width (mean)
• +1 to +2 = Expanding (above average, strong trend)
• -1 to -2 = Contracting (below average, weakening trend)
• Beyond ±2 = Extreme (statistical outlier, potential reversal)

Width Calculation Modes:
• Outer — Distance between fastest and slowest MA: |MA1 - MA8|
• Average Gap — Mean of all adjacent MA gaps
• Total Gap — Sum of all adjacent MA gaps


█ FEATURES
1 — Width Mode Selection
Three methods to calculate ribbon width.
"Outer" recommended for aligned trends.

2 — Z-Score Period
Configurable lookback for mean and standard deviation.
Default 20 bars; increase for smoother, less reactive readings.

3 — Zone Fill Coloring
Cyan fill when expanding (Z > 0).
Orange fill when contracting (Z < 0).
Yellow fill for extreme values (|Z| > 2) as warning.

4 — Alignment Background
Green background during bullish alignment.
Red background during bearish alignment.
Synced with Rainbow MA Cloud for consistency.

5 — Reference Lines
Horizontal lines at 0 (mean), ±1σ, and ±2σ levels.
Provides clear visual boundaries for interpretation.

6 — Raw Width Display
Optional secondary line showing original width percentage.
Useful for comparing normalized vs absolute values.


█ HOW TO USE
Trend Confirmation:
• Z-Score rising above 0 confirms trend acceleration
• Z-Score staying above +1 indicates sustained strong momentum
• Use alongside alignment background for confluence

Reversal Warning:
• Z-Score exceeding +2 suggests overextension (yellow warning zone)
• Z-Score dropping below -2 indicates extreme contraction
• Extreme readings often precede trend reversals or consolidation

Entry Timing:
• Enter trends when Z-Score crosses above 0 (expansion beginning)
• Avoid entries when Z-Score is at extreme highs (potential exhaustion)
• Consider exits when Z-Score peaks and begins declining


█ LIMITATIONS
• Z-Score is relative to lookback period; different periods give different readings
• Extreme zones (±2) are statistical guides, not guarantees
• Best used in conjunction with Rainbow MA Cloud for full context


█ ALERTS
Four built-in alert conditions:
• Z-Score crosses above/below zero
• Z-Score enters extreme high/low zones (±2)

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.