Skip to main content
Log in

Dynamic Sliding Window and Neighborhood LSTM-Based Model for Stock Price Prediction

  • Original Research
  • Published:
SN Computer Science Aims and scope Submit manuscript

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).

This is a preview of subscription content, log in via an institution to check access.

Access this article

Price excludes VAT (USA)
Tax calculation will be finalised during checkout.

Instant access to the full article PDF.

Fig. 1
Fig. 2
Fig. 3
Fig. 4
Fig. 5
Fig. 6
Fig. 7
Fig. 8
Fig. 9
Fig. 10
Fig. 11
Fig. 12

Similar content being viewed by others

References

  1. 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.

  2. 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.

  3. 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.

    Article  MathSciNet  MATH  Google Scholar 

  4. 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)

  5. 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.

    Article  Google Scholar 

  6. 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.

  7. 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.

    Article  Google Scholar 

  8. Matsunaga D, Suzumura T, Takahashi T. Exploring graph neural networks for stock market predictions with rolling window analysis. arXiv preprint arXiv:1909.10660 (2019).

  9. 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.

  10. 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.

    Article  Google Scholar 

  11. 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.

  12. 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.

    Article  Google Scholar 

  13. 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.

  14. 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.

  15. 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.

    Google Scholar 

  16. 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.

  17. 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

  18. 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.

    Article  Google Scholar 

  19. 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.

  20. 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.

    Article  Google Scholar 

  21. 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.

  22. 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.

    Article  Google Scholar 

  23. 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.

    Article  Google Scholar 

  24. 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.

    Article  Google Scholar 

  25. 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.

  26. 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.

  27. 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.

  28. 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.

    Article  Google Scholar 

  29. 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.

    Article  Google Scholar 

  30. 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.

  31. 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.

    Article  Google Scholar 

  32. 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.

    Article  Google Scholar 

  33. 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).

  34. Seltman H. Simple linear regression, Chap. 9. Carnegie Mellon University; 2015. p. 217–240.

  35. Liaw A, Wiener M, et al. Classification and regression by random forest. R News. 2002;2(3):18–22.

    Google Scholar 

  36. 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.

    Article  Google Scholar 

Download references

Author information

Authors and Affiliations

Authors

Corresponding author

Correspondence to Tai Le Quy.

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

Reprints and permissions

About this article

Check for updates. Verify currency and authenticity via CrossMark

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

Download citation

  • Received:

  • Accepted:

  • Published:

  • DOI: https://doi.org/10.1007/s42979-022-01158-1

Keywords

Navigation