OPEN-SOURCE SCRIPT

TASC 2025.01 Linear Predictive Filters

█ OVERVIEW

This script implements a suite of tools for identifying and utilizing dominant cycles in time series data, as introduced by John Ehlers in the "Linear Predictive Filters And Instantaneous Frequency" article featured in the January 2025 edition of TASC's Traders' Tips. Dominant cycle information can help traders adapt their indicators and strategies to changing market conditions.


█ CONCEPTS

Conventional technical indicators and strategies often rely on static, unchanging parameters, which may fail to account for the dynamic nature of market data. In his article, John Ehlers applies digital signal processing principles to address this issue, introducing linear predictive filters to identify cyclic information for adapting indicators and strategies to evolving market conditions.

This approach treats market data as a complex series in the time domain. Analyzing the series in the frequency domain reveals information about its cyclic components. To reduce the impact of frequencies outside a range of interest and focus on a specific range of cycles, Ehlers applies second-order highpass and lowpass filters to the price data, which attenuate or remove wavelengths outside the desired range. This band-limited analysis isolates specific parts of the frequency spectrum for various trading styles, e.g., longer wavelengths for position trading or shorter wavelengths for swing trading.

After filtering the series to produce band-limited data, Ehlers applies a linear predictive filter to predict future values a few bars ahead. The filter, calculated based on the techniques proposed by Lloyd Griffiths, adaptively minimizes the error between the latest data point and prediction, successively adjusting its coefficients to align with the band-limited series. The filter's coefficients can then be applied to generate an adaptive estimate of the band-limited data's structure in the frequency domain and identify the dominant cycle.


█ USAGE

This script implements the following tools presented in the article:
  • Griffiths Predictor
    This tool calculates a linear predictive filter to forecast future data points in band-limited price data. The crosses between the prediction and signal lines can provide potential trade signals.
  • Griffiths Spectrum
    This tool calculates a partial frequency spectrum of the band-limited price data derived from the linear predictive filter's coefficients, displaying a color-coded representation of the frequency information in the pane.
  • Griffiths Dominant Cycle
    This tool compares the cyclic components within the partial spectrum and identifies the frequency with the highest power, i.e., the dominant cycle. Traders can use this dominant cycle information to tune other indicators and strategies, which may help promote better alignment with dynamic market conditions.


Notes on parameters

Bandpass boundaries:
In the article, Ehlers recommends an upper bound of 125 bars or higher to capture longer-term cycles for position trading. He recommends an upper bound of 40 bars and a lower bound of 18 bars for swing trading. If traders use smaller lower bounds, Ehlers advises a minimum of eight bars to minimize the potential effects of aliasing.

Data length:
The Griffiths predictor can use a relatively small data length, as autocorrelation diminishes rapidly with lag. However, for optimal spectrum and dominant cycle calculations, the length must match or exceed the upper bound of the bandpass filter. Ehlers recommends avoiding excessively long lengths to maintain responsiveness to shorter-term cycles.
Cyclesehlerstasc

오픈 소스 스크립트

진정한 TradingView 정신에 따라, 이 스크립트의 저자는 트레이더들이 이해하고 검증할 수 있도록 오픈 소스로 공개했습니다. 저자에게 박수를 보냅니다! 이 코드는 무료로 사용할 수 있지만, 출판물에서 이 코드를 재사용하는 것은 하우스 룰에 의해 관리됩니다. 님은 즐겨찾기로 이 스크립트를 차트에서 쓸 수 있습니다.

차트에 이 스크립트를 사용하시겠습니까?


Tools and ideas for all Pine coders: tradingview.com/u/PineCoders/
Pine news broadcasts: t.me/PineCodersSquawkBox or twitter.com/PineCoders
TASC: traders.com/
또한 다음에서도:

면책사항