Predicting Market Data Using The Kalman Filter by R. Martinelli & N. Rhoads
The Kalman filter is a two-stage algorithm that assumes there is a smooth trendline within the data that represents the true value of the market before being perturbed by market noise. Can this filter be used to forecast stock price movements?
Figure 1 shows daily opens for one year (252 days) of Ford Motor Co. (F). According to modern financial engineering principles, market data such as this is considered to be Brownian motion, which means that the daily price changes form a white-noise process. White noise is a random process in which consecutive values are independent of each other, among other things, which means that each day, a price increase is just as likely as a decrease. In reality, it is not uncommon for a particular market item to have several consecutive down days or up days over a short time span. During such times, the prices are said to be correlated. The objective is to harness these correlations with a Kalman filter so you can forecast price movements.
In a 2006 article for Stocks & Commodities, a simple linear extrapolation was employed to predict tomorrow’s price change. The prediction was then used to calculate the alpha statistic, which compares the predicted price change to a recent average of price changes. Relatively large, positive values of alpha indicate a long position, and relatively large negative values indicate a short one. This procedure was backtested on a random selection of stocks and indexes to test its effectiveness. The indicated positions were taken, closed out the next trading day, and all profits and losses were accumulated in a chart called the Fortune. Surprisingly, of the 28 items tested, 20 produced greater profits than a simple buy & hold position for the same time period.
In this article, we will expand on the previous work, replacing the simple one-day predictor with a Kalman filter. The Kalman, as applied here, is a two-stage algorithm that assumes there is a smooth trendline within the data that represents the true value of the market item before being perturbed by market noise. In the first stage, a few previous trendline values are fit to a suitable model. It is then extrapolated to the next time value to generate a prediction and its error variance.