Composite & famousRainbow Oscillator
Mel Widner's oscillator measuring price against a fan of recursively smoothed moving averages.
Works in most conditionsEngine-computed on a fixed sample series
What it is
The Rainbow Oscillator, created by Mel Widner, measures how far price sits above or below a fan of moving averages — each one a moving average of the one before it — that together form a colorful, layered band nicknamed the rainbow. It answers the question of both a trend's direction and its strength in a single reading, by comparing price to the center of that band and normalizing the result by the market's recent range. When price leads the rainbow to the upside the oscillator is positive, and when it lags to the downside it is negative, with the further from zero the stronger the move. Widner introduced it alongside a companion rainbow-bandwidth measure that flags overextension. For a beginner it is best pictured as a smoothed, multi-layered moving-average envelope whose relationship to price is distilled into one momentum line.
How it is calculated
The rainbow is built by recursive smoothing — the first moving average is a short, typically 2-period, simple moving average of price, the second is a 2-period average of the first, the third an average of the second, and so on up to about ten layers deep, so each successive average is smoother and slower than the last. The oscillator then plots how far the current price is from the average of all those rainbow layers, and normalizes that distance by the recent high-low range, multiplying by 100, so it reflects both direction and trend strength on a comparable scale. A companion measure, the rainbow bandwidth, tracks the spread between the highest and lowest rainbow layers relative to the same range, widening in strong trends and narrowing as they stall. The recursive construction is what gives the tool its characteristic depth and its lag. The default depth is around ten averages built on a 2-period recursion.
Reading it, step by step
Positive oscillator values mean price is leading the rainbow to the upside, a bullish momentum read, and negative values mean it is leading to the downside, with distance from zero measuring the strength of the move. Zero-line crossings mark momentum shifts, as price moves from below the rainbow's center to above it or vice versa. The width of the underlying rainbow band adds a second layer of information: it widens in strong, well-established trends and narrows as a move loses energy and stalls, giving a read on trend maturity. Because the extremes are measured relative to the recent range rather than fixed levels, a reading must be judged in context rather than against a universal overbought or oversold line. A large positive oscillator with a widening band signals a strong, healthy uptrend, while a shrinking band warns the trend is tiring.
Best timeframes and settings
The default of about ten recursively smoothed 2-period averages is Widner's original and works across daily and intraday charts, though the deep smoothing biases it toward swing and position use rather than fast scalping. Increasing the depth or the base averaging length makes the rainbow smoother and the oscillator slower and more lagging, while reducing them makes it more responsive but choppier. The trade-off is the familiar one between a smooth, reliable read that turns late and a responsive one that whipsaws. Because the oscillator normalizes by recent range, the length of that range window also affects how its extremes scale. Most users keep the standard depth and read the tool for its shape and band behavior rather than fine-tuning the internals.
When and where to use it
The Rainbow Oscillator is regime-flexible, useful for gauging both momentum direction via zero-line crosses and trend strength and maturity via the band width, across equities, futures, and forex. It suits trend-following and swing contexts where its smoothed read helps filter noise, and the bandwidth read helps judge whether a move is overextended and vulnerable. In fast, choppy markets its lag becomes a liability, so it is better on cleaner, trending instruments and higher timeframes. Avoid treating its extremes as fixed reversal levels, since they are relative to recent range. Reach for it when you want a single tool that combines a momentum read with a sense of how mature and stretched the underlying trend is.
Strategies that use it
The core strategy trades zero-line crossovers for momentum shifts, going long as the oscillator crosses up through zero and short as it crosses down, ideally filtered by the direction of the larger trend. A trend-strength strategy uses the oscillator's magnitude and the widening rainbow band to judge whether a trend has room to run, holding positions while the band expands and tightening up as it narrows. An overextension strategy, following Widner's own pairing, watches the rainbow bandwidth for extreme readings that flag a move stretched far from its averages and vulnerable to reversal, using that to take profit or fade with confirmation. Across these, the oscillator supplies direction and momentum while the band supplies context on strength and maturity, and both are best combined with a trend filter.
Combining it with other indicators
The MACD is a natural comparison as another moving-average-based momentum tool, and agreement between the two strengthens a signal. A moving-average ribbon echoes the rainbow concept visually and can corroborate the trend-strength read. RSI adds a bounded overbought and oversold and divergence perspective that the range-relative rainbow extremes lack. A trend filter such as a long moving average or ADX helps decide whether to trust zero-line crosses or expect them to fail in a range. The recurring logic is to use the Rainbow Oscillator for its combined direction-and-strength read while a second momentum tool and a trend filter confirm the signal and judge the regime.
Where it fails
The deep recursive smoothing that gives the rainbow its clean look also adds real lag, so the oscillator confirms turns rather than anticipating them and can be late at sharp reversals. Its extremes are relative to recent range rather than fixed, so a reading that looks stretched in a quiet market may be normal in a volatile one, and beginners who treat its highs and lows as universal overbought or oversold levels will misread it. In choppy markets the lag produces late and sometimes false zero-line crosses. The remedies are to read its extremes in context, to pair zero-line crosses with a trend filter, and to use the bandwidth read as intended for judging trend maturity rather than precise timing. Expecting a heavily smoothed tool to call exact tops and bottoms is the central mistake.
A worked example
Suppose a stock begins a new uptrend and, as price pulls decisively above its stack of recursively smoothed averages, the Rainbow Oscillator crosses up through zero to plus 20, while the underlying rainbow band, previously narrow during the preceding range, begins to widen — signaling a genuine, strengthening trend. A swing trader takes the zero-line cross as the entry, confirmed by the expanding band that says the move has energy. As the advance matures over several weeks the oscillator pushes to plus 45, but the band stops widening and begins to contract, warning that the trend is losing steam even though price is still high. The trader tightens stops and takes partial profit on that band-narrowing cue, and when the oscillator finally rolls back down through zero the remaining position is exited. The lagging, smoothed nature of the tool kept the trader in through minor pullbacks but, as always with the rainbow, the signals confirmed the move rather than predicting its exact turns.