1990issue C111-8
Seed and recurrence construction for moving averages
Routine technical work is described as being dominated by a simple moving average, a step-weighted moving average, and an exponentially smoothed average. After a window seed, the simple and step-weighted forms can be advanced with iterative updates that no longer vary with window length.
- Routine technical work is described as being dominated by three constructions: a simple moving average, a step-weighted moving average, and an exponentially smoothed average.
- The exponentially smoothed average is already recursive: each new value depends only on the prior smoother, the new observation, and a smoothing constant.
- After the window seed, simple and step-weighted averages admit iterative updates whose work no longer varies with window length.
- Only the prior running window sum needs to be kept for the next step-weighted update, and a five-bar walk-through matches the batch and recurrent paths.
Three constructions in routine work
Routine technical work is described as being dominated by three constructions: a simple moving average, a step-weighted moving average, and an exponentially smoothed average. A simple moving average is the equal-weight mean of the most recent window of ordered observations. A step-weighted moving average is a windowed mean that assigns linearly rising integer weights, with the newest observation heaviest, then divides by the sum of those weights. An exponentially smoothed average is a recursive smoother that blends the newest observation with the prior smoother value through a constant between zero and one.
The exponential step is already recursive
The exponential construction is already recursive: each new value depends only on the prior smoother, the new observation, and a smoothing constant. One common smoothing constant equals two divided by one plus the target window length. A direct reading of the windowed formulas makes simple and step-weighted work appear to grow with lookback, while one exponential step uses two additions or subtractions and one multiplication regardless of that constant.
Window seed and the simple iterative update
The window seed is the first fully populated average. It still uses the whole lookback and is the only step whose work scales with window length. After the first complete window, a simple average updates by adding the newest observation minus the observation that leaves the window, then dividing that difference by the window length. That step is an iterative update: a recurrence that forms the next average from the previous average plus a fixed arithmetic correction.
Step-weighted update with a running window sum
A step-weighted average can be rewritten with a running window sum, the unweighted total of the current window, and a triangular divisor. The triangular divisor is the closed-form sum of the first n integers, n times n plus one, divided by two, used to normalize step weights. Each later step-weighted value equals the previous step-weighted value plus the window length times the new observation, minus the prior running window sum, all scaled by that same divisor. The running window sum is itself updated by adding the entering observation and subtracting the observation that exits. Only the prior running window sum needs to be kept for the next step-weighted update.
Arithmetic after the seed
Once the seed term is formed, incremental simple and step-weighted updates no longer vary with window length, so on a series much longer than the window the three constructions take roughly comparable arithmetic. The recurrences can be checked by induction. A five-bar numerical walk-through produces matching next values from the batch and recurrent step-weighted paths, and from the batch and recurrent simple-average paths.
Five-day step-weighted average on the sidebar prices

Window length is n=5 and the weight divisor is the closed form c=n(n+1)/2=15. Only the first two simple-average values are stated, so SMA is omitted.
All readings on this track · 20 readings
- 1988Indicator smoothing: lookback, weight, and scale
- 1990Recency weighting in simple, linear, and exponential moving averages
- 1990Seed and recurrence construction for moving averages
- 1990Constructing a five-day step-weighted moving average
- 1992Constructing simple, weighted, and exponential moving averages
- 1992Constructing moving averages with weighting schemes and extra filters
- 1992Constructing a weighted-average TRIN10 with Bollinger envelopes
- 1992Constructing a banded weighted open-TRIN oscillator
- 1993Evaluating a weighted dual rate-of-change momentum filter
- 1993Constructing equal, linear and exponential moving averages
- 1993Constructing a general weighted moving average from one exponent
- 1993Calibrating the weighted-moving-average exponent
- 1993Constructing an exponent-weighted average of put-call ratios
- 1994Cycle-tuned momentum with spectral peaks
- 1999How a five-bar sine-weighted average is assembled
- 2003Same-scale trend filter from a rolling least-squares endpoint
- 2003How a rolling linear-regression endpoint is assembled as a moving-trend
- 2004Constructing a volume-weighted moving average as a forecast baseline
- 2005Constructing a move, volume and recency weighted average
- 2016MACD as a zero-line filter with dual moving averages