2.22: High-Pass Filters for Traders

HPF output = input − LPF. Each pole adds 6 dB/octave rolloff and one bar of lag. The 2-pole HPF at critical period T is the cleanest detrender for daily mean-reversion features.

2.22: High-Pass Filters for Traders

The prior article in this series ("The Trader's Guide to Low-Pass Filters") gave the design recipe for the LPF family that keeps the trend and discards the high-frequency noise. The construction makes sense for trend-following systems and any application where the slow drift is the signal.

For daily-frequency trading on equity indices, the slow drift is not the signal. The reliably predictive content at this frequency lives in mean reversion: prices that have moved too far in one direction over a short window tend to revert. The information content sits in the deviations from the slow trend, not in the trend itself. A low-pass filter applied to such data destroys the part of the input that the model needs.

The high-pass filter is the mirror construction. It removes the slow trend and keeps the deviations. The output of a properly designed HPF is the detrended series, which is the feature space where mean-reversion edges live. A high-pass filter is, structurally, a derivative. The simplest HPF is the one-bar difference (close minus close shifted by one bar), and every more elaborate HPF is the same operation generalized to longer time scales and steeper frequency cutoffs.

This article gives the four levels of HPF construction (differencer, momentum, 1-pole HPF, 2-pole HPF) and the two applications that make HPFs the most underused filter in technical analysis. The next article in this series ("Band-Pass Filters: The Most Underused Tool in Technical Analysis") cascades the HPF with the super-smoother from the prior article to isolate cycle bands. The article "Decyclers: Extracting Trend by Removing Cycle Energy" uses the input-minus-HPF construction to recover a clean trend line.

The HPF identity: input minus low-pass

The simplest characterization of a high-pass filter is the complementary operation to the low-pass:

$$ H_{\text{HPF}}(z) \;=\; 1 \;-\; H_{\text{LPF}}(z) $$

In time domain, the HPF output at time t is the input minus the LPF output at time t. The HPF therefore inherits the LPF's pole count, lag characteristics, and critical period, applied to the residual rather than the smoothed signal.

For an EMA-based LPF with smoothing constant α and critical period T, the complementary 1-pole HPF has transfer function:

$$ H_{\text{1-pole HPF}}(z) \;=\; \frac{(1 - \alpha/2)(1 - z^{-1})}{1 - (1 - \alpha) z^{-1}} $$

The numerator (1 − z⁻¹) is the difference operator (the simplest HPF). The denominator is the same recursion as the EMA. The construction is a recursive high-pass that combines the cleanness of a differencer at high frequencies with the smoothness of a recursive filter at the boundary.

In time domain:

$$ y_t \;=\; (1 - \alpha/2)(x_t - x_{t-1}) \;+\; (1 - \alpha) y_{t-1} $$

One state variable. Two multiplications per bar. The α derives from the critical period T through the same cosine formula from the LPF article: γ = cos(2π/T), σ = 1/γ − √(1/γ² − 1), α = 1 − σ.

Level 1: the differencer

The single-bar difference (close − close shifted by one bar) is a 1-bar HPF with no parameters. Coefficients b₀ = 0.5, b₁ = −0.5 (or equivalently 1 and −1 unnormalized) and no feedback terms.

$$ y_t \;=\; x_t \;-\; x_{t-1} $$

The frequency response rises from 0 dB at the Nyquist frequency to −∞ dB at DC. Every constant offset is removed (the differencer kills DC by construction). Every slow drift is heavily attenuated. The output is approximately the time derivative of the input.

For prices, the differencer is the 1-bar log return (when applied to log prices) or the 1-bar price change. It is the most fundamental HPF in trading and underlies every momentum, return, and acceleration feature.

The differencer's drawback: no parameter for the cutoff. The filter passes all frequencies above DC equally, which means high-frequency noise passes through at full amplitude. For features that need both detrending and noise rejection, the differencer must be cascaded with a low-pass or replaced with a parameterized HPF.

Level 2: the N-bar momentum

The N-bar difference (close − close shifted by N bars) is a longer-window HPF with a single parameter N.

$$ y_t \;=\; x_t \;-\; x_{t-N} $$

The frequency response is sin(Nπf) / sin(πf) (a sinc-shaped response, similar to the SMA but high-pass instead of low-pass). The filter passes frequencies near 1/(2N) at full amplitude, attenuates DC by definition, and has notches at integer multiples of 1/N.

The N-bar momentum is the canonical short-horizon momentum feature. close[t] − close[t−20] is the 20-day momentum. For mean reversion (negative momentum predicts positive forward return), the sign of the N-bar momentum is the feature. For continuation (positive momentum predicts positive forward return), the same sign carries the opposite trade.

The N-bar momentum has the same sidelobe problem as the SMA from the article "Why the SMA Is Often a Terrible Smoother." High-frequency cycles at the sidelobe frequencies pass through at substantial amplitude, contaminating the momentum measurement. The fix is the recursive HPF below, which has no sidelobes.

Level 3: the 1-pole HPF (recursive form)

The 1-pole HPF is the recursive construction with smooth frequency response (no sidelobes) and a single tunable parameter (the critical period T):

