A Multi Parameter Forecasting for Stock Time Series Data Using LSTM and Deep Learning Model
Abstract
1. Introduction
- A new methodology is proposed to forecast two stock parameters, close price, and high price, by analyzing time series data on stock prices.
- Comparing the hybird deep learning forecasting model with other stock price forecasting methods, the proposed method demonstrates that it is the most precise and suitable method for the forecasting of stock prices.
2. Related Work
| Reference | Authors/Published Date | Technique/Dataset | Remarks |
|---|---|---|---|
| [4] | Srilakshmi.K, Sai Sruthi.Ch Published in 2021 | Using Single Layer LSTM, Three Layer LSTM, CNN-LSTM, ConvLSTM, BiLSTM to forecast historical stock data using TCS stock as data set | To forecast the close price, ConvLSTM and BiLSTM were performing better than other models. CNN-LSTM, single layer LSTM, and three layer LSTM still improved when the epoch was increased. |
| [15] | Prachyachuwong, Vateekul Published in 2021 | Using LSTM for historical stock data and BERT for textual data on using SET50index as data set | To forecast the stock close price. he suggested model outperformed the base paper in terms of performance. The generated results verified that proposed model had improve with an accuracy of 61.28% and F1 of 51.58% and achieved highest annualized return of 8.47% |
| [1] | Lu et al. Published in 2020 | Using CNN for features extraction and LSTM for the forecasting historical stock data using Shanghai Composite Index (000001) as data set | To forecast the stock close price, CNN-LSTM was used. The generated results verified that they were performing better than other models. The limitation in this paper was that of the model architecture design. The problem was that the CNN was unable to retrieve the best features from the input data. |
| [6] | Mehtab, Sen Published in 2020 | Using CNN forecasting historical stock data using NIFITY 50 index as a data set | Stock close price was forecasted using CNN. The results verified that CNN was performing better than machine learning models and able to extract more features than machine learning models. CNN gave more accurate accuracy in multivariate analysis as compared to univariate analysis. |
| [6] | Sidra Mehtab, Jaydip Sen Published in 2020 | Using CNN for forecasting historical stock data using NIFITY 50 index as a data set | To forecast the stock close price, CNN was used. The results verified that CNN was performing better than machine learning models and able to extract more features than machine Learning models. CNN gave accurate accuracy in multivariate analysis as compared to univariate analysis. |
| [8] | Yadav et al. Published in 2019 | Using LSTM for forecasting historical stock data using TCS stock as a dataset | To forecast the stock adj-close price, LSTM was used. The results verfied that stateless LSTM performed better as compared to stateful LSTM |
| [9] | Lin et al. Published in 2018 | Using LSTM for forecasting historical stock data using TWSE stock as a dataset | To forecast the stock close price, LSTM was used. LSTM resolved the problem of storing long-term data, which was faced in RNN model. |
3. Proposed Methodology
3.1. CNN
3.2. LSTM Model
3.3. RNN Model
3.4. Selection Method
4. Experiment
4.1. Tools and Technology
- Python: It is a smart, adaptable, and versatile programming language. Being clear and easy to read, it makes a fantastic first language. It is the core programming language for Web development, machine learning, and data science.
- Microsoft Excel: The spreadsheet application Microsoft Excel was developed by Microsoft. Tools for calculating and computing, charting, and pivot tables are all included. As a database, Excel is used. The data are retrieved and executed using Excel. The graphs of the outputs are also created using Excel.
- Google Colab: It is an online tool that facilitates the developer to implement the code in the standard environment without relying on the local computer resources and provided opportunities to the developers to work in any environment.
- Keras: It is a python API that helps the developer to speed up the implementation of the experiment using simple methods and libraries and remove a huge coding load from a developer.
- Pandas: It is a Python toolkit that is free and open-source for tasks including data science, analysis, and machine learning. It is built for the multi-dimensional array-supporting library Numpy. These tasks include data cleaning, data filling, data normalisation, data visualisation, data loading and storage, statistical analysis, and much more. It is used for reading data, assessing it, altering it, and then saving it. Using the Pandas library, all of these things are possible.
- Numpy: It is an open-source python library. Python has lists that function similar to arrays. Arrays are mostly used in data studies.
4.2. Data Set
4.3. Implementation of Model
4.4. Evaluation Method
- 1.
- MAEMAE is used in resolving learning difficulties into optimization problems because it is most commonly utilized for the loss functions and error measure of regression problems.In this case, represents the prediction, is the actual value, and n represents the total number of samples or records.
- 2.
- RMSEOne of the methods most frequently used to evaluate the accuracy of forecasting models is RMSE. It shows how far the observed value varies from the actual value using Euclidean distance. The difference between forecast value and actual value for each sample are considered.
- 3.
- For linear regression models, is a goodness-of-fit indicator. is a metric that expresses the degree to which your model explains the dependent variable. The formula is used to calculate the amount of variance in y that can be explained by x-variables. The scale runs from 0 to 1.where TR is the total square sum and SR is the sum of square residuals.
4.5. Results
5. Conclusions
Author Contributions
Funding
Data Availability Statement
Acknowledgments
Conflicts of Interest
References
- Lu, W.; Li, J.; Li, Y.; Sun, A.; Wang, J. A CNN-LSTM-Based Model to Forecast Stock Prices. Complexity 2020, 2020, 6622927. [Google Scholar] [CrossRef] [Scilit]
- Ojo, S.O.; Owolawi, P.A.; Mphahlele, M.; Adisa, J.A. Stock Market Behaviour Prediction using Stacked LSTM Networks. In Proceedings of the 2019 International Multidisciplinary Information Technology and Engineering Conference (IMITEC), Vanderbijlpark, South Africa, 1–22 November 2019; pp. 1–5. [Google Scholar] [CrossRef] [Scilit]
- Li, Y.; Pen, Y. A novel ensemble deep learning model for stock prediction based on stock prices and news. Int. Conf. Adv. Comput. Commun. Syst. 2021, 13, 139–149. [Google Scholar] [CrossRef] [Scilit] [PubMed]
- Srilakshmi, K.; Sai Sruthi, C. Prediction of TCS Stock Prices Using Deep Learning Models. In Proceedings of the 2021 7th International Conference on Advanced Computing and Communication Systems (ICACCS), Coimbatore, India, 19–20 March 2021; pp. 1–11. [Google Scholar] [CrossRef] [Scilit]
- Le, D.Y.N.; Maag, A. Suntharalingam Senthilananthan, Analysing Stock Market Trend Prediction using Machine and Deep Learning Models. In Proceedings of the 2020 5th International Conference on Innovative Technologies in Intelligent Systems and Industrial Applications (CITISIA), Sydney, Australia, 25–27 November 2020; pp. 1–10. [Google Scholar] [CrossRef] [Scilit]
- Mehtab, S.; Sen, J. Stock Price Prediction Using Convolutional Neural Networks on a Multivariate Time series. arXiv 2020, arXiv:2001.09769. [Google Scholar] [CrossRef] [Scilit]
- Cao, J.; Wang, J. Stock price forecasting model based on modified convolution neural network and financial time series analysis. Int. J. Commun. Syst. 2019, 32, e3987. [Google Scholar] [CrossRef] [Scilit]
- Yadava, A.; Jhaa, C.K.; Sharanb, A. Optimizing LSTM for time series prediction in Indian stock market. Procedia Comput. Sci. 2020, 167, 2091–2100. [Google Scholar] [CrossRef] [Scilit]
- Lin, B.-S.; Chu, W.-T.; Wang, C.-M. Application of Stock Analysis Using Deep Learning. In Proceedings of the 2018 7th International Congress on Advanced Applied Informatics (IIAI-AAI), Yonago, Japan, 8–13 July 2018; pp. 1–6. [Google Scholar] [CrossRef] [Scilit]
- Chen, Y.; Fang, R.; Liang, T.; Sha, Z.; Li, S.; Yi, Y.; Zhou, W.; Song, H. Stock Price Forecast Based on CNN-BiLSTM-ECA Model. Sci. Program. 2021, 2021, 2446543. [Google Scholar] [CrossRef] [Scilit]
- Samarawickrama, A.J.P.; Fernando, T.G.I. A Recurrent Neural Network Approach in Predicting Daily Stock Prices. In Proceedings of the 2017 IEEE International Conference on Industrial and Information Systems (ICIIS), Peradeniya, Sri Lanka, 15–16 December 2017; pp. 1–6. [Google Scholar] [CrossRef] [Scilit]
- Li, C.; Zhang, X.; Qaosar, M.; Ahmed, S.; Alam, K.M.R.; Morimoto, Y. Multi-factor Based Stock Price Prediction Using Hybrid Neural Networks with Attention Mechanism. In Proceedings of the 2019 IEEE Intl Conf on Dependable, Autonomic and Secure Computing, Intl Conf on Pervasive Intelligence and Computing, Intl Conf on Cloud and Big Data Computing, Intl Conf on Cyber Science and Technology Congress (DASC/PiCom/CBDCom/CyberSciTech), Fukuoka, Japan, 5–8 August 2019; pp. 1–6. [Google Scholar] [CrossRef] [Scilit]
- Lounnapha, S.; Zhongdong, W.; Sookasame, C. Research on Stock Price Prediction Method Based on Convolutional Neural Network. In Proceedings of the 2019 International Conference on Virtual Reality and Intelligent Systems (ICVRIS), Jishou, China, 14–15 September 2019; pp. 1–4. [Google Scholar] [CrossRef] [Scilit]
- Fabbri, M.; Moro, G. Dow Jones Trading with Deep Learning: The Unreasonable Effectiveness of Recurrent Neural Networks. In Proceedings of the 7th International Conference on Data Science, Technology and Applications, Porto, Portugal, 26–28 July 2018; pp. 1–12. [Google Scholar] [CrossRef] [Scilit]
- Prachyachuwong, K.; Vateekul, P. Stock Trend Prediction Using Deep Learning Approach on Technical Indicator and Industrial Specific Information. Information 2021, 12, 250. [Google Scholar] [CrossRef] [Scilit]
- Kesavan, M.; Karthiraman, J.; Ebenezer, R.T.; Adhithyan, S. Stock Market Prediction with Historical Time Series Data and Sentimental Analysis of Social Media Data. In Proceedings of the 2020 4th International Conference on Intelligent Computing and Control Systems (ICICCS), Madurai, India, 13–15 May 2020; pp. 1–6. [Google Scholar] [CrossRef] [Scilit]
- Batoo, M.; Ghulam, H.; Hayat, M.A.; Naeem, M.; Ejaz, A.; Imran, Z.A.; Spulbar, C.; Birau, R.; Gorun, T.H. How COVID-19 has shaken the sharing economy? An analysis using Google trends data. Econ. Res.-Ekon. IstražIvanja 2021, 34, 2374–2386. [Google Scholar] [CrossRef] [Scilit]
- Lecun, S.; Bottou, L.; Bengio, Y.; Haffner, P. Gradient-Based Learning Applied to Document Recognition. Proc. IEEE 1998, 86, 2278–2324. [Google Scholar] [CrossRef] [Scilit]
- Lu, W.; Li, J.; Wang, J.; Qin, L. A CNN-BiLSTM-AM method for stock price prediction. Neural Comput. Appl. 2020, 33, 4741–4753. [Google Scholar] [CrossRef] [Scilit]
- CNN. Available online: https://www.researchgate.net/figure/An-illustration-of-one-one-dimensional-1D-convolutional-neural-network-CNN-consisting_fig3_333154420 (accessed on 3 March 2022).
- Hochreiter, S.; Schmidhuber, J. Long Short-Term Memory Recognition. Neural Comput. 1997, 9, 1735–1780. [Google Scholar] [CrossRef] [Scilit] [PubMed]
- LSTM. Available online: https://www.analyticsvidhya.com/blog/2017/12/fundamentals-of-deep-learning-introduction-to-lstm/ (accessed on 4 April 2022).
- RNN. Available online: https://www.simplilearn.com/tutorials/deep-learning-tutorial/rnn (accessed on 29 April 2022).
- Zhang, H.; Mu, J.-H. A Back Propagation Neural Network-Based Method for Intelligent Decision-Making. Complexity 2021, 2021, 6610797. [Google Scholar] [CrossRef] [Scilit]
- Deng, C.; Liu, Y. A Deep Learning-Based Inventory Management and Demand Prediction Optimization Method for Anomaly Detection. Wirel. Commun. Mob. Comput. 2021, 2021, 9969357. [Google Scholar] [CrossRef] [Scilit]
- Mehtab, S.; Sen, J.; Dasgupta, S. Robust Analysis of Stock Time Series Using CNN and LSTM-Based Deep Learning Models. In Proceedings of the 2020 4th International Conference on Electronics, Communication and Aerospace Technology (ICECA), Coimbatore, India, 5–7 November 2020; pp. 1–6. [Google Scholar] [CrossRef] [Scilit]
- Lee, S.H.; Yoon, S.H.; Kim, H.W. Prediction of Online Video Advertising Inventory Based on TV Programs: A Deep Learning Approach. IEEE Access 2021, 9, 22516–22527. [Google Scholar] [CrossRef] [Scilit]
- Ji, X.; Wang, J.; Yan, Z. A stock price prediction method based on deep learning technology. Int. J. Crowd Sci. 2020, 5, 55–72. [Google Scholar] [CrossRef] [Scilit]
- Singh, K.; Booma, P.M.; Eaganathan, U. E-Commerce System for Sale Prediction Using Machine Learning Technique. J. Phys. Conf. Ser. 2020, 1712, 012042. [Google Scholar] [CrossRef] [Scilit]
- Ananthi, M.; Vijayakumar, K. Stock market analysis using candlestick regression and market trend prediction (CKRM). J. Ambient. Intell. Humaniz. Comput. 2020, 12, 4819–4826. [Google Scholar] [CrossRef] [Scilit]
- Parray, I.R.; Khurana, S.S.; Kumar, M.; Altalbe, A.A. Time series data analysis of stock price movement using machine learning techniques. Soft Comput. 2020, 24, 16509–16517. [Google Scholar] [CrossRef] [Scilit]
- Mohan, S.; Mullapudi, S.; Sammeta, S.; Vijayvergia, P.; Anastasiu1, D.C. Stock Price Prediction Using News Sentiment Analysis. In Proceedings of the 2019 IEEE Fifth International Conference on Big Data Computing Service and Applications (BigDataService), Newark, CA, USA, 4–9 April 2019; pp. 1–4. [Google Scholar] [CrossRef] [Scilit]
- Kumar, D. Stock Forecasting Using Natural Language and Recurrent Network. In Proceedings of the 2020 3rd International Conference on Emerging Technologies in Computer Engineering: Machine Learning and Internet of Things (ICETCE), Jaipur, India, 7–8 February 2020; pp. 1–5. [Google Scholar] [CrossRef] [Scilit]
- Sharaf, M.; El-Din Hemdan, E.; El-Sayed, A.; El-Bahnasawy, N.A. StockPred: A framework for stock Price prediction. Multimed. Tools Appl. 2021, 80, 17923–17954. [Google Scholar] [CrossRef] [Scilit]
- Zhang, R.; Yuan, Z.; Shao, X. A new combined CNN-RNN model for sector stock price analysis. In Proceedings of the IEEE 42nd Annual Computer Software and Applications Conference (COMPSAC), Tokyo, Japan, 23–27 July 2018; pp. 546–551. [Google Scholar] [CrossRef] [Scilit]






















