Hodrick-Prescott Filter (untradable)

Top  Previous  Next

Category: Advanced Indicator Set 1

 

Input parameters

Name

Setting

Default

Input Series

Input Time Series

Close

Smoothing

0 < Real < 1e+38

10000

Detrend Flag

Integer 0 or 1

0

Detrend Flag = 0 displays the trend line, Detrend Flag = 1 displays the detrended Input Series, i.e. Input Series minus trend line.

 

Calculations

Given Input Time Series y(i), where i=1..N, the Hodrick-Prescott Filter produces a smoothed trend line s(i), which minimizes the following objective function F:

F = Sum(i=1 to N)[y(i) - s(i)]^2 + Smoothing * Sum(i=2 to N-1)[(s(i+1)-s(i)) – (s(i)-s(i-1))]^2

 

Discussion

When Detrend Flag = 0, the Hodrick-Prescott Filter removes the high frequency components from the input time series and shows the smoothed trend line s(i).

When Detrend Flag = 1, the Hodrick-Prescott Filter calculates the trend line s(i) and removes this trend line from the Input Series. The indicator output in this case is the detrended Input Series. This may be helpful for removing long-term trends and/or seasonal variations from price time series.

The larger the Smoothing parameter the smoother the trend line s(i) is. As the Smoothing parameter goes to infinity, the trend line s(i) becomes a linear trend. For quarterly data Hodrick and Prescott [1] used Smoothing=1600. For monthly data a commonly accepted value in the literature is 14400. For daily data the Smoothing parameter can be anywhere from 10000 to 10^8 or even higher depending on the Input Series behavior and required smoothing degree. If Smoothing is set to  1e+38 or higher, the NeuroShell Trader resets Smoothing to zero (however, zero is not an allowed setting for the Smoothing).

NOTE. The Hodrick-Prescott filter CANNOT be used in trading strategies or neural nets used in trading strategies. This indicator was designed to be viewed as a trend curve through the entire set of data. It is not appropriate for use in a trading strategy because new data bars can cause the trend line to change the trend through past data. This in turn can cause the NeuroShell Trader signals to change in the past. Use this indicator ONLY for viewing in a static chart, but do NOT insert it in a trading strategy or a neural net used for trading. Use Hodrick-Prescott Window indicator instead.

 

References

1. Hodrick, Robert J. and Prescott, Edward C., "Post-War U.S. Business Cycles: An Empirical Investigation", Working Paper, Carnegie-Mellon University, November, 1980.

2. Prescott, Edward C., "Theory Ahead of Business Cycle Measurement", Quaterly Review, Federal Reserve Bank of Minneapolis, Fall 1986.