Skip to main content
Track Adaptive Filter
8 / 9
Library

2010issue C1130-35

Rebuilding an exponential average as a bounded error-correcting filter

This archive lesson rebuilds an exponential average as a recursive smoother that searches a limited error-correction gain each bar. TradersWeek editorial: students can then see, bar by bar, why some lag must remain if the series is still to smooth price rather than reprint it.

  • An exponential average adds alpha times the current price to one minus alpha times the previous average, so the two coefficients sum to one and a constant input eventually appears in the output.
  • The error-correcting filter inserts a signed gain times the gap between price and the previous filter value, collapsing to a plain exponential average when that gain is zero and nearly tracking price when the gain is large.
  • Each bar, gain is searched from the negative of a user limit to the positive limit, and the value that leaves the smallest absolute residual between close and the candidate output is kept.
  • The historical procedure buys or sells short the next open only when the error-corrected line crosses the exponential average and the scaled residual exceeds a threshold, so weak residuals are ignored.
Entries in this reading3 entries

A smoother that still has to lag

The archive starts from an ordinary exponential average and then rebuilds it as a bounded error-correcting filter. The two lines stay related: one is the conventional average, the other is the same update with a searched gain on the latest gap from price.

TradersWeek editorial: the rebuild is worth walking through bar by bar because it makes the trade-off visible. If the extra term is allowed to take almost the whole gap, the output nearly reprints price. If that term is held at zero, the output is only the exponential average. Anything in between is still a smoother, so some lag remains.

How the exponential average is formed

An exponential average is formed by adding alpha times the current price to one minus alpha times the previous average. The two coefficients sum to one, and a constant input eventually appears in the output.

The same alpha is commonly set from an equivalent simple-average length as two divided by length plus one. A small alpha increases both smoothing and lag. A large alpha, still below one, reduces both.

In the terminology used here, exponential smoothing is a one-pole average that blends the current observation with the previous output using complementary weights that always sum to one.

Adding a signed gain on the latest gap

The error-correcting filter inserts a signed gain times the gap between price and the previous filter value into the exponential update. The construction collapses to a plain exponential average when that gain is zero and nearly tracks price when the gain is large.

The archive treats this as an adaptive filter: a recursive smoother whose error-correction gain is chosen each bar from a limited search so the output stays between a conventional exponential average and raw price.

Choosing the gain on each bar

Each bar, gain is searched from the negative of a user gain limit to the positive limit in steps of one tenth. The value that produces the smallest absolute residual between close and the candidate output is retained.

What a step input shows

On a step input with equivalent length 12 and gain limit 50, the error-corrected line rises and falls faster than the companion exponential average while still remaining a smoothed series rather than raw price.

When a crossover is treated as a trend

The trading procedure buys or sells short the next open only when the error-corrected line crosses the exponential average and one hundred times the least residual divided by close exceeds a threshold, so weak residuals are ignored.

In the terminology used here, trend following is a crossover procedure that enters only when the error-corrected line crosses the exponential baseline and the residual is large enough to treat the move as a trend rather than noise.

Length changes the same rules

A longer equivalent length produces few trades over a multi-year window and behaves as a trend follower. Shortening that length shifts the same rules toward swing trading, with more frequent wins but a less even equity path in the reported example.

Educational research material, not investment advice. Historical source context does not establish present-day performance.
8 of 9 in the Adaptive Filter track
201848-55 pp.Next on Adaptive FilterAssembling a recursive median oscillator as a two-stage adaptive filterThe recursive median stage is an exponential moving average of a five-bar median of the chosen price series, meant to resist extremes that distort ordinary averaging.
All readings on this track · 9 readings
  1. 1982Constructing moving averages with weights, alignment, and adaptive lookbacks
  2. 1990Constructing adaptive filters from equal-weight averages
  3. 2000Cycle-scaled lookbacks for a channel-breakout rule
  4. 2000When charting code breaks the adaptive trendline
  5. 2001Nonlinear Ehlers filter construction from momentum and distance weights
  6. 2001How a fixed smoother becomes a living parameter surface
  7. 2005A three-part workshop for adaptive-filter length search
  8. 2010Rebuilding an exponential average as a bounded error-correcting filter
  9. 2018Assembling a recursive median oscillator as a two-stage adaptive filter
All 9 readings tagged Adaptive Filter
Also on Adaptive Filter5 readings