- red is the underlying price (sine wave plus noise); e.g. typical price, vwap, close etc.
- the yellow dots are "measurement noise;" e.g. high-low range
- cyan is the Kalman filter itself
- green are the 2 Sigma confidence levels for the filter
- magenta is my current "MESA" implementation
Sunday, 11 March 2012
Over the years, on and off, I have tried to find code or otherwise code for myself a Kalman filter but unfortunately I have never really found what I want; the best I have at the moment is an implementation that is available from the technical papers and seminars section at the MESA Software web page. However, I recently read this R-Bloggers post which inspired me to look again for code on the web, and this time I found this, which is exactly what I want; accessible Octave like code that will enable me to fully understand (I hope!) the theory behind the Kalman filter and to be able to code my own Kalman filter function. After a little tinkering with the code (mostly plotting and inputs) a typical script run produces this plot: