Concept
Roofing Filter
Roofing Filter is a Statistics concept. The Library holds 1 implementation — a working definition you can pull into Quant.
Top Roofing Filter indicator
The top custom implementation, built on the original standard Roofing Filter formula.
1 total
From studying Roofing Filter to trading it: take the implementation below into Quant and backtest it instantly.
What is a Roofing Filter?
A roofing filter is John Ehlers' preprocessing bandpass for indicator inputs. It chains two stages: a two-pole high-pass filter removes components with periods longer than an upper cutoff (48 bars in Ehlers' published defaults), stripping out trend and drift, then his SuperSmoother low-pass removes periods shorter than a lower cutoff (10 bars), suppressing bar-to-bar noise and aliasing. What survives is the band between the two, the 'roof': the cycle-scale swings oscillators are actually meant to trade.
Ehlers came to trading from aerospace engineering and built his career applying digital signal processing to price series. The roofing filter is the recommended first stage throughout his book Cycle Analytics for Traders (2013), and its rationale is what he calls spectral dilation: in his measurements, the amplitude of market swings grows roughly in proportion to their period, so slow components dominate any unfiltered calculation and drown out the shorter cycles a trader wants to see. The high-pass stage removes that heavy low-frequency content and corrects the tilt in one step.
Oscillators computed on raw price inherit trend distortion: in a persistent uptrend a stochastic pins high and its overbought readings stop marking reversals. Computed on roofed data, the same oscillator swings around a zero-mean input, so overbought and oversold regain meaning, and downstream dominant cycle measurement sees a much cleaner signal. The cost is the one all filters pay: a few bars of lag, and blindness to anything outside the passband, which is precisely the design intent.
The filter also matters as a gateway to frequency-domain work. Tools built on FFT/spectral analysis or the Hilbert transform behave poorly on broadband input, where trend leakage smears every estimate; roofing the series first band-limits it so they measure the region of interest. On its own the filter produces no buy or sell information. It is plumbing, and its value shows up in whatever gets computed downstream.
How to identify a roofing filter on a chart
Roofing filters live inside indicators rather than on price, so identifying one means recognizing roofed output and checking the settings behind it.
- 1Open the indicator's settings and look for paired cutoffs, a high-pass period near 48 bars and a low-pass period near 10 in Ehlers' defaults; that pair defines the passband.
- 2Check the pane: roofed output oscillates around zero with no persistent drift, even while the price series above it trends strongly.
- 3Compare it with the same oscillator on raw price: the roofed version stops pinning at one extreme during trends and swings more symmetrically.
- 4Expect a small delay: turns in roofed output arrive a few bars after the matching price turns, the normal cost of a causal filter.
- 5Confirm the passband brackets your horizon: swings faster than the low cutoff or slower than the high cutoff are invisible to the filter by design.
How it's calculated
A band-pass preprocessing filter that removes both slow trend and fast noise, keeping only cycle components in the tradable band.
From John Ehlers' Cycle Analytics for Traders (2013); the defaults pass cycle periods between roughly 10 and 48 bars.
Arguments of cos and sin are in degrees, matching Ehlers' original code.
Seed HP and Roof at 0 for the first two bars; the output is commonly fed into oscillators such as Ehlers' modified Stochastic.
How traders use it
- As an oscillator front end: stochastics, RSI, and custom oscillators computed on roofed output produce cleaner, more symmetric overbought/oversold swings than the same tools on raw price.
- As the standard preprocessing stage before cycle measurement, including autocorrelation periodograms, where leftover trend would otherwise dominate the spectrum and mask the tradable period.
- As a detrended series in its own right: zero crossings and turns of the roofed output mark cycle-scale swing shifts without any further indicator.
- With normalization stacked on top: roofed output has no fixed scale, so it is commonly standardized with automatic gain control, a rolling Z-score, or a percentile rank before fixed thresholds are applied.
- Inside regime-aware systems: because the bandpass deliberately discards trend, roofed-oscillator signals are often taken only in the direction of a separate trend measure, restoring the information the filter removed.
Roofing Filter vs other cycle tools
Dominant Cycle Measurement: One is preparation, the other estimation: the roofing filter shapes price into a band-limited series, and dominant cycle measurement estimates the strongest period inside that band. Ehlers' cycle estimators assume roofed or similarly filtered input.
FFT/spectral Analysis: Spectral analysis decomposes a series into its full spectrum of periods; a roofing filter simply passes one chosen band and discards the rest. They pair naturally, with roofing applied first so trend leakage does not smear the spectrum.
Hilbert Transform: The Hilbert transform extracts instantaneous phase and period but assumes a narrowband input; fed raw price, its estimates wander. Roofing supplies the band-limited signal it needs, which is why the two appear together throughout Ehlers' work.
Concept family
Statistics
46 concepts mapped · 46 in the Library
Roofing Filter FAQ
What does a roofing filter remove from price data?
Both ends of the spectrum. The high-pass stage removes slow components, trend and drift with periods longer than the upper cutoff, and the SuperSmoother stage removes fast components, noise with periods shorter than the lower cutoff. What passes is the middle band of cycle-scale swings, roughly 10-to-48-bar periods at Ehlers' defaults, with both cutoffs adjustable.
Why apply a roofing filter before an oscillator?
Because oscillators assume their input swings around a stable mean, and trending price does not. Trend leakage makes a stochastic or RSI pin at one extreme and produce false reversal readings. Roofing the input strips the trend and the finest noise first, so the oscillator measures the cycle it was designed for. The trade-off is a small amount of added lag.
Who invented the roofing filter?
John Ehlers, the engineer behind MESA and decades of DSP-based trading tools. He presented the roofing filter in Cycle Analytics for Traders (2013) as a near-universal preprocessing stage, and popular charting implementations, including LazyBear's TradingView ports, are built from his published code.
What are typical roofing filter settings?
Ehlers' defaults pass periods between roughly 10 and 48 bars. Both cutoffs are adjustable and should bracket the swing length you trade: widen the band and more trend and noise leak through; narrow it too far and the output starts ringing at whatever period the filter favors.
Is a roofing filter the same as detrending?
Detrending is half of it. Subtracting a moving average or a linear regression fit removes only the slow side, leaving fast noise intact. A roofing filter is detrending plus smoothing in one causal chain: the high-pass handles trend, the SuperSmoother handles noise.
Does a roofing filter predict price?
No. It is a transformation, not a forecast: it reshapes the input so cycle-scale structure is easier to measure, at the cost of lag and total blindness outside the passband. Any predictive claim belongs to the indicator built on top of it and has to be tested there.
Turn Roofing Filter into a trading strategy.
Take the implementation from this page into Quant, then build on it, backtest it on real data, and keep refining it with AI.
