2005issue C031-2
A three-part workshop for adaptive-filter length search
This article teaches one filter construction: fold noise with a moving average, emit a live exponential-smoothing value, and shrink a shared odd window until a median and that smoother agree.
- An averaging filter folds noise into a summed series so that, given enough samples, the noise component tends toward a near-zero mean.
- A median ranks an odd-length window and emits the middle value, so one extreme observation does not change the output.
- The length search shortens a shared odd window until the same-length median and exponential-smoothing outputs differ by less than a chosen threshold, then turns that length into alpha.
- Because alpha can be recomputed with each new sample, the adaptive-filter output changes its effective memory as conditions change.
Three pieces, one construction
Editorial framing: read this archive construction as a three-part workshop. The first part is a moving-average view of how noise is folded into a mean. The second is an exponential-smoothing recursion used as the live output. The third is an adaptive-filter length search that shrinks a shared window until a median and that smoother finally agree.
Editorial note: the archive facts describe a historical workflow. They do not present a trading rule.
A moving average folds noise into a mean
An averaging filter reduces noise by folding it into a summed series so that, given enough samples, the noise component tends toward a near-zero mean. Here the moving average is that same-length window mean. It is the conceptual noise-folding baseline, and it is the averaging counterpart in the replacement example that follows.
A median keeps a single spike from moving the output
A median filter reduces impulsive spikes by ranking the window and emitting the middle value, so one extreme observation does not change the output. The median is the middle ranked value in an odd-length window, which is why a single extreme sample does not move that output.
In a ten-sample window of ones, both the average and the median equal 1. After one sample is replaced by 10, the average becomes 1.9 while the median remains 1.
Exponential smoothing is the live output
The live output is exponential smoothing: a recursive average that blends the newest observation with the prior output through a coefficient that can be reset whenever the selected length changes.
That coefficient is alpha, the exponential-smoothing weight obtained by dividing 2 by one plus the selected length.
The length search shortens a shared odd window
The length search begins with a relatively long odd window so the median sits at the exact center, then shortens that window by 2 on each pass. At each candidate length, a same-length median of a pre-smoothed series is compared with an exponential-smoothing output of that series, and the absolute percentage difference of those two outputs is recorded.
The search keeps the shortest length whose absolute percentage difference falls below a chosen threshold, then converts that length into an exponential-smoothing coefficient of 2 divided by one plus the length. The threshold is that absolute percentage gap between the same-length median and exponential-smoothing outputs.
Illustrated defaults and a changing memory
The illustrated construction pre-smooths the high-low midpoint with a four-sample weighted average, starts the search at length 39, applies a default threshold of 0.002, and floors length at 3.
Because that coefficient can be recomputed with each new sample, the final adaptive-filter output changes its effective memory as conditions change. An adaptive filter is a smoother whose effective lookback, and therefore its smoothing weight, is recomputed from incoming observations instead of being held fixed.
With the threshold set to 0.002, the plotted adaptive-filter output is described as adjusting quickly on larger price moves and remaining comparatively quiet through a congestion interval.
Median-average adaptive filter, August 1995 to February 1996

The source fixes the median-versus-EMA agreement threshold at 0.002 and searches odd lengths from 39 down to 3. Points are traced from the plotted filter line and are only good to about 0.3 price units.
All readings on this track · 9 readings
- 1982Constructing moving averages with weights, alignment, and adaptive lookbacks
- 1990Constructing adaptive filters from equal-weight averages
- 2000Cycle-scaled lookbacks for a channel-breakout rule
- 2000When charting code breaks the adaptive trendline
- 2001Nonlinear Ehlers filter construction from momentum and distance weights
- 2001How a fixed smoother becomes a living parameter surface
- 2005A three-part workshop for adaptive-filter length search
- 2010Rebuilding an exponential average as a bounded error-correcting filter
- 2018Assembling a recursive median oscillator as a two-stage adaptive filter