| Date | Open | High | Low | Close | Adj.Close | Volume |
|---|---|---|---|---|---|---|
| 03 March 2003 | 1511.584 | 1525.698 | 1511.045 | 1525.483 | 1525.483 | 8800 |
| 04 March 2003 | 1527.448 | 1529.751 | 1517.859 | 1524.303 | 1524.303 | 8000 |
| 05 March 2003 | 1524.077 | 1524.123 | 1508.25097 | 1517.178 | 1517.178 | 6800 |
| 06 March 2003 | 1516.600 | 1517.348 | 1494.240 | 1498.343 | 1498.343 | 8400 |
| 07 March 2003 | 1495.693 | 1502.427 | 1489.384 | 1493.093 | 1493.093 | 7000 |
| 10 March 2003 | 1492.208 | 1496.163 | 1467.639 | 1468.918 | 1468.918 | 7400 |
| 12 March 2003 | 1468.746 | 1475.286 | 1458.5 | 1475.008 | 1475.008 | 5200 |
| 13 March 2003 | 1475.036 | 1477.858 | 1463.329 | 1464.649 | 1464.649 | 5400 |
| 14 March 2003 | 1464.991 | 1471.499 | 1461.350 | 1466.043 | 1466.043 | 4800 |
| 17 March 2003 | 1465.144 | 1469.532 | 1453.368 | 1469.274 | 1469.274 | 6400 |
| Parameters | Values |
|---|---|
| Convolution Layer | 1 |
| Convolution Layer Filters | 32 |
| Convolution Layer Kernel Size | 1 |
| Convolution Layer Activation Function | tanh |
| Pooling Layer | 1 |
| Pooling Method | Max Pooling |
| Pooling Size | 2 |
| Strides | 1 |
| Flatten Layer | 1 |
| LSTM Layer | 1 |
| LSTM Layer Units | 64 |
| LSTM Layer Activation Function | tanh |
| RNN Layer | 1 |
| RNN Layer Units | 64 |
| RNN Layer Activation Function | tanh |
| Optimizer | Adam |
| Loss Function | MAE |
| Time step | 10 |
| Batch size | 64 |
| Epochs | 100 |
| Models | MAE | RMSE | |
|---|---|---|---|
| CNN | 27.644 | 3.527 | 0.985 |
| RNN | 27.469 | 13.295 | 0.986 |
| LSTM | 32.283 | 20.242 | 0.982 |
| Methods | MAE | RMSE | |
|---|---|---|---|
| CNN | 47.642 | 40.404 | 0.964 |
| RNN (Multilayer) | 31.495 | 17.313 | 0.982 |
| CNN-LSTM(Hybird Model) | 30.653 | 19.117 | 0.983 |
| CNN-RNN(Hybird Model) | 29.527 | 16.756 | 0.984 |
| LSTM(Multilayer) | 28.589 | 15.720 | 0.985 |
| Proposed Single Layer RNN | 27.469 | 13.295 | 0.986 |
| Actual Stock Price | Proposed Approach | |||
|---|---|---|---|---|
| Dates | High | Close | Predicted High | Predicted Close |
| 07 March 2017 | 3242.658936 | 3242.406006 | 3233.857666 | 3242.933838 |
| 08 March 2017 | 3245.303955 | 3240.665039 | 3237.608643 | 3249.272949 |
| 09 March 2017 | 3233.875 | 3216.746094 | 3240.685547 | 3254.879883 |
| 10 March 2017 | 3222.319092 | 3212.76001 | 3214.25415 | 3224.61792 |
| 13 March 2017 | 3237.023926 | 3211.515381 | 3211.515381 | 3224.850098 |
| Single Parameter | Two Parameter | |||||
|---|---|---|---|---|---|---|
| Methods | MAE | RMSE | MAE | RMSE | ||
| CNN | 30.138 | 42.967 | 0.958 | 47.642 | 40.404 | 0.964 |
| RNN(Multilayer) | 29.916 | 42.957 | 0.959 | 31.495 | 17.313 | 0.982 |
| CNN-LSTM(Hybird Model) | 27.564 | 39.688 | 0.964 | 30.653 | 19.117 | 0,983 |
| CNN-RNN(Hybird Model) | 28.285 | 40.538 | 0.963 | 29.527 | 16.756 | 0.984 |
| LSTM(Multilayer) | 28.712 | 41.003 | 0.962 | 28.589 | 15.720 | 0.985 |
| Proposed Single Layer RNN | 27.190 | 11.989 | 0.984 | 27.469 | 13.295 | 0.986 |
Disclaimer/Publisher’s Note: The statements, opinions and data contained in all publications are solely those of the individual author(s) and contributor(s) and not of MDPI and/or the editor(s). MDPI and/or the editor(s) disclaim responsibility for any injury to people or property resulting from any ideas, methods, instructions or products referred to in the content. |
© 2023 by the authors. Licensee MDPI, Basel, Switzerland. This article is an open access article distributed under the terms and conditions of the Creative Commons Attribution (CC BY) license (https://creativecommons.org/licenses/by/4.0/).
Share and Cite
Zaheer, S.; Anjum, N.; Hussain, S.; Algarni, A.D.; Iqbal, J.; Bourouis, S.; Ullah, S.S. A Multi Parameter Forecasting for Stock Time Series Data Using LSTM and Deep Learning Model. Mathematics 2023, 11, 590. https://doi.org/10.3390/math11030590
Zaheer S, Anjum N, Hussain S, Algarni AD, Iqbal J, Bourouis S, Ullah SS. A Multi Parameter Forecasting for Stock Time Series Data Using LSTM and Deep Learning Model. Mathematics. 2023; 11(3):590. https://doi.org/10.3390/math11030590
Chicago/Turabian StyleZaheer, Shahzad, Nadeem Anjum, Saddam Hussain, Abeer D. Algarni, Jawaid Iqbal, Sami Bourouis, and Syed Sajid Ullah. 2023. "A Multi Parameter Forecasting for Stock Time Series Data Using LSTM and Deep Learning Model" Mathematics 11, no. 3: 590. https://doi.org/10.3390/math11030590
APA StyleZaheer, S., Anjum, N., Hussain, S., Algarni, A. D., Iqbal, J., Bourouis, S., & Ullah, S. S. (2023). A Multi Parameter Forecasting for Stock Time Series Data Using LSTM and Deep Learning Model. Mathematics, 11(3), 590. https://doi.org/10.3390/math11030590

