I recently discovered how to implement a zero lag filter and wanted to share it here.
Use your favorite IIR (recursive) filter and use in a bidirectional (aka forward-backward) method.
https://www.dspguide.com/ch19/4.htm
This works by forward filtering price using the recursive feature of an IIR filter, and then filtering the forward data in reverse via reverse recursion. This is the filtfilt function in MatLab.
http://www.mathworks.com/help/signal/ref/filtfilt.html
http://stackoverflow.com/questions/17675053/matlabs-filtfilt-algorithm
This forward-backward method produces a zero phase response in the frequency domain, which results in zero lag in the time domain (by convolving the impulse responses.) I personally use John Ehlers' 2-pole supersmoother as the IIR filter and use a 10 day period as the filter cutoff.
The filtered data can be traded directly in a trend following method, or used as input into other technical indicators, such as RSI.
Use your favorite IIR (recursive) filter and use in a bidirectional (aka forward-backward) method.
https://www.dspguide.com/ch19/4.htm
This works by forward filtering price using the recursive feature of an IIR filter, and then filtering the forward data in reverse via reverse recursion. This is the filtfilt function in MatLab.
http://www.mathworks.com/help/signal/ref/filtfilt.html
http://stackoverflow.com/questions/17675053/matlabs-filtfilt-algorithm
This forward-backward method produces a zero phase response in the frequency domain, which results in zero lag in the time domain (by convolving the impulse responses.) I personally use John Ehlers' 2-pole supersmoother as the IIR filter and use a 10 day period as the filter cutoff.
The filtered data can be traded directly in a trend following method, or used as input into other technical indicators, such as RSI.


Long time since I saw some DSP stuff. Had to go through 1 year of analysing that fluff..