Concept

Hodrick-Prescott Filter

Hodrick-Prescott Filter is a Statistics concept. The Library holds 1 implementations, each one a working definition you can pull into Quant.

Top Hodrick-Prescott Filter indicators

1 total

What is the Hodrick-Prescott Filter?

The Hodrick-Prescott (HP) filter is a trend-extraction method from macroeconometrics, introduced to economics by Robert Hodrick and Edward Prescott for separating business-cycle fluctuations from long-run growth. It chooses the trend that minimizes a two-part objective: the sum of squared gaps between the series and the trend (fit), plus lambda times the sum of squared second differences of the trend (a penalty on changes in its slope). Small lambda lets the trend hug the data; as lambda grows the trend stiffens, approaching a straight line in the limit. Mathematically it is a special case of the earlier Whittaker-Henderson smoother with a second-difference penalty.

On charts the filter splits price into a smooth trend and a cycle residual, and adaptations draw envelopes around the smooth to frame stretch and reversion. The critical caveat for trading is that the standard filter is two-sided: each point's trend value is fitted using data on both sides of it, so values near the right edge revise as new bars arrive. Endpoint distortion is a standard criticism in the economics literature as well, and on a chart it means naive use repaints; one-sided (causal) variants avoid revision at the cost of extra lag.

How traders use it

  • Trend-cycle decomposition: subtract the HP trend from price to get a detrended oscillator around zero, a simple entry point into signal decomposition and cycle study.
  • Envelope construction: offset bands around the HP trend (by a volatility unit or a fixed percentage) to frame overextension and mean-reversion zones with a smoother midline than a moving average.
  • Higher-timeframe bias reference, provided the two-sided revision is handled honestly: evaluated on confirmed history, replaced with a one-sided variant, or treated as descriptive rather than tradable, in line with repaint-safe engineering.

Related concepts · Regression & filtering

Concept family

Statistics

45 concepts mapped · 37 in the Library

Hodrick-Prescott Filter FAQ

Why does the Hodrick-Prescott filter repaint on charts?

Because the standard HP filter is a two-sided smoother: every point's trend value is estimated using bars before and after it. At the right edge the future half is missing, so the newest trend values are provisional and shift as bars are added, which moves plotted history. Fixes include one-sided causal variants, evaluating signals only on data old enough to be stable, or using the filter descriptively rather than as a signal source.

What does lambda control in the HP filter?

Lambda is the smoothness weight. It multiplies the penalty on squared changes in the trend's slope, so it decides how much wiggle the trend is allowed: near zero the trend chases price, and as lambda grows toward infinity the trend approaches a straight line. Macroeconomists conventionally use 1600 for quarterly data, but there is no agreed value for market bars, so chart implementations expose lambda as a tuning input.

Build Hodrick-Prescott Filter your way.

Quant writes, tests, and refines it with you — then it runs on LuxAlgo charting or ports to TradingView.