Hodrick-Prescott Filter (HP)
Category: trend, cycle
A causal approximation of the Hodrick-Prescott Filter used to decompose a time series into trend and cyclical components without future-leakage.
Formula
\alpha = \frac{\sqrt{\lambda} \cdot 0.5 - 1}{\sqrt{\lambda} \cdot 0.5 + 1} \newline HP_{trend} = (1 - \alpha) \cdot src + \alpha \cdot HP_{trend-1} + 0.5 \cdot \alpha \cdot (HP_{trend-1} - HP_{trend-2}) \newline HP_{cycle} = src - HP_{trend}
Inputs
- i_source (default: close)
- i_lambda (default: 677.0)
See signal primitives and every published strategy that uses Hodrick-Prescott Filter (HP) on WOBR StrategyVerse.