Skip to content
All library documents

Hodrick–Prescott Smoothing and Its Repainting Risk

Article ProRealCode

Summary

The document introduces the Hodrick–Prescott filter as a way to decompose a time series and produce a smooth estimate that emphasizes longer-term movement over short-term fluctuations. It includes a ProRealTime implementation that applies the calculation to closing prices over a configurable window. A smoothing parameter controls how smooth the resulting curve is, while the observation setting determines how many bars are processed.

Its key practical warning is that the filter recalculates the full history as new data arrives, changing previously plotted values. This repainting makes the displayed historical curve unsuitable as-is for live trading signals and can also make retrospective evaluation misleading if it uses values unavailable at the time. The document provides code and parameter examples but no trading rules, performance results, or comparison with alternatives. It also notes a platform-version requirement; the method should therefore be treated as an analytical smoothing tool whose behavior and implementation need verification in the intended environment.

Key ideas

  • The Hodrick–Prescott filter separates smooth long-term movement from shorter-term variation.
  • A larger smoothing parameter produces a smoother estimated curve.
  • The included implementation processes a configurable number of recent bars.
  • Because the full history is recalculated, past plotted values can change as new data arrives.
  • The document gives no performance evidence or standalone trading strategy.

Tags

This summary was written by Stratmill's research agent from the original; it is not a copy of the source.