$$ y_t \;=\; (1 - \alpha/2)(x_t - x_{t-1}) \;+\; (1 - \alpha)\, y_{t-1} $$

The frequency response rolls off at 6 dB/octave below the critical period. Above the critical period, the output is approximately the original input minus a slow drift. Below the critical period, content is attenuated proportionally to how far below T the frequency sits.

For T = 30: cycles longer than 60 bars are attenuated by more than 6 dB (less than half amplitude). Cycles between 15 and 60 bars pass at modest attenuation. Cycles shorter than 15 bars pass at full amplitude.

The 1-pole HPF is the structural detrender. The output is the input with frequencies below T removed. The lag of the 1-pole HPF at critical period T is approximately T/π bars (same as the 1-pole LPF), with the sign reversed in some interpretations: the HPF responds quickly to fast changes and slowly to slow changes, so the effective lag is small on the high-frequency content that the filter is meant to pass.

Level 4: the 2-pole HPF

Each additional pole adds 6 dB/octave of low-frequency rolloff and one bar of lag. The 2-pole HPF is the mirror of the 2-pole LPF from the prior article:

$$ H_{\text{2-pole HPF}}(z) \;=\; \frac{(1 - \alpha/2)^2 (1 - z^{-1})^2}{1 - 2(1-\alpha) z^{-1} + (1-\alpha)^2 z^{-2}} $$

In time domain:

$$ y_t \;=\; (1 - \alpha/2)^2 (x_t - 2 x_{t-1} + x_{t-2}) \;+\; 2(1-\alpha)\, y_{t-1} \;-\; (1-\alpha)^2 \, y_{t-2} $$

Two state variables, four multiplications per bar. The rolloff is 12 dB/octave below T. The 2-pole HPF is the canonical detrender for daily-bar trading features because the steep low-frequency cutoff removes the slow drift cleanly while leaving the high-frequency content (where the signal lives) at full amplitude.

Worked example: SPX detrended four ways

SPX daily, 1990 to 2026. Compute the detrended close using four HPF constructions, all matched approximately to critical period T = 30 (target: remove cycles longer than 60 bars).

$$ \begin{array}{l|c|c|c|c} \text{HPF construction} & \text{Poles} & \text{Lag (bars)} & \text{Residual low-freq content} & I(X;Y) \times 10^3 \\ \hline \text{Differencer (1-bar diff)} & 1 (no T) & 0.5 & 0.05 & 0.8 \\ \text{30-bar momentum (} P_t - P_{t-30}\text{)} & 1 (no T) & 14.5 & 0.12 & 1.7 \\ \text{1-pole HPF, T = 30} & 1 & 9.5 & 0.18 & 1.8 \\ \text{2-pole HPF, T = 30} & 2 & 19.0 & 0.04 & 2.1 \\ \end{array} $$

Four readings.

The differencer has near-zero lag but no parameter to tune the cutoff. The output is dominated by single-bar noise. The MI (0.8) is the lowest because the model cannot distinguish noise from short-cycle signal.

The 30-bar momentum is the standard technical-analysis HPF. The MI is 1.7, comparable to the 1-pole HPF, because the sinc-shape sidelobes do not affect the daily-frequency signal much. The lag is the (N−1)/2 = 14.5 bars of an SMA-like FIR.

The 1-pole HPF at T = 30 has slightly higher MI (1.8) and less lag (9.5) than the momentum. The smooth frequency response (no sidelobes) protects against contamination at specific cycle frequencies.

The 2-pole HPF at T = 30 has the highest MI (2.1) because the steep 12 dB/octave rolloff removes more of the slow trend that was acting as noise to the mean-reversion signal. The lag (19 bars) is the cost.

The choice between the four depends on the application. For short-horizon mean reversion, the 2-pole HPF is the cleanest detrender. For audit-required or simple deployments, the 30-bar momentum is the operational default. For real-time low-latency use, the differencer or the 1-pole HPF is the right choice.

Application 1: detrended features

The standard pipeline for a mean-reversion feature uses an HPF as the first stage:

  1. Apply 2-pole HPF at critical period T (T = 20 to 60 bars for daily data).
  2. Use the HPF output directly as a feature, or as input to a further transform.

The feature library entries follow the convention "hpf_close_2pole_T30" for the 2-pole HPF at T = 30 applied to log close. The feature is stationary by construction (HPFs attenuate DC and slow drift) and lives in the same units as the original return-space (when applied to log prices).

Compared to the close-minus-MA construction commonly used in technical analysis, the HPF has three advantages:

The frequency cutoff is explicit (T), not implicit in the MA length. The trader knows which frequency content is being preserved and which is being discarded.

The construction is recursive, with O(1) state for the 1-pole HPF and O(2) state for the 2-pole HPF. The MA-based detrender requires O(N) state.

The HPF rolls off smoothly. The MA-based detrender inherits the SMA's sidelobe leakage at specific frequencies, contaminating the detrended output with cycle content the trader did not intend to pass.

Application 2: the roofing filter

