Algorithmic Trading Based on Hidden Markov Models — Hidden Markov Models as a Forecasting Tool When Trying to Beat the Market
Introduction – All actors in the financial market strive towards earning risk-adjusted excess return. The recent decades new technology development have revolutionised financial markets and today’s actors are using advanced computer technology to develop trading algorithms in the pursue of earning excess returns. The trading algorithms are often based on statistical and mathematical models and the Hidden Markov Model (HMM) is one such model that has proven to be successful due to its ability to predict future price movements of financial assets. Purpose – The purpose of the study is to evaluate the use of Hidden Markov Models as a tool in algorithmic trading in the Swedish OMX Stockholm 30 index. Theoretical Framework – The HMM is a statistical model used to model stochastic processes and has historically been used in many areas where finance is one of them. The HMM is an extension to the Markov Model with the di˙erence that the system includes hidden states that are studied via correlated observable states. Method – In the study, two di˙erent trading algorithm based on the HMM were developed, a static and a dynamic. Both algorithms were backtested on two historical intraday data sets from OMXS30 in order to evaluate if the algorithms could make good predictions of future price movements and generate risk-adjusted excess return. A robustness test was also conducted to see how stable the performance of the algorithms were over time and over di˙erent market trends. Results – The results shows that the static model has a hit-ratio larger than 50 % for the first test period but not for the second. The dynamic model has a hit ratio above 50 % for both test periods. However, neither the results from the static nor the dynamic model is statistically significant. The results also show that the two algorithms performance were inconsistent over time and that the static model has better risk adjusted excess return than index for the first period but not the second one while the dynamic model outperformed index for the second test period but not for the first one. Furthermore, the robustness test indicates that both model’s hit ratio and performance were inconsistent over time. Discussion – The static and the dynamic HMM trading algorithms can earn risk-adjusted excess return during limited time frames, but the results could not be statistical proven. However, HMM as a tool for predicting stock markets should not be ruled out as both of the models tested give indications of being useful even though they seems unstable. An important aspect to consider is that HMMs depend on patterns in historical data that can be found again in future data. Thus, if the data set used in this study reflects an eÿcient market, the HMM becomes obsolete. Conclusions – It could not be concluded that the type of HMMs used in this study could perform better than random guesses of future price movements of OMXS30. Furthermore, it could not be concluded that the two trading algorithms developed in the study could generate risk-adjusted returns over time.
Cuellar Andersson, Josephine
Hidden Markov Model, prediction, forecast, finance, algorithmic trading, OMXS30.
Industriell och finansiell ekonomi