OPEN-SOURCE SCRIPT

Hodrick-Prescott (HP) filter

Updated
This indicator is an implamentation of Hodrick-Prescott (HP) filter
This filter is a mathematical model the can remove cyclical components from the price signal to get the trend components.
  • "Lambda" is the smoothing factor and can have a value between 1 and infinity.
  • "Length" is the number of previous prices that are included in the filter.

The default values of lambda and length work well for almost all time frames.

snapshot
Release Notes
Converted to v5
hodrickprescottHPMoving Averages

Open-source script

In true TradingView spirit, the author of this script has published it open-source, so traders can understand and verify it. Cheers to the author! You may use it for free, but reuse of this code in publication is governed by House rules. You can favorite it to use it on a chart.

Want to use this script on a chart?


Also on:

Disclaimer