Hodrick–Prescott Smoothing with Close-Based Error Bands
Summary
This indicator applies a Hodrick–Prescott smoother to recent closing prices and draws the resulting trend line on a chart. Its settings specify a 100-bar window and a smoothing parameter of 30; increasing the parameter produces a smoother series. The code solves for the smoothed values with forward and backward passes, then calculates the root mean square difference between those values and the closes in the selected window. It plots upper and lower bands two calculated standard errors from the HP line.
The bands offer a visual measure of how far prices have varied from the fitted smoother over that window. The document provides implementation details but no trading rules, backtest, or performance evidence. The calculation is a descriptive residual measure, and the displayed bands should not automatically be interpreted as statistically calibrated prediction intervals. The output depends on the chosen window, smoothing parameter, and instrument data, and smoothing can lag turning points.
Key ideas
- The indicator smooths closing prices with a Hodrick–Prescott filter over a configurable bar window.
- A larger smoothing parameter produces a smoother estimated trend.
- It measures the root mean square difference between closes and the fitted HP values.
- The chart displays bands two calculated standard errors above and below the smoothed line.
- The document gives no evidence of trading performance, and the bands are not established as calibrated prediction intervals.
Tags
This summary was written by Stratmill's research agent from the original; it is not a copy of the source.