1997issue C071-4
Construct a nested-average rainbow band and oscillator
A moving-average of a close price-basis can be nested up to ten times at the same length, then turned into a visual consensus band and a range-scaled rainbow-oscillator. Students can name each input, rebuild both the plot and spreadsheet forms, and compare the trend-filter with a simple moving-average baseline.
- The rainbow stack takes a moving-average of a price-basis and then averages that result repeatedly, up to ten nested levels, each using the same length.
- A single-level rainbow function returns only the nested-average that matches a chosen level, while rainbow-bandwidth is 100 times the spread of the nested averages divided by the highest-minus-lowest price over the same level window, and is left undefined when that range is zero.
- The rainbow-oscillator is 100 times the close minus the mean of the selected nested averages, divided by the high-low price range over the level window, and can be read as a signed trend-filter around that consensus.
- Default plotted inputs are a close price-basis, a length of 2 bars, and 10 average levels, and deeper nested-average lines are withheld until the current bar exceeds length times 10.
The nested-average stack
The rainbow stack begins with a moving-average of a price-basis. A moving-average is a lookback mean of ordered price observations, and it is the base smoother at each nesting level. That first result is then averaged again, and the same length is reused at every step, up to ten nested levels. A nested-average is an average whose input is a prior average of the same length, so each deeper level adds lag.
A single-level rainbow function returns only the nested-average that matches a chosen level rather than the entire stack. Level is how many nested averages enter the consensus, the rainbow-bandwidth, and the rainbow-oscillator. The plotted-line defaults shown in the archive are a close price-basis, a length of 2 bars, and 10 average levels.
Rainbow-bandwidth and the rainbow-oscillator
Rainbow-bandwidth is the spread between the highest and lowest nested averages, scaled by the high-low range of price over a matching lookback. In this construction it equals 100 times the spread of the nested averages divided by the highest-minus-lowest price over the same level window. When that price range is zero, rainbow-bandwidth is left undefined.
The rainbow-oscillator is a range-normalized reading of the gap between the latest close and the mean of the nested averages. It equals 100 times the close minus the mean of the selected nested averages, again divided by the high-low price range over the level window. Used as a trend-filter, that signed value is a range-normalized reading of whether price is above or below the nested-average consensus.
Plot timing and the oscillator panel
Line plots of the deeper nested averages are withheld until the current bar exceeds length times 10, matching the depth of the full stack. Until that bar count is reached, only the shallower lines that already have enough history should be drawn.
The oscillator panel plots an upper bandwidth, a mirrored lower bandwidth, and a histogram whose color depends on whether the oscillator is above or below zero.
Spreadsheet form
An equivalent spreadsheet construction uses ten successive two-bar averages, a signed pair of bandwidth series, and an oscillator that subtracts the ten-average mean from the close before scaling by an eleven-bar close range.
Editorial note: keep the two scalings distinct when you rebuild each form. The plotted rainbow-oscillator uses the high-low price range over the level window. The spreadsheet oscillator uses an eleven-bar close range.
Compare a moving-average baseline
Editorial classroom test: rebuild the stack on the same price-basis and length, then compare the nested-average consensus with a single moving-average of that same length. The extra nesting is the only construction change you are isolating.
Exponential-smoothing is a recursive smoother that can be compared with successive nested averages when students contrast alternative forecast-style baselines on the same series. The comparison is a construction check, not a claim about returns.
All readings on this track · 41 readings
- 1984Matching average age across price filters
- 1984Residual-impact construction of exponential smoothers
- 1988Constructing simple and exponential moving averages as specified filters
- 1989Evaluating smoothed free reserves and funds-discount spreads
- 1990Integer construction of moving averages and exponential smoothing
- 1990Constructing incremental moving average filters
- 1991Constructing a double-smoothed stochastic oscillator
- 1991Constructing an exponential average from a smoothing weight
- 1991Constructing a double-smoothed momentum oscillator family
- 1991Competing certainty rules from exponential-average conditions
- 1991Hybrid construction of a mechanical timing system from smoothed signals
- 1991Constructing an exponential smoother from a moving-average length
- 1991Equivalent relative-strength-index constructions from a ratio and from smoothed momentum
- 1991Constructing the true strength index from double-smoothed momentum
- 1991True strength index from signed, double-smoothed momentum
- 1992Constructing exponential averages from simple lookbacks
- 1992Constructing exponential averages by the smoothing constant, startup length and lag
- 1992Nested range smoothing and windowed high-low damping
- 1992A weekly equity stance from the discount-bill spread
- 1993Double-smoothed stochastics momentum index construction
- 1993Constructing the true strength index with double exponential smoothing
- 1994Polarized fractal efficiency with a shared exponential smoother
- 1994Five-interval exponential smoothing of ten-interval signed path-efficiency
- 1994Hand-ranked price-volume series with stacked smoothing and stochastic
- 1995Range expansion filter on multi-horizon averages
- 1995The exponential smoothing constant from averaging lag
- 1997Construct a nested-average rainbow band and oscillator
- 1998Filter stacks that combine a moving average with exponential smoothing
- 2002Smoothed relative-strength construction from wilder-averaging and a price prefilter
- 2003Reverse-engineered RSI price targets
- 2004Piecewise trend quality from moving-average reversals
- 2004Nested smoothing recipes versus unaudited oscillator experiments
- 2008Weight construction beyond the N-day label
- 2010A consensus filter for objective RSI and smoothing construction
- 2012Sentiment-zone oscillator from signed closes
- 2012Classic RSI one-over-N smoothing versus the standard exponential average
- 2013Why exponential smoothing uses two over n plus one
- 2015Constructing ratio indicators with moving-average and exponential-smoothing weights
- 2015Slow relative-strength index from an exponentially smoothed price
- 2017Rebuilding the relative strength index as open-scale buy-sell pressure
- 2017Comparing Wilder and exponential smoothing inside a relative-strength index