2006issue C011-7
One second-order transfer function, a family of trend filters
A Swiss Army Knife indicator is one programmed second-order transfer function plus an optional delayed input term. Swapping coefficient sets recovers exponential smoothing, a finite-impulse-response sliding average, and related operators from the same recurrence.
- A discrete linear filter is specified as a transfer function: the ratio of output to input written as polynomials in the delay operator Z.
- The first-order set a0=1, b0=alpha, b1=0, a1=-(1-alpha) reduces that skeleton to exponential smoothing, with unity DC gain when the input and feedback coefficients sum to one.
- A simple moving average of length N is recovered as a finite-impulse-response filter that adds the newest sample and drops the oldest sample divided by N.
- Band-stop and related branches are chosen by a type flag, and the same second-order recurrence is evaluated only after the lookback bar count is exceeded.
One equation and many coefficient tables
The Swiss Army Knife indicator is a single second-order rational transfer function whose coefficient table implements several common technical filters. The general indicator uses that rational second-order transfer function plus an optional delayed input term, so one programmed equation can host many coefficient tables.
A trend filter is a discrete linear operator that maps ordered price samples into a filtered series used as a quantitative baseline. Band-stop and related coefficient branches are selected by a type flag, and the same second-order recurrence is evaluated only after the lookback bar count is exceeded.
Transfer functions in Z-transform form
A discrete linear filter is specified as a transfer function: the ratio of filter output to filter input expressed as polynomials in the delay operator. In Z-transform notation, Z to the minus one represents one sample period of delay, matching daily or intraday bar sampling.
Exponential smoothing as a first-order coefficient set
Exponential smoothing is a recursive smoother whose current output is a weighted blend of the newest input and the previous output, recovered here as one coefficient set of the general transfer function. The first-order coefficient choice a0=1, b0=alpha, b1=0, a1=-(1-alpha) reduces the general difference equation to the familiar exponential moving average.
Alpha is the exponential-smoothing weight that also sets the attenuation corner relative to a chosen cycle period. Alpha can be set from an equivalent simple-average length L by the relation alpha = 2/(L+1), or from a cycle period at which attenuation is intended to begin. A check value given in the source is that attenuating cycle components shorter than 20 bars yields alpha of 0.2735, roughly a six-bar simple average.
When the input and feedback coefficients of that exponential smoother sum to one, the zero-frequency gain is unity. DC gain is that zero-frequency response; unity DC gain means a long constant input leaves the output nearly equal to the input.
A sliding simple average as a finite window
A finite-impulse-response filter is a filter whose output depends on a finite window of input samples and then drops the oldest term, as in the sliding simple average coefficient set. A simple moving average of length N is recovered as a finite-window coefficient set that adds the newest sample and drops the oldest sample divided by N.
That sliding-average implementation needs an initialization guard, because starting from zero on a nonzero price series delays recovery until the window fills.
All readings on this track · 10 readings
- 1982An odd-length smoother from a cycle cutoff
- 1989Smoothing filters, cutoff, poles, and sample delay
- 1992Constructing a cycle-aware finite impulse response detrender
- 2002Rebuild a smoother by writing the lag into the coefficients
- 2002Timing market cycles with finite impulse response filters and FFT
- 2002Constructing the relative strength index with an even-order finite-impulse-response prefilter
- 2003Recursive and cascaded moving-average construction
- 2006One second-order transfer function, a family of trend filters
- 2019Constructing the Voss line from a bandpass and a short FIR sum
- 2020Truncated bandpass construction as a finite-length trend filter