Welcome to Francis Academic Press

Academic Journal of Computing & Information Science, 2022, 5(11); doi: 10.25236/AJCIS.2022.051102.

Stock Price Prediction Based on Discrete Hidden Markov Chain


Wenxuan Qiu, Hongye Cai

Corresponding Author:
Wenxuan Qiu

College of Mathematics and Statistic, Shenzhen University, Shenzhen, 518060, China


Stock forecasting has always been the center of the financial market. This paper uses the Discrete Hidden Markov Model (HMM) to predict stock price. The initial data of stock price is denoised by wavelet, and the denoised data is processed as the input data of HMM, and the number of implicit states that make the model most robust is determined by using OEHS criteria. The model is trained by Baum- Welch-Algo algorithm to obtain the correlation matrix parameters, and then the implicit state with the maximum probability is obtained by the Viterbi algorithm. This paper also introduces the Voting Strategy to improve the probability of accurate prediction. Finally, according to the Observation emission matrix, the probability distribution of the return rate of the next day is obtained, and the stock price is obtained. The accuracy of the predicted value is tested by MAPE. The experimental results show that the Discrete Hidden Markov model can better predict the future stock price trend. The accuracy of the predicted value was tested by MAPE, and the value was 0.0284.


Vanke A; HMM model; Wavelet denoising; Baumwelchalgo algorithm

Cite This Paper

Wenxuan Qiu, Hongye Cai. Stock Price Prediction Based on Discrete Hidden Markov Chain. Academic Journal of Computing & Information Science (2022), Vol. 5, Issue 11: 10-17. https://doi.org/10.25236/AJCIS.2022.051102.


[1] Zhang Xuan. Empirical research on stock price prediction based on Hidden Markov model and support vector machine [D]. Shandong University, 2019

[2] Box G, Jenkins G. Time series analysis: forecasting and control[M]. San Francisco: Holden-Day, 1976:2-11.

[3] Engle R F. Autoregressive conditional heteroscedasticity with estimates of the variance of United Kingdom inflation [J]. Economet- Rica, 1982,50(4):987-1007.

[4] Werner F. M. De BONDT, RICHARD H. THALER. Further Evidence on Investor Overreaction and Stock Market Seasonality[J]. The Journal of Finance, 1987,42(3).

[5] Li Huang. BP Neural Network Algorithm Improvement and Application Research[D]. Chongqing Normal University, 2008

[6] Yu Wenli, Liao Jianping, Ma Wenlong. A new time series prediction method of stock price based on Hidden Markov model [J]. Computer application and software, 2010,27 (06): 186-190

[7] Weihong Wang, Pengyu Zhuo, Research on stock price prediction based on PCA-FOA-SVR [J]. Journal of Zhejiang University, 2016, 44(4): 399-404

[8] Bauml E, Petrie T. Statistical inference for probabilistic functions of finite state Markov chains[J]. The annals of mathematical statistics, 1996, 37(6): 1554-1563.

[9] Zhang Yan, Yang Yang. Denoising method and application of financial time series based on wavelet analysis [J]. Journal of Ningbo University (Science and Technology Edition), 2010, 23 (3): 56-59 

[10] Xudong Zhang, Yufang Huang, Jiahao Du, Yongwei Liao. Stock price prediction based on Discrete Hidden Markov model [J]. Journal of Zhejiang University of technology, 2020,48 (02): 148-153 + 211

[11] Hassan, M. R., & Nath, B. (2005). Stock market forecasting using hidden Markov model: a new approach. In Proceedings of 5th international conference on intelligent system design and application (pp. 192–196). Poland.

[12] Huang Ran. Prediction and analysis of stock price based on Hidden Markov model [D]. Qingdao University, 2015.

[13] Yu Yongsheng, Xie Tianyidan, Liu Chang, Guo Jingwen, Zhang Weidong. Research on stock price behavior based on feature selection and HMM [J]. Information technology and network security, 2018,37 (08): 96-100. Doi: 10.19358/j.issn.2096-5133.2018.08.022