Concept

Rainbow Oscillator

Rainbow Oscillator is a Momentum & Oscillators concept.

What is the Rainbow Oscillator?

The Rainbow Oscillator condenses a rainbow chart, a stack of recursively smoothed moving averages, into a single bounded line. The underlying rainbow is built by taking a 2-period simple moving average of price, then a 2-period average of that result, and repeating until ten lines exist, each smoother and slower than the last. The oscillator measures where the close sits relative to the average of those ten lines, normalized by the recent price range, and is usually plotted alongside a bandwidth line that tracks how far apart the highest and lowest rainbow lines have spread. The construction was introduced by Mel Widner in the late 1990s.

The idea is consensus: each recursive average represents the market's level at a slightly longer memory, and when price runs ahead of the whole stack the oscillator swings positive, while price collapsing under the stack swings it negative. The companion bandwidth reading adds a second dimension that most single-line oscillators lack: tightly bundled rainbow lines mean the trend consensus has compressed, a condition that often precedes larger moves, while widely fanned lines mark a mature, stretched trend.

In practice the two lines are read as a pair. The oscillator's sign says whether the close sits above or below the rainbow consensus, and sustained one-sided readings accompany trends. The bandwidth line supplies context: a narrowing band is the rainbow-chart equivalent of a coiling range, expansion out of compression while the oscillator breaks away from zero often marks the start of a directional leg, and a stretched oscillator reading with flattening bandwidth argues the move is aging rather than strengthening.

As with any construction built entirely from nested averages, the oscillator is a lagging summary of recent price. Its scale, roughly plus or minus 100 in the standard normalization, depends on the range lookback, and readings near the extremes describe displacement from the consensus rather than any fixed probability of reversal.

How it's calculated

Ten recursive 2-period averages form the rainbow; displacement and spread are both normalized by the recent close range.

r1 = SMA(close, 2)
r_k = SMA(r_(k-1), 2) for k = 2 to 10
rainbow_avg = (r1 + r2 + ... + r10) / 10
oscillator = 100 * (close - rainbow_avg) / (highest(close, n) - lowest(close, n))
bandwidth = 100 * (max(r1..r10) - min(r1..r10)) / (highest(close, n) - lowest(close, n))
SMA: simple moving average
r_k: the k-th recursive rainbow line
n: range lookback (commonly 10)
highest/lowest(close, n): highest and lowest close over the last n bars

Implementations vary in the range lookback and in whether highs and lows or closes define the normalizing range; scales shift accordingly.

How traders use it

  • As a trend-consensus gauge: staying with longs while the oscillator holds positive and the ten averages remain stacked in order, a role similar to reading a moving-average ribbon.
  • As a volatility-cycle timer: bandwidth compression flags coiled conditions, and traders stage entries for the expansion rather than trading the compressed chop itself.
  • As a fade tool in ranges: with bandwidth flat and low, oscillator swings toward its extremes are faded back toward zero, accepting that the same swings must not be faded once bandwidth starts expanding.
  • For divergence reading at trend extremes, where price makes a new high but the oscillator posts a lower peak, best treated as a warning that needs structural confirmation like any divergence.
  • With the standard caveat that ten layers of smoothing plus range normalization make it a describing tool: it tells you the state of the consensus, always a few bars after the fact.

Rainbow Oscillator vs related stacks

Rainbow MA stack: The stack is the price-panel form: ten lines read by their ordering and fanning. The oscillator compresses the same information into displacement and bandwidth numbers that are easier to threshold and backtest.

Guppy GMMA: Guppy's multiple moving averages use two groups of independently parameterized EMAs to compare trader and investor behavior. The rainbow uses one recursive chain, so its lines are mathematically nested rather than independently chosen.

Rahul Mohindar Oscillator: The RMO starts from the same nested 2-period averaging trick but adds heavy exponential smoothing and a crossover signal system. The Rainbow Oscillator stays closer to the raw consensus and adds the bandwidth dimension instead.

Concept family

Momentum & Oscillators

91 concepts mapped · 91 in the Library

Rainbow Oscillator FAQ

What does the bandwidth line on the Rainbow Oscillator measure?

The spread between the highest and lowest of the ten rainbow averages, normalized by the recent price range. Low bandwidth means the averages have converged, which often precedes a directional expansion; high bandwidth marks a stretched, mature trend.

Is the Rainbow Oscillator bounded?

Approximately. The normalization keeps typical readings within about plus or minus 100, but because the divisor is the recent range rather than a hard bound, unusual bars can push readings beyond it.

How many periods does the Rainbow Oscillator use?

The rainbow itself is fixed at ten recursive 2-period averages in the standard form; the main tunable is the range lookback, commonly 10 bars. Changing the recursion depth changes the character of the consensus.

Should I trade zero-line crosses of the Rainbow Oscillator?

Only with the bandwidth context. Zero crosses during low, flat bandwidth are range noise; crosses that coincide with bandwidth turning up out of compression have historically been the more meaningful subset, though no subset is reliable on its own.

Build Rainbow Oscillator your way.

Quant writes, tests, and refines it with you — then it runs on LuxAlgo charting or ports to TradingView.