Skip to main content
Track Exponential smoothing
6 / 41
Library

1990issue C041-11

Constructing incremental moving average filters

Simple, linear, and exponential averages all smooth ordered observations over a stated lookback, but they assign different weights to old versus recent data. A one-pass routine can avoid repeating a single-date average by updating a running sum, computing the linear weight total once, or retaining the prior exponential average.

  • When many dates are required, a routine that fills an entire output series in one pass avoids repeating a single-date average call at each date.
  • After the first simple-average window sum is known, the next running sum subtracts the observation that leaves the window and adds the observation that enters it.
  • A linear moving average divides by the sum of integer weights from 1 through the lookback, and that weight total can be computed once outside the inner loop.
  • An exponential average blends the newest observation with the prior average, so that prior value must be retained or the history is rebuilt.
Entries in this reading2 entries

Filling the output series in one pass

Editorial interpretation: TradersWeek treats a moving average as retained state rather than a one-line formula. The construction problem is naming what must be carried from the previous bar so the next simple, linear, or exponential value is exact without rebuilding the window. The archive facts describe only the historical workflow that follows.

When many dates are required, invoking a single-date average once per date repeats call overhead. A routine that fills an entire output series in one pass avoids that repetition.

Simple, linear, and exponential averages all smooth ordered observations over a stated lookback, but they assign different weights to old versus recent data.

Equal weights and the running sum

A simple moving average gives every observation in the window the same weight, so an old change offsets a new change of the same size.

After the first simple-average window sum is known, the next sum is obtained by subtracting the observation that leaves the window and adding the observation that enters it. That retained window total is the running sum.

For a 10-period simple average on 10 successive output dates, that running-sum update replaces 100 additions and 10 divisions with 28 additions and 10 divisions.

Linear weights and a once-computed total

A linear moving average multiplies the oldest point by 1 and the newest by the lookback length, then divides by the sum of those integer weights rather than by the period count.

The linear weight total from 1 through L equals L times (L plus 1) divided by 2 and can be computed once, outside the inner loop.

A recursive exponential blend

An exponential average is recursive: the current value blends the newest observation with the prior average, so that prior value must be retained or the history is rebuilt.

The exponential blending weight for a chosen period length can be written as 2 divided by (period length plus 1).

Integer totals and overflow

Integer construction requires postponing division until the last step and guarding overflow, because a long-period linear weighted sum can exceed a 32-bit integer range.

A scaled integer stores a price in whole units of the smallest tick so integer arithmetic can replace floating-point arithmetic. Division is still postponed until the last step.

Educational research material, not investment advice. Historical source context does not establish present-day performance.
6 of 41 in the Exponential smoothing track
19911-8 pp.Next on Exponential smoothingConstructing a double-smoothed stochastic oscillatorThe raw stochastic is one hundred times the close minus the lookback low, divided by the lookback high minus the lookback low, and is scaled onto a zero-to-one-hundred range.
All readings on this track · 41 readings
  1. 1984Matching average age across price filters
  2. 1984Residual-impact construction of exponential smoothers
  3. 1988Constructing simple and exponential moving averages as specified filters
  4. 1989Evaluating smoothed free reserves and funds-discount spreads
  5. 1990Integer construction of moving averages and exponential smoothing
  6. 1990Constructing incremental moving average filters
  7. 1991Constructing a double-smoothed stochastic oscillator
  8. 1991Constructing an exponential average from a smoothing weight
  9. 1991Constructing a double-smoothed momentum oscillator family
  10. 1991Competing certainty rules from exponential-average conditions
  11. 1991Hybrid construction of a mechanical timing system from smoothed signals
  12. 1991Constructing an exponential smoother from a moving-average length
  13. 1991Equivalent relative-strength-index constructions from a ratio and from smoothed momentum
  14. 1991Constructing the true strength index from double-smoothed momentum
  15. 1991True strength index from signed, double-smoothed momentum
  16. 1992Constructing exponential averages from simple lookbacks
  17. 1992Constructing exponential averages by the smoothing constant, startup length and lag
  18. 1992Nested range smoothing and windowed high-low damping
  19. 1992A weekly equity stance from the discount-bill spread
  20. 1993Double-smoothed stochastics momentum index construction
  21. 1993Constructing the true strength index with double exponential smoothing
  22. 1994Polarized fractal efficiency with a shared exponential smoother
  23. 1994Five-interval exponential smoothing of ten-interval signed path-efficiency
  24. 1994Hand-ranked price-volume series with stacked smoothing and stochastic
  25. 1995Range expansion filter on multi-horizon averages
  26. 1995The exponential smoothing constant from averaging lag
  27. 1997Construct a nested-average rainbow band and oscillator
  28. 1998Filter stacks that combine a moving average with exponential smoothing
  29. 2002Smoothed relative-strength construction from wilder-averaging and a price prefilter
  30. 2003Reverse-engineered RSI price targets
  31. 2004Piecewise trend quality from moving-average reversals
  32. 2004Nested smoothing recipes versus unaudited oscillator experiments
  33. 2008Weight construction beyond the N-day label
  34. 2010A consensus filter for objective RSI and smoothing construction
  35. 2012Sentiment-zone oscillator from signed closes
  36. 2012Classic RSI one-over-N smoothing versus the standard exponential average
  37. 2013Why exponential smoothing uses two over n plus one
  38. 2015Constructing ratio indicators with moving-average and exponential-smoothing weights
  39. 2015Slow relative-strength index from an exponentially smoothed price
  40. 2017Rebuilding the relative strength index as open-scale buy-sell pressure
  41. 2017Comparing Wilder and exponential smoothing inside a relative-strength index
All 183 readings tagged Exponential smoothing
Also on Exponential smoothing5 readings