IDEAS home Printed from https://ideas.repec.org/a/gam/jijfss/v6y2018i2p36-d138097.html
   My bibliography  Save this article

Hidden Markov Model for Stock Trading

Author

Listed:
  • Nguyet Nguyen

    (Department of Mathematics & Statistics at Youngstown State University, 1 University Plaza, Youngstown, OH 44555, USA)

Abstract

Hidden Markov model (HMM) is a statistical signal prediction model, which has been widely used to predict economic regimes and stock prices. In this paper, we introduce the application of HMM in trading stocks (with S&P 500 index being an example) based on the stock price predictions. The procedure starts by using four criteria, including the Akaike information, the Bayesian information, the Hannan Quinn information, and the Bozdogan Consistent Akaike Information, in order to determine an optimal number of states for the HMM. The selected four-state HMM is then used to predict monthly closing prices of the S&P 500 index. For this work, the out-of-sample R OS 2 , and some other error estimators are used to test the HMM predictions against the historical average model. Finally, both the HMM and the historical average model are used to trade the S&P 500. The obtained results clearly prove that the HMM outperforms this traditional method in predicting and trading stocks.

Suggested Citation

  • Nguyet Nguyen, 2018. "Hidden Markov Model for Stock Trading," IJFS, MDPI, vol. 6(2), pages 1-17, March.
  • Handle: RePEc:gam:jijfss:v:6:y:2018:i:2:p:36-:d:138097
    as

    Download full text from publisher

    File URL: https://www.mdpi.com/2227-7072/6/2/36/pdf
    Download Restriction: no

    File URL: https://www.mdpi.com/2227-7072/6/2/36/
    Download Restriction: no
    ---><---

    References listed on IDEAS

    as
    1. Ivo Welch & Amit Goyal, 2008. "A Comprehensive Look at The Empirical Performance of Equity Premium Prediction," The Review of Financial Studies, Society for Financial Studies, vol. 21(4), pages 1455-1508, July.
    2. Andrew Ang & Geert Bekaert, 2002. "International Asset Allocation With Regime Shifts," The Review of Financial Studies, Society for Financial Studies, vol. 15(4), pages 1137-1187.
    3. John Y. Campbell & Samuel B. Thompson, 2008. "Predicting Excess Stock Returns Out of Sample: Can Anything Beat the Historical Average?," The Review of Financial Studies, Society for Financial Studies, vol. 21(4), pages 1509-1531, July.
    4. John Geweke & Nobuhiko Terui, 1993. "Bayesian Threshold Autoregressive Models For Nonlinear Time Series," Journal of Time Series Analysis, Wiley Blackwell, vol. 14(5), pages 441-454, September.
    5. Zhu, Xiaoneng & Zhu, Jie, 2013. "Predicting stock returns: A regime-switching combination approach and economic links," Journal of Banking & Finance, Elsevier, vol. 37(11), pages 4120-4133.
    6. Honda, Toshiki, 2003. "Optimal portfolio choice for unobservable and regime-switching mean returns," Journal of Economic Dynamics and Control, Elsevier, vol. 28(1), pages 45-78, October.
    7. Nguyet Nguyen & Dung Nguyen, 2015. "Hidden Markov Model for Stock Selection," Risks, MDPI, vol. 3(4), pages 1-19, October.
    8. Guidolin, Massimo & Timmermann, Allan, 2007. "Asset allocation under multivariate regime switching," Journal of Economic Dynamics and Control, Elsevier, vol. 31(11), pages 3503-3544, November.
    9. C. S. Wong & W. K. Li, 2000. "On a mixture autoregressive model," Journal of the Royal Statistical Society Series B, Royal Statistical Society, vol. 62(1), pages 95-115.
    10. Hamparsum Bozdogan, 1987. "Model selection and Akaike's Information Criterion (AIC): The general theory and its analytical extensions," Psychometrika, Springer;The Psychometric Society, vol. 52(3), pages 345-370, September.
    11. Clark, Todd E. & West, Kenneth D., 2007. "Approximately normal tests for equal predictive accuracy in nested models," Journal of Econometrics, Elsevier, vol. 138(1), pages 291-311, May.
    12. David E. Rapach & Jack K. Strauss & Guofu Zhou, 2010. "Out-of-Sample Equity Premium Prediction: Combination Forecasts and Links to the Real Economy," The Review of Financial Studies, Society for Financial Studies, vol. 23(2), pages 821-862, February.
    13. Jörn Sass & Ulrich Haussmann, 2004. "Optimizing the terminal wealth under partial information: The drift process as a continuous time Markov chain," Finance and Stochastics, Springer, vol. 8(4), pages 553-577, November.
    14. Hamilton, James D, 1989. "A New Approach to the Economic Analysis of Nonstationary Time Series and the Business Cycle," Econometrica, Econometric Society, vol. 57(2), pages 357-384, March.
    Full references (including those not matched with items on IDEAS)

    Citations

    Citations are extracted by the CitEc Project, subscribe to its RSS feed for this item.
    as


    Cited by:

    1. Pohle, Jennifer & Adam, Timo & Beumer, Larissa T., 2022. "Flexible estimation of the state dwell-time distribution in hidden semi-Markov models," Computational Statistics & Data Analysis, Elsevier, vol. 172(C).
    2. Mojtaba Sedighi & Hossein Jahangirnia & Mohsen Gharakhani & Saeed Farahani Fard, 2019. "A Novel Hybrid Model for Stock Price Forecasting Based on Metaheuristics and Support Vector Machine," Data, MDPI, vol. 4(2), pages 1-28, May.
    3. Vrontos, Spyridon D. & Galakis, John & Vrontos, Ioannis D., 2021. "Modeling and predicting U.S. recessions using machine learning techniques," International Journal of Forecasting, Elsevier, vol. 37(2), pages 647-671.
    4. Eun-chong Kim & Han-wook Jeong & Nak-young Lee, 2019. "Global Asset Allocation Strategy Using a Hidden Markov Model," JRFM, MDPI, vol. 12(4), pages 1-15, November.
    5. Danisman, Ozgur & Uzunoglu Kocer, Umay, 2021. "Hidden Markov models with binary dependence," Physica A: Statistical Mechanics and its Applications, Elsevier, vol. 567(C).
    6. Anton Gerunov, 2023. "Stock Returns Under Different Market Regimes: An Application of Markov Switching Models to 24 European Indices," Economic Studies journal, Bulgarian Academy of Sciences - Economic Research Institute, issue 1, pages 18-35.
    7. Lennart Oelschlager & Timo Adam, 2020. "Detecting bearish and bullish markets in financial time series using hierarchical hidden Markov models," Papers 2007.14874, arXiv.org.
    8. Hosun Ryou & Han Hee Bae & Hee Soo Lee & Kyong Joo Oh, 2020. "Momentum Investment Strategy Using a Hidden Markov Model," Sustainability, MDPI, vol. 12(17), pages 1-16, August.
    9. Reetam Majumder & Qing Ji & Nagaraj K. Neerchal, 2023. "Optimal Stock Portfolio Selection with a Multivariate Hidden Markov Model," Sankhya B: The Indian Journal of Statistics, Springer;Indian Statistical Institute, vol. 85(1), pages 177-198, May.
    10. Guglielmo D’Amico & Philippe Regnault & Stefania Scocchera & Loriano Storchi, 2018. "A Continuous-Time Inequality Measure Applied to Financial Risk: The Case of the European Union," IJFS, MDPI, vol. 6(3), pages 1-16, June.

    Most related items

    These are the items that most often cite the same works as this one and are cited by the same works as this one.
    1. Haase, Felix & Neuenkirch, Matthias, 2023. "Predictability of bull and bear markets: A new look at forecasting stock market regimes (and returns) in the US," International Journal of Forecasting, Elsevier, vol. 39(2), pages 587-605.
    2. Rapach, David & Zhou, Guofu, 2013. "Forecasting Stock Returns," Handbook of Economic Forecasting, in: G. Elliott & C. Granger & A. Timmermann (ed.), Handbook of Economic Forecasting, edition 1, volume 2, chapter 0, pages 328-383, Elsevier.
    3. Yaojie Zhang & Feng Ma & Chao Liang & Yi Zhang, 2021. "Good variance, bad variance, and stock return predictability," International Journal of Finance & Economics, John Wiley & Sons, Ltd., vol. 26(3), pages 4410-4423, July.
    4. Zhang, Yaojie & Lei, Likun & Wei, Yu, 2020. "Forecasting the Chinese stock market volatility with international market volatilities: The role of regime switching," The North American Journal of Economics and Finance, Elsevier, vol. 52(C).
    5. Nonejad, Nima, 2021. "Predicting equity premium using news-based economic policy uncertainty: Not all uncertainty changes are equally important," International Review of Financial Analysis, Elsevier, vol. 77(C).
    6. Baltas, Nick & Karyampas, Dimitrios, 2018. "Forecasting the equity risk premium: The importance of regime-dependent evaluation," Journal of Financial Markets, Elsevier, vol. 38(C), pages 83-102.
    7. Wang, Yudong & Wei, Yu & Wu, Chongfeng & Yin, Libo, 2018. "Oil and the short-term predictability of stock return volatility," Journal of Empirical Finance, Elsevier, vol. 47(C), pages 90-104.
    8. Faria, Gonçalo & Verona, Fabio, 2023. "Forecast combination in the frequency domain," Bank of Finland Research Discussion Papers 1/2023, Bank of Finland.
    9. Yi, Yongsheng & Ma, Feng & Zhang, Yaojie & Huang, Dengshi, 2019. "Forecasting stock returns with cycle-decomposed predictors," International Review of Financial Analysis, Elsevier, vol. 64(C), pages 250-261.
    10. Wen, Danyan & Liu, Li & Wang, Yudong & Zhang, Yaojie, 2022. "Forecasting crude oil market returns: Enhanced moving average technical indicators," Resources Policy, Elsevier, vol. 76(C).
    11. Haibin Xie & Shouyang Wang, 2015. "Risk-return trade-off, information diffusion, and U.S. stock market predictability," International Journal of Financial Engineering (IJFE), World Scientific Publishing Co. Pte. Ltd., vol. 2(04), pages 1-20, December.
    12. José Afonso Faias & Juan Arismendi Zambrano, 2022. "Equity Risk Premium Predictability from Cross-Sectoral Downturns [International asset allocation with regime shifts]," The Review of Asset Pricing Studies, Society for Financial Studies, vol. 12(3), pages 808-842.
    13. Patrick Bielstein, 2018. "International asset allocation using the market implied cost of capital," Financial Markets and Portfolio Management, Springer;Swiss Society for Financial Market Research, vol. 32(1), pages 17-51, February.
    14. Smith, Simon C., 2021. "International stock return predictability," International Review of Financial Analysis, Elsevier, vol. 78(C).
    15. He, Mengxi & Zhang, Yaojie & Wen, Danyan & Wang, Yudong, 2021. "Forecasting crude oil prices: A scaled PCA approach," Energy Economics, Elsevier, vol. 97(C).
    16. Joscha Beckmann & Rainer Schüssler, 2014. "Forecasting Equity Premia using Bayesian Dynamic Model Averaging," CQE Working Papers 2914, Center for Quantitative Economics (CQE), University of Muenster.
    17. Dai, Zhifeng & Zhou, Huiting & Wen, Fenghua & He, Shaoyi, 2020. "Efficient predictability of stock return volatility: The role of stock market implied volatility," The North American Journal of Economics and Finance, Elsevier, vol. 52(C).
    18. Hammerschmid, Regina & Lohre, Harald, 2018. "Regime shifts and stock return predictability," International Review of Economics & Finance, Elsevier, vol. 56(C), pages 138-160.
    19. Dichtl, Hubert & Drobetz, Wolfgang & Neuhierl, Andreas & Wendt, Viktoria-Sophie, 2021. "Data snooping in equity premium prediction," International Journal of Forecasting, Elsevier, vol. 37(1), pages 72-94.
    20. Baetje, Fabian & Menkhoff, Lukas, 2016. "Equity premium prediction: Are economic and technical indicators unstable?," International Journal of Forecasting, Elsevier, vol. 32(4), pages 1193-1207.

    Corrections

    All material on this site has been provided by the respective publishers and authors. You can help correct errors and omissions. When requesting a correction, please mention this item's handle: RePEc:gam:jijfss:v:6:y:2018:i:2:p:36-:d:138097. See general information about how to correct material in RePEc.

    If you have authored this item and are not yet registered with RePEc, we encourage you to do it here. This allows to link your profile to this item. It also allows you to accept potential citations to this item that we are uncertain about.

    If CitEc recognized a bibliographic reference but did not link an item in RePEc to it, you can help with this form .

    If you know of missing items citing this one, you can help us creating those links by adding the relevant references in the same way as above, for each refering item. If you are a registered author of this item, you may also want to check the "citations" tab in your RePEc Author Service profile, as there may be some citations waiting for confirmation.

    For technical questions regarding this item, or to correct its authors, title, abstract, bibliographic or download information, contact: MDPI Indexing Manager (email available below). General contact details of provider: https://www.mdpi.com .

    Please note that corrections may take a couple of weeks to filter through the various RePEc services.

    IDEAS is a RePEc service. RePEc uses bibliographic data supplied by the respective publishers.