# Rainbow MA Stack

Rainbow MA Stack is an indicator on [Vela](https://vela.luxalgo.com/chart), our next-generation charting platform, written in Pine Script®.

Rainbow MA Stack draws up to ten moving averages as one gradient-colored band, defaulting to Widner's recursive construction where each line re-smooths the previous with a 2-period average. A dashboard tracks full bullish or bearish alignment, band width percentile-ranked over 200 bars with 10%/90% compression and expansion extremes, and price's place in the band, with seven stack alerts.

- Indicator in the LuxAlgo Library, by LuxAlgo, published Jun 8, 2026.
- Access: free.
- Concepts: [Rainbow MA Stack](https://www.luxalgo.com/library/concept/rainbow-ma-stack/) (primary)
- Open on Vela: https://vela.luxalgo.com/chart?pineScriptCodeId=xd3ij2fz37ja8a8mjb0tu2f9
- Page: https://www.luxalgo.com/library/indicator/rainbow-ma-stack/

**Rainbow MA Stack** plots a family of moving averages as a single hot-to-cold gradient band, then quantifies the band's geometry. It ships the [rainbow MA stack](https://www.luxalgo.com/library/concept/rainbow-ma-stack/) in its original recursive construction by default: line 1 is a 2-period simple average of price and every further line re-smooths the previous line, so inner lines hug price while outer ones carry progressively longer lag. Stepped and Fibonacci-spaced lookbacks are the alternatives; the stack always stays one family.

## How to Trade the Rainbow MA Stack?

- **Full bullish stack**: every adjacent pair in length order, shortest on top, all horizons pulling the same way in an established uptrend. The bearish stack mirrors it.
- **Braiding lines**: full alignment lost (consolidation conditions, with its own alert).
- **Knotted band**: width at or below the 10th percentile of its 200-bar history flags compression, breakout setup bars; the 90th marks full expansion.
- **Price closing through the whole band**: decisive either way, each direction with an alert.

A dashboard summarizes alignment, width percentile, and price's place in the band.

## Rainbow MA Stack Settings

- **Construction** (default Recursive (Widner)): recursive re-smoothing, Stepped Lengths, or Fibonacci Lengths.
- **Number of Lines** (default 10): fewer reads crossings clearly, more renders compression smoothly.
- **Source** (default close) and **Recursive Smoothing Length** (default 2): the recursion's per-step average.
- **Average Family** (default SMA): SMA, EMA, or VWMA for the stepped modes; the recursive mode is SMA-of-SMA by definition.
- **Shortest Length** (default 10) and **Step** (default 10): the classic 10-through-100 set.
- **Width Rank Lookback** (default 200) with **Compression Threshold %** (default 10) and **Expansion Threshold %** (default 90).
- Style and dashboard inputs cover the palette stops, ribbon fill, line width, and placement.

## Frequently Asked Questions

### How does this differ from the Coral Trend?

The [Coral Trend](https://www.luxalgo.com/library/indicator/coral-trend/) compresses heavy smoothing into one adaptive line with a color state, a single verdict. The rainbow keeps every horizon visible, so agreement forms and fails in view: richer context, busier chart.

### Which construction should I use?

Recursive is the published original: each line smooths the previous line rather than price, a tight, orderly cascade. Stepped lengths sample independent horizons; Fibonacci spacing concentrates resolution at the fast end.

### What makes the compression read adaptive?

Band width is measured as a share of price, then percentile-ranked against its own recent history. Knotted and fanned are defined by each market's own geometry, not fixed width numbers.

## Related indicators

- [Trend Regularity Adaptive Moving Average](https://www.luxalgo.com/library/indicator/trend-regularity-adaptive-moving-average/) (TRAMA): markdown at https://www.luxalgo.com/library/indicator/trend-regularity-adaptive-moving-average.md
- [Machine Learning Moving Average](https://www.luxalgo.com/library/indicator/machine-learning-moving-average/) (Adaptive-lookback MA): markdown at https://www.luxalgo.com/library/indicator/machine-learning-moving-average.md
- [ZLEMA](https://www.luxalgo.com/library/indicator/zlema/) (Trend): markdown at https://www.luxalgo.com/library/indicator/zlema.md
- [Moving Average Converging](https://www.luxalgo.com/library/indicator/moving-average-converging/) (EMA): markdown at https://www.luxalgo.com/library/indicator/moving-average-converging.md
- [MLMA](https://www.luxalgo.com/library/indicator/mlma/) (Trend): markdown at https://www.luxalgo.com/library/indicator/mlma.md
- [Volume-adjusted MA](https://www.luxalgo.com/library/indicator/volume-adjusted-ma/) (Trend): markdown at https://www.luxalgo.com/library/indicator/volume-adjusted-ma.md
- [JMA](https://www.luxalgo.com/library/indicator/jma/) (Trend): markdown at https://www.luxalgo.com/library/indicator/jma.md
- [T3](https://www.luxalgo.com/library/indicator/t3/) (Trend): markdown at https://www.luxalgo.com/library/indicator/t3.md

---

Source: https://www.luxalgo.com/library/indicator/rainbow-ma-stack/ (LuxAlgo Library). Free to use with attribution: https://www.luxalgo.com/library/license/
