Abstract
Stock price prediction is a crucial task in the decision-making of investors. Forecasting successfully on future stock prices will help the investors to gain profit. However, it is difficult to predict exactly the trend of the stock market due to the complex relationship between stock prices and external factors such as news, global economy, public sentiments, and other sensitive financial information. Therefore, historical prices are the main investigation data for researchers since collecting external factors is still a challenge. Our motivation comes from the stock price’s varying trend and the relationship among stocks. To this end, we propose two approaches based on the long short-term memory (LSTM) model along with a deep concern in the historical data of stocks. (i) The input data of the LSTM model are enriched by integrating the historical price of stocks with their nearest neighbors in terms of similarity; (ii) a dynamic sliding window is applied in the prediction phase of the LSTM model based on the analysis of the significant change of the stock price. Experimental results on three stock datasets of the United States, Germany, and Vietnam show that our model outperforms the competitors in predicting the trend of stock price fluctuations. This paper is an extended version of our previous work at the IEEE International Conference on Big Data and Smart Computing (BigComp 2021).












Similar content being viewed by others
References
Jahan I, Sajal SZ, Nygard KE. Prediction model using recurrent neural networks. In: 2019 IEEE international conference on electro information technology (EIT), IEEE; 2019. p. 1–6. https://doi.org/10.1109/EIT.2019.8834336.
Fazeli A, Houghten S. Deep learning for the prediction of stock market trends. In: 2019 IEEE international conference on big data (big data), IEEE; 2019. p. 5513–5521. https://doi.org/10.1109/BigData47090.2019.9005523.
Gao T, Chai Y. Improving stock closing price prediction using recurrent neural network and technical indicators. Neural Comput. 2018;30(10):2833–54. https://doi.org/10.1162/neco_a_01124.
Kim R, So C.H, Jeong M, Lee S, Kim J, Kang J. Hats: a hierarchical graph attention network for stock movement prediction. arXiv preprint arXiv:1908.07999 (2019)
Pang X, Zhou Y, Wang P, Lin W, Chang V. An innovative neural network approach for stock market prediction. J Supercomput. 2020;76(3):2098–118. https://doi.org/10.1007/s11227-017-2228-y.
Beyaz E, Tekiner F, Zeng X.-j, Keane J. Comparing technical and fundamental indicators in stock price forecasting. In: 2018 IEEE 20th international conference on high performance computing and communications; IEEE 16th international conference on smart city; IEEE 4th international conference on data science and systems (HPCC/SmartCity/DSS), IEEE; 2018. p. 1607–13. https://doi.org/10.1109/HPCC/SmartCity/DSS.2018.00262.
Nti IK, Adekoya AF, Weyori BA. A systematic review of fundamental and technical analysis of stock market predictions. Artif Intell Rev. 2020;53(4):3007–57. https://doi.org/10.1007/s10462-019-09754-z.
Matsunaga D, Suzumura T, Takahashi T. Exploring graph neural networks for stock market predictions with rolling window analysis. arXiv preprint arXiv:1909.10660 (2019).
Graves A, Mohamed A.-r, Hinton G. Speech recognition with deep recurrent neural networks. In: 2013 IEEE international conference on acoustics, speech and signal processing, IEEE;2013. p. 6645–6649. https://doi.org/10.1109/ICASSP.2013.6638947.
Khan W, Ghazanfar MA, Azam MA, Karami A, Alyoubi KH, Alfakeeh AS. Stock market prediction using machine learning classifiers and social media, news. J Ambient Intell Human Comput. 2020. https://doi.org/10.1007/s12652-020-01839-w.
O’Connor N, Madden MG. A neural network approach to predicting stock exchange movements using external factors. In: International conference on innovative techniques and applications of artificial intelligence, Springer; 2005. p. 64–77. https://doi.org/10.1007/1-84628-224-1_6.
Park K, Shin H. Stock price prediction based on a complex interrelation network of economic factors. Eng Appl Artif Intell. 2013;26(5–6):1550–61. https://doi.org/10.1016/j.engappai.2013.01.009.
Giang Thi Thu H, Nguyen Thanh T, Le Quy T. A neighborhood deep neural network model using sliding window for stock price prediction. In: 2021 IEEE international conference on big data and smart computing (BigComp), IEEE; 2021. p. 69–74. https://doi.org/10.1109/BigComp51126.2021.00022.
Cakra YE, Trisedya BD. Stock price prediction using linear regression based on sentiment analysis. In: 2015 international conference on advanced computer science and information systems (ICACSIS), IEEE; 2015. p. 147–154. https://doi.org/10.1109/ICACSIS.2015.7415179.
Mathew OO, Sola AF, Oladiran BH, Amos AA. Prediction of stock price using autoregressive integrated moving average filter ((arima (p, d, q))). Glob J Sci Fronti Res. 2013;13(8):79–88.
Ariyo AA, Adewumi AO, Ayo CK. Stock price prediction using the ARIMA model. In: 2014 UK Sim-AMSS 16th international conference on computer modelling and simulation, IEEE; 2014. p. 106–112. https://doi.org/10.1109/UKSim.2014.67.
Lin Y, Guo H, Hu J. An svm-based approach for stock market trend prediction. In: The 2013 international joint conference on neural networks (IJCNN); 2013. p. 1–7. https://doi.org/10.1109/IJCNN.2013.6706743
Chen Y, Hao Y. A feature weighted support vector machine and k-nearest neighbor algorithm for stock market indices prediction. Expert Syst Appl. 2017;80:340–55. https://doi.org/10.1016/j.eswa.2017.02.044.
Booth A, Gerding E, McGroarty F. Predicting equity market price impact with performance weighted ensembles of random forests. In: 2014 IEEE conference on computational intelligence for financial engineering & economics (CIFEr), IEEE; 2014. p. 286–293. https://doi.org/10.1109/CIFEr.2014.6924085.
Ye Q, Wei L, et al. The prediction of stock price based on improved wavelet neural network. Open J Appl Sci. 2015;5(04):115. https://doi.org/10.4236/ojapps.2015.54012.
Gupta A, Dhingra B. Stock market prediction using hidden markov models. In: 2012 students conference on engineering and systems, IEEE; 2012. p. 1–4. https://doi.org/10.1109/SCES.2012.6199099.
Yang J, Li J, Liu S. A new algorithm of stock data mining in internet of multimedia things. J Supercomput. 2020;76(4):2374–89. https://doi.org/10.1007/s11227-017-2195-3.
Kohara K, Ishikawa T, Fukuhara Y, Nakamura Y. Stock price prediction using prior knowledge and neural networks. Intell Syst Account Fin Manage. 1997;6(1):11–22. https://doi.org/10.1002/(SICI)1099-1174(199703)6:13c11::AID-ISAF1153e3.0.CO;2-3.
Nguyen T-T, Yoon S. A novel approach to short-term stock price movement prediction using transfer learning. Appl Sci. 2019;9(22):4745. https://doi.org/10.3390/app9224745.
Nelson DM, Pereira AC, de Oliveira RA. Stock market’s price movement prediction with LSTM neural networks. In: 2017 international joint conference on neural networks (IJCNN), IEEE; 2017. p. 1419–1426. https://doi.org/10.1109/IJCNN.2017.7966019.
Tsantekidis A, Passalis N, Tefas A, Kanniainen J, Gabbouj M, Iosifidis A. Forecasting stock prices from the limit order book using convolutional neural networks. In: 2017 IEEE 19th conference on business informatics (CBI), vol. 1, IEEE; 2017. p. 7–12. https://doi.org/10.1109/CBI.2017.23.
Selvin S, Vinayakumar R, Gopalakrishnan E, Menon VK, Soman K. Stock price prediction using LSTM, RNN and CNN-sliding window model. In: 2017 international conference on advances in computing, communications and informatics (ICACCI), IEEE; 2017. p. 1643–1647. https://doi.org/10.1109/ICACCI.2017.8126078.
Lee SI, Yoo SJ. Multimodal deep learning for finance: integrating and forecasting international stock markets. J Supercomput. 2020;76(10):8294–312. https://doi.org/10.1007/s11227-019-03101-3.
Zhang K, Zhong G, Dong J, Wang S, Wang Y. Stock market prediction based on generative adversarial network. Proc Comput Sci. 2019;147:400–6. https://doi.org/10.1016/j.procs.2019.01.256.
He B, Kita E. Stock price prediction by using hybrid sequential generative adversarial networks. In: 2020 international conference on data mining workshops (ICDMW), IEEE; 2020. p. 341–347. https://doi.org/10.1109/ICDMW51313.2020.00054.
Lin H, Chen C, Huang G, Jafari A. Stock price prediction using generative adversarial networks. J Comput Sci. 2021;17:188–96. https://doi.org/10.3844/jcssp.2021.188.196.
Hochreiter S, Schmidhuber J. Long short-term memory. Neural Comput. 1997;9(8):1735–80. https://doi.org/10.1162/neco.1997.9.8.1735.
Sak H, Senior A, Beaufays F. Long short-term memory based recurrent neural network architectures for large vocabulary speech recognition. arXiv preprint arXiv:1402.1128 (2014).
Seltman H. Simple linear regression, Chap. 9. Carnegie Mellon University; 2015. p. 217–240.
Liaw A, Wiener M, et al. Classification and regression by random forest. R News. 2002;2(3):18–22.
Le Cun Y, Boser B, Denker JS, Henderson D, Howard RE, Hubbard W, Jackel LD. Backpropagation applied to handwritten zip code recognition. Neural Comput. 1989;1(4):541–51. https://doi.org/10.1162/neco.1989.1.4.541.
Author information
Authors and Affiliations
Corresponding author
Ethics declarations
Conflict of interest
The authors declare that they have no conflict of interest.
Additional information
Publisher's Note
Springer Nature remains neutral with regard to jurisdictional claims in published maps and institutional affiliations.
Rights and permissions
About this article
Cite this article
Giang Thi Thu, H., Nguyen Thanh, T. & Le Quy, T. Dynamic Sliding Window and Neighborhood LSTM-Based Model for Stock Price Prediction. SN COMPUT. SCI. 3, 256 (2022). https://doi.org/10.1007/s42979-022-01158-1
Received:
Accepted:
Published:
DOI: https://doi.org/10.1007/s42979-022-01158-1