Ehlers Bandpass Filter

Ehlers Bandpass Filter, also known as Band-pass filter, Digital resonator, is a Statistics concept. The Library holds 2 implementations, each one a working definition you can pull into Quant.

Top Ehlers Bandpass Filter indicators

The top custom implementations, built on the original standard Ehlers Bandpass Filter formula.

2 total

From studying Ehlers Bandpass Filter to trading it: take any implementation below into Quant and backtest it instantly.

What is the Ehlers bandpass filter?

The Ehlers bandpass filter is a second-order recursive filter, published by John Ehlers, that is tuned to one cycle period and a bandwidth around it. Price components near the chosen period pass with little attenuation (exactly none at the center), while slower ones (trend) and faster ones (bar-to-bar noise) are attenuated, so the output is a zero-mean oscillator tracing the selected cycle. In signal-processing terms it is a resonator, a two-pole filter whose response peaks at the center period.

Ehlers published the code in 'Corona Charts' (Technical Analysis of Stocks & Commodities, November 2008) and reused it in 'Empirical Mode Decomposition' with Ric Way (March 2010), with the bar midpoint as input, a 20-bar center period and a half-bandwidth of 0.1, which passes cycles of roughly 18 to 22 bars. It reappears in his later work, including Cycle Analytics for Traders (2013).

Bandwidth is the central tradeoff. A narrow band is selective but has a long memory: in Ehlers' words it can 'ring out like a bell' once energized. A wider band follows a changing cycle faster but admits more trend and noise. At the center period the filter adds no phase shift; off-center components are attenuated and shifted, so when the market's cycle drifts from the tuned period, the output's turns drift from price's.

How it's calculated

One recursion with coefficients derived from the center period and the bandwidth (angles in degrees, as in Ehlers' code):

β=cos⁡(360/P)\beta = \cos(360 / P)
γ=1cos⁡(720×δ/P)\gamma = \frac{1}{\cos(720 \times \delta / P)}
α=γ−γ2−1\alpha = \gamma - \sqrt{\gamma^2 - 1}
BP⁡t=0.5×(1−α)×(xt−xt−2)+β×(1+α)×BP⁡t−1−α×BP⁡t−2\operatorname{BP}_t = 0.5 \times (1 - \alpha) \times (x_t - x_{t-2}) + \beta \times (1 + \alpha) \times \operatorname{BP}_{t-1} - \alpha \times \operatorname{BP}_{t-2}
x_t: input price at bar t (Ehlers uses (high + low) / 2)
P: center period in bars (default 20)
δ: half-bandwidth as a fraction of P (default 0.1, passing roughly P × (1 ± δ))
β: cosine term placing the center period
γ: bandwidth term
α: pole coefficient; closer to 1 means a narrower band and longer ringing
BP_t: bandpass output at bar t
t: current bar

The x_t - x_(t-2) term zeroes the response to a constant level, so the output centers on zero; 0.5 × (1 - α) scales the gain to exactly 1 at the center period.

Some code takes the full bandwidth BW = 2δ, with γ = 1 / cos(360 × BW / P); the filter is the same. LuxAlgo's Normalized Resonator uses this full-width input.

Seed BP at 0 for the first two bars; narrow bands need many warm-up bars.

How traders use it

  • Cycle timing: turns and zero crossings of the output mark the swings of the tuned cycle, used when the market is ranging and a cycle is actually present.
  • Normalized for fixed thresholds: raw output swells and shrinks with volatility. LuxAlgo's Normalized Resonator runs the filter on the bar midpoint (100-bar center period and 0.5 bandwidth by default), divides it by its highest absolute value over a window tied to the center period, adds a 9-period EMA signal line, and labels signal-line crosses beyond ±0.8.
  • Side-by-side comparison: the band-pass row of the Swiss Army Knife filter is this filter, so the Library's Swiss Army Knife Filter build can run it next to other responses on identical code.
  • With honest limits: in strong trends the tuned cycle carries little of the move, and the oscillator can swing while price trends.

Ehlers bandpass filter vs related cycle tools

Roofing Filter: Also a bandpass, but a wide one built from a high-pass stage and a SuperSmoother to prepare data for other indicators. The Ehlers bandpass is a narrow resonant filter that isolates one cycle and is read directly.

Swiss Army Knife Filter: The general second-order recursion with swappable coefficients. Its band-pass row is this filter; the dedicated version fixes that row and exposes period and bandwidth.

Dominant Cycle Measurement: Measurement estimates which period is strongest; the bandpass isolates a period once chosen. Filter-bank estimators run many bandpasses and keep the one with the most power.

Concept family

Statistics

45 concepts mapped · 45 in the Library

Ehlers Bandpass Filter FAQ

Turn Ehlers Bandpass Filter into a trading strategy.

Take any implementation from this page into Quant, then build on it, backtest it on real data, and keep refining it in conversation.