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.
Aligrithm is an independent research publication on systematic trading, quantitative research, market microstructure, and adaptive systems. Long-form essays, code notebooks, and architecture breakdowns across eight pillars, built for traders who care more about how markets behave than about hype.
More about the publication →Read in order. Each pillar walks you out of one trap with one new ability. The newest article is the worst place to begin.
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.
Each pole adds 6 dB/oct rolloff and one bar of lag at critical period T. 1-pole EMA: 6 dB/oct. 2-pole and super-smoother: 12 dB/oct. The super-smoother is critically damped with clean step response.
EMA is the 1-pole IIR low-pass: y_t = α x_t + (1−α) y_{t−1}. One state, one parameter, no sidelobes. EMA wins on O(1) state and composability — the building block for HPF, BPF, AGC, decycler.
SMA's sinc response has the worst sidelobes of any common smoother: −13.3 dB (22% leakage) regardless of N. Same lag, Hann leaks 2.6%, Blackman 0.12%. Critical period ~2N. Use Hann or Blackman.
Every MA pays a lag tax. Symmetric FIR length N has lag (N−1)/2. On SPX, 200-day SMA captures 18% of a 10% move; 50-day captures 56%. WMA buys lag with phase distortion. Structural trade.
Every linear filter is y(t)=Σ b_k x(t−k)−Σ a_k y(t−k). H(z) has only negative powers, no z⁺¹. Filters summarize the past; they don't extrapolate. SMA(50) on next-day return: R²≈0.0002.
Feature engineering contributes 90-95% of the edge; model selection 5-10%. Same XGBoost: raw OHLC → SPX AUC 0.502; full statistical pipeline → 0.524. Features are IP. The model is a commodity.
Mean breakdown 1/n; median 0.5. On SPX 100-bar center through March 2020, mean spikes 5σ; median moves 0.4. Median for centering, MAD/IQR for spread, Spearman for correlation, LAD for regression.
A wrong-scale sigmoid destroys the signal. Center on training median; scale α so IQR lands in the linear region (α≈1.2 for tanh). On SPX Range/Close, α=1.2 lifts AUC 0.503 → 0.519.
The histogram is the primary diagnostic. Scalars (R/IQR, RE, MI, TCR) confuse shapes needing different fixes. Identical scalars hide light-tail, heavy-tail, or bimodal — only bimodal needs a split.
CMMA fixes Close − MA(k) with log prices, prev-bar MA, ATR with current bar, √(k+1) divisor. On SPX, test/train std ratio drops 5.25 → 1.03; MI lifts 1.4 → 2.0. Pool-compatible.
ATR captures within-bar and between-bar movement in the instrument's own units. On SPX 20d momentum, 2020/2017 std ratio drops 5.0 raw → 1.05 ATR-normalized, no MI loss. Structural, not heuristic.