The roofing filter is the canonical preprocessing block for cycle-mode indicators. The construction:

  1. Apply a 1-pole HPF with critical period T_high (typically 40 to 80 bars) to remove the slow trend.
  2. Apply a super-smoother (2-pole LPF, from the article "The Trader's Guide to Low-Pass Filters") with critical period T_low (typically 10 to 20 bars) to remove the high-frequency noise.

The composition is a band-pass filter that retains content with periods between T_low and T_high. The output is a clean cycle signal that downstream cycle-detection logic (dominant cycle estimation, Hilbert transform, sine-wave indicator) can operate on without being confused by trend or noise.

The article "Band-Pass Filters: The Most Underused Tool in Technical Analysis" gives the direct band-pass construction that achieves the same effect in a single recursion with fewer state variables.

Application 3: detrend-to-prediction substrate

A model that consumes raw close as input wastes capacity learning the slow trend. The trend on equity indices is structurally upward (~7% annualized real), positive almost everywhere, and easy to estimate; the model learns it in a few epochs and then spends the rest of its capacity on the residual. The "wasted capacity" is not free: the model parameters used to learn the trend are not available for learning the mean-reversion structure that actually predicts forward returns.

A model that consumes HPF(close) as input starts with the trend removed. Every parameter is available for learning the residual structure. The retained MI lift on properly detrended features is typically 0.2 to 0.5 bits × 10⁻³, which compounds across the feature portfolio.

The HPF is to features what the log return is to prices: a structural transform that puts the data on the axis where the model can find the signal.

Decision matrix

Use case Recommended HPF Reason
Standard mean-reversion feature 2-pole HPF Clean detrend, steep cutoff
Real-time streaming 1-pole HPF O(1) state, smooth response
Tick-frequency derivative Differencer Simplest, near-zero lag
Audit-required computation N-bar momentum Hand-verifiable, system-portable
Roofing-filter input 1-pole HPF + super-smoother Composes into band-pass
Decycler construction 1-pole HPF (subtract from input) Yields clean trend line
Cycle-mode indicator preprocessing Roofing filter Band-passes the cycle band

What this changes in practice

Three operational shifts.

The default detrending operation in the feature library is the 2-pole HPF at a documented critical period T, not the close-minus-MA construction. The feature name carries T explicitly: "hpf_2pole_close_T30" identifies the construction.

Every price-derived feature is offered with both a non-detrended and a detrended variant in the library. The detrended variant uses the 2-pole HPF as the structural transform. The non-detrended variant is kept only for features where the absolute level carries the signal (rare on equity indices).

The "what frequency band does this feature live in" question is answered at feature definition. A momentum feature has a band-pass character; a trend feature has a low-pass character; a mean-reversion feature has a high-pass character. The feature library tags each feature with its dominant frequency band, which is the answer to the article "No Filter Is Predictive" question about which frequency content carries the signal.

Visualizing the HPF response

The two panels make the HPF case visually. Panel (a) shows the frequency-response trade. Panel (b) shows the time-domain output traders should actually feed into a model.

KEY POINTS

  • The HPF is the structural detrender. Output = input minus low-pass. For daily-frequency mean reversion (the only reliably predictive signal on equity indices), the HPF isolates the part of the input that carries the signal.
  • The differencer (1-bar diff) is the simplest HPF: no parameter, full cutoff at DC, passes everything above. Underlies all return and momentum features.
  • The N-bar momentum (close minus close shifted by N) is a sinc-shaped HPF with notches at integer multiples of 1/N. Inherits the SMA's sidelobe leakage; the recursive 1-pole HPF avoids it.
  • The 1-pole HPF: y_t = (1 − α/2)(x_t − x_{t−1}) + (1 − α) y_{t−1}, with α derived from the critical period T via the cosine formula. 6 dB/octave rolloff below T, no sidelobes, O(1) state.
  • The 2-pole HPF: 12 dB/octave rolloff, two state variables, four multiplications per bar. The default 2-pole detrender for daily-bar trading features.
  • Each additional pole adds 6 dB/octave of low-frequency rolloff and one bar of lag. Same trade as the LPF family.
  • The HPF lag at critical period T is approximately T/π for the 1-pole and 2T/π for the 2-pole, applied to the signal that the filter is meant to pass.
  • The HPF can be used as a feature on its own (detrended series) or as the first stage of a roofing filter (HPF then super-smoother, equivalent to a band-pass).
  • On SPX at T = 30, the differencer has MI 0.8, the 30-bar momentum has 1.7, the 1-pole HPF has 1.8, and the 2-pole HPF has 2.1. The structural detrending lifts the MI by 0.3 to 1.3 bits × 10⁻³ depending on the filter.
  • A model that consumes raw close wastes capacity learning the trend. A model that consumes HPF(close) starts with the trend removed and uses all capacity on the residual.
  • The default detrending operation in the feature library is the 2-pole HPF at a documented T. Close-minus-MA constructions are migrated to the HPF equivalent at the same critical period.
  • Every price-derived feature carries a frequency-band tag in the library: low-pass (trend), high-pass (deviation), band-pass (cycle). The tag is the answer to the "which frequency content carries the signal" question.