Predicting Stock Price from Historical Data using LSTM Technique

Predicting Stock Price from Historical Data using LSTM Technique

The accurate prediction of stock prices in the financial domain has always been a challenging task. While the Efficient Market Hypothesis declared that it is impossible to predict stock prices accurately, research has shown that stock price changes may be predicted with some degree of certainty with predictive models if appropriate and suitable variables are chosen. This work presents a robust and accurate model using statistical and Long Short-Term Memory (LSTM) techniques. Daily stock price data of a particular company was collected from the Yahoo Finance database which served as the primary source for the analysis. The Long Short-Term Memory (LSTM) technique was mainly used to forecast the stock market closing price on a particular day. The accuracy of this model was evaluated through multiple matrices which included Mean Squared Error (MSE), Root Mean Squared Error (RMSE), Mean Absolute Error (MAE), R-squared, and Directional Accuracy. This provided a clear and comprehensive assessment of the accuracy and performance. This study not only predicted the stock price using the proposed LSMA model but also analysed its accuracy by comparing it with popular conventional methods such as Simple Moving Average (SMA) and Exponential Moving Average (EMA) providing insights into the effectiveness of the LSMA model.

___

  • [1] J. Sen, and T. D. Chaudhuri, “An alternative framework for time-series decomposition and forecasting and its relevance for portfolio choice - a comparative study of the Indian consumer durable and small-cap sector,” Journal of Economic Libraries, vol. 3, no. 2, pp. 303-326, 2016.
  • [2] J. Sen, and T. D. Chaudhuri, “Decomposition of time series data of stock markets and its implications for prediction - An application for the Indian auto sector,” In Proceedings of the 2nd National Conference on Advances in Business Research and Management Practices, Kolkata, India, pp. 15-28, 2016.
  • [3] J. Sen, and T. D. Chaudhuri, “An investigation of the structural characteristics of the Indian IT sector and the capital goods sector - An application of the R programming language in time series decomposition and forecasting,” Journal of Insurance and Financial Management, vol. 1, no. 4, pp. 68-132, 2016.
  • [4] J. Sen, and T. D. Chaudhuri, “A time series analysis-based forecasting framework for the Indian healthcare sector,” Journal of Insurance and Financial Management, vol. 3, no. 1, pp. 66-94, 2017.
  • [5] J. Sen, and T. D. Chaudhuri, “A Robust Analysis and Forecasting Framework for the Indian Mid Cap Sector Using Time Series Decomposition Approach,” Journal of Insurance and Financial Management, vol. 3, no. 4, pp. 1-32, 2017.
  • [6] Y. Deshmukh, D. Saratkar, and Y. Tiwari, “Stock market prediction using machine learning,” International Journal of Advanced Research in Computer and Communication Engineering, pp. 31-35, 2019.
  • [7] K. Kim and I. Han, “Genetic algorithms approach to feature discretization in artificial neural networks for the prediction of stock price index,” Expert Systems with Applications, vol. 19, pp. 125-132, 2000.
  • [8] M. Qiu and Y. Song, “Predicting the direction of stock market index movement using an optimized artificial neural network model,” Public Library of Science ONE, vol. 11, no. 5, pp. 1-12, 2016.
  • [9] A. Murkute and T. Sarode, “Forecasting market price of stock using artificial neural network,” International Journal of Computer Applications, vol. 124, no. 12, pp. 11-15, 2015.
  • [10] W. Huang, Y. Nakamori, and S.Y. Wang, “Forecasting stock market movement direction with support vector machine,” Computers and Operations Research, vol. 32, no. 10, pp. 2513-2522, 2005.
  • [11] Z. H. Khan, T. S. Alin, and M. A. Hussain, “Price prediction of share market using artificial neural network (ANN),” International Journal of Computer Applications, vol. 22, no. 2, 2011.
  • [12] O.E. Orsel and S.S. Yamada, “Comparative study of machine learning models for stock price prediction,” arXiv preprint arXiv:2202.03156, 2022.
  • [13] G. Wang, G. Yu, and X. Shen, “The effect of online investor sentiment on stock movements: An LSTM approach,” Complexity, vol. 2020, pp. 1-11, 2020.
  • [14] F. Jia and B. Yang, “Forecasting volatility of stock index: deep learning model with likelihood-based loss function,” Complexity, vol. 2021, Article ID 5511802, pp. 1-13, 2021.
  • [15] C. Wimmer and N. Rekabsaz, “Leveraging vision-language models for granular market change prediction,” arXiv preprint arXiv:2301.05082, 2023.
  • [16] S. Yan, “Understanding LSTM and its diagrams,” [Online]. Available: https://medium.com/mlreview/understanding-lstm-and-its-diagrams-37e2f46f1714.
  • [17] H. N. Bhandari, B. Rimal, N. R. Pokhrel, R. Rimal, K. Dahal, and R. K. Khatri, “Predicting stock market index using LSTM,” Machine Learning With Applications, vol. 9, no. 1, 2022.
  • [18] H. Bhandari, B. Rimal, N. R. Pokhrel, R. Rimal, and K. Dahal, “LSTM-SDM: An integrated framework of LSTM implementation for sequential data modeling,” Software Impacts, vol. 14, article ID 100396, 2022.