Modelling Time Series Data for Stock Prices Prediction Using Bidirectional Long Short-Term Memory
DOI:
https://doi.org/10.30983/knowbase.v4i2.8759Keywords:
RNN, BiLSTM, Time Series Data, Stock PricesAbstract
The dynamic nature of stock markets, characterized by intricate patterns and sudden fluctuations, poses significant challenges to accurate price prediction. Traditional analytical methods are often unable to capture this complexity. This requires the use of advanced techniques capable of modelling non-linear dependencies. This study aims to build a model using recurrent neural network and predict the Indonesian stock prices. PT Gudang Garam Tbk.'s (GGRM.JK) stock was selected due to its significant role in the Indonesian stock market and its contribution to national revenue through excise tax. The method used in this research involves training the BiLSTM (Bidirectional Long Short-Term Memory) model using historical stock price data with training and test data ratios of 90:10, 80:20 and 70:30 to determine the optimal configuration. The evaluation results showed that the 90:10 data ratio gave the best performance with a MAPE of 1.51%, MAE of 343.55 IDR and RMSE of 522.30 IDR. These results indicate that the BiLSTM model has high accuracy and minimal prediction errors. Further analysis showed that the model performed optimally with a batch size of 32 and higher epochs, such as 200 and 250, providing greater stability and prediction accuracy. These results demonstrate the potential of the BiLSTM model as an effective predictive tool to support strategic investment decisions, particularly for high volatility stocks. Future research is recommended to test this model on other stock data and to consider external factors to improve its generalizability.
References
F. Rorizki, S. Sakinah, A. Dalimunthe, and P. R. Silalahi, “Perkembangan dan Tantangan Pasar Modal Indonesia,” Econ. Rev. J., vol. 1, no. 2, pp. 147–157, Jul. 2022, doi: 10.56709/MRJ.V1I2.24.
M. A. Muis and S. Adhitama, “The Analyze Financial Performance of PT Gudang Garam Tbk,” Dinasti Int. J. Econ. Financ. Account., vol. 3, no. 2, pp. 203–214, Jun. 2022, doi: 10.38035/DIJEFA.V3I2.1290.
S. Alfania and S. Soekarno, “Financial Performance and Valuation Assessment of PT Gudang Garam Tbk in Comparison to PT. Hm Sampoerna and PT. Wismilak Inti Makmur,” Int. J. Curr. Sci. Res. Rev., vol. 06, no. 02, Feb. 2023, doi: 10.47191/ijcsrr/v6-i2-35.
A. Susanti and A. M. Muchtar, “Analisis Fundamental dan Teknikal Dalam Pengambilan Keputusan Investasi Pada Saham PT Gudang Garam Tbk,” in Prosiding Seminar Nasional Akuntansi dan Manajemen, 2024. Accessed: Nov. 07, 2024. [Online]. Available: https://repository.pnj.ac.id/id/eprint/19430/
K. Ansah, I. W. Denwar, and J. K. Appati, “Intelligent Models for Stock Price Prediction,” J. Inf. Technol. Res., vol. 15, no. 1, pp. 1–17, Jan. 2022, doi: 10.4018/jitr.298616.
P. Khanpara, R. Kadam, K. Lavingia, and S. Patel, “Stock Trend Prediction: A Comparative Study using Different Approaches,” in Proceedings - 5th International Conference on Smart Systems and Inventive Technology, ICSSIT 2023, Institute of Electrical and Electronics Engineers Inc., 2023, pp. 1697–1701. doi: 10.1109/ICSSIT55814.2023.10060936.
M. Pirani, P. Thakkar, P. Jivrani, M. H. Bohara, and D. Garg, “A Comparative Analysis of ARIMA, GRU, LSTM and BiLSTM on Financial Time Series Forecasting,” in IEEE International Conference on Distributed Computing and Electrical Circuits and Electronics, ICDCECE 2022, Institute of Electrical and Electronics Engineers Inc., 2022. doi: 10.1109/ICDCECE53908.2022.9793213.
S. Sood, “A comparative performance of LSTM, ANN and ARIMA for prediction of stock price,” Proc. 2023 Int. Conf. Innov. Comput. Intell. Commun. Smart Electr. Syst. ICSES 2023, 2023, doi: 10.1109/ICSES60034.2023.10465401.
D. Kobiela, D. Krefta, W. Król, and P. Weichbroth, “ARIMA vs LSTM on NASDAQ stock exchange data,” Procedia Comput. Sci., vol. 207, pp. 3836–3845, Jan. 2022, doi: 10.1016/J.PROCS.2022.09.445.
F. M. Salem, Recurrent neural networks: From simple to gated architectures. Springer International Publishing, 2022. doi: 10.1007/978-3-030-89929-5.
H. Agarwal, G. Mahajan, A. Shrotriya, and D. Shekhawat, “Predictive Data Analysis: Leveraging RNN and LSTM Techniques for Time Series Dataset,” in Procedia Computer Science, Elsevier, Jan. 2024, pp. 979–989. doi: 10.1016/j.procs.2024.04.093.
H. N. Bhandari, B. Rimal, N. R. Pokhrel, R. Rimal, K. R. Dahal, and R. K. C. Khatri, “Predicting stock market index using LSTM,” Mach. Learn. with Appl., vol. 9, p. 100320, Sep. 2022, doi: 10.1016/j.mlwa.2022.100320.
J. Wang, S. Hong, Y. Dong, Z. Li, and J. Hu, “Predicting Stock Market Trends Using LSTM Networks: Overcoming RNN Limitations for Improved Financial Forecasting,” J. Comput. Sci. Softw. Appl., vol. 4, no. 3, pp. 1–7, Jul. 2024, doi: 10.5281/ZENODO.12200708.
Z. Wang, “Stock price prediction using LSTM neural networks: Techniques and applications,” Appl. Comput. Eng., vol. 86, no. 1, pp. 294–300, Aug. 2024, doi: 10.54254/2755-2721/86/20241605.
V. Chang, Q. A. Xu, A. Chidozie, and H. Wang, “Predicting Economic Trends and Stock Market Prices with Deep Learning and Advanced Machine Learning Techniques,” Electron., vol. 13, no. 17, p. 3396, Aug. 2024, doi: 10.3390/electronics13173396.
M. A. Majid, P. D. Saputri, and S. Soehardjoepri, “Stock Market Index Prediction using Bi-directional Long Short-Term Memory,” J. Appl. Informatics Comput., vol. 8, no. 1, pp. 55–61, Jul. 2024, doi: 10.30871/jaic.v8i1.7195.
J. Li, “Research on Stock Portfolio Construction Based on Bi-LSTM Neural Networks,” J. Comput. Electron. Inf. Manag., vol. 13, no. 2, pp. 37–41, Jun. 2024, doi: 10.54097/U1WM896M.
D. I. Puteri, G. Darmawan, and B. N. Ruchjana, “Prediksi Harga Saham Syariah menggunakan Bidirectional Long Short Term Memory (BiLSTM) dan Algoritma Grid Search,” Jambura J. Math., vol. 6, no. 1, pp. 39–45, Feb. 2024, doi: 10.37905/JJOM.V6I1.23297.
R. A. Putra and E. Nurmawati, “Prediction-based Stock Portfolio Optimization Using Bidirectional Long Short-Term Memory (BiLSTM) and LSTM,” Sci. J. Informatics, vol. 11, no. 3, pp. 609–620, Aug. 2024, doi: 10.15294/SJI.V11I3.5941.
“PT Gudang Garam Tbk (GGRM.JK) Stock Historical Prices & Data - Yahoo Finance.” Accessed: Nov. 06, 2024. [Online]. Available: https://finance.yahoo.com/quote/GGRM.JK/history/
K. Alkhatib, H. Khazaleh, H. A. Alkhazaleh, A. R. Alsoud, and L. Abualigah, “A New Stock Price Forecasting Method Using Active Deep Learning Approach,” J. Open Innov. Technol. Mark. Complex. 2022, Vol. 8, Page 96, vol. 8, no. 2, p. 96, May 2022, doi: 10.3390/JOITMC8020096.
M. Barkóciová, M. Dolná, and S. Rudý, “Factors Affecting the Financial Performance of Enterprises Listed on the Slovakia Stock Exchange,” in EDAMBA 2022: Conference Proceedings, Bratislava: University of Economics in Bratislava, May 2023, pp. 11–26. doi: 10.53465/edamba.2022.9788022550420.11-26.
A. Tawakuli, B. Havers, V. Gulisano, D. Kaiser, and T. Engel, “Survey:Time-series data preprocessing: A survey and an empirical analysis,” J. Eng. Res., Mar. 2024, doi: 10.1016/J.JER.2024.02.018.
M. Mazziotta and A. Pareto, “Normalization methods for spatio-temporal analysis of environmental performance: Revisiting the Min–Max method,” Environmetrics, vol. 33, no. 5, p. e2730, Aug. 2022, doi: 10.1002/ENV.2730.
K. Lyu, Z. Li, and S. Arora, “Understanding the Generalization Benefit of Normalization Layers: Sharpness Reduction,” in Advances in Neural Information Processing Systems, Dec. 2022, pp. 1–20.
F. T. Lima and V. M. A. Souza, “A Large Comparison of Normalization Methods on Time Series,” Big Data Res., vol. 34, pp. 1–35, Nov. 2023, doi: 10.1016/J.BDR.2023.100407.
D. G. da Silva and A. A. de M. Meneses, “Comparing Long Short-Term Memory (LSTM) and bidirectional LSTM deep neural networks for power consumption prediction,” Energy Reports, vol. 10, pp. 3315–3334, Nov. 2023, doi: 10.1016/j.egyr.2023.09.175.
Mushliha, “Implementasi CNN-BiLSTM untuk Prediksi Harga Saham Bank Syariah di Indonesia,” Jambura J. Math., vol. 6, no. 2, pp. 195–203, Aug. 2024, doi: 10.37905/JJOM.V6I2.26509.
P. R. Low and E. Sakk, “Parameter Optimisation of LSTM Models in Stock Price Prediction,” in TENCON 2022-2022 IEEE Region 10 Conference (TENCON), Institute of Electrical and Electronics Engineers Inc., 2022, pp. 1–5. doi: 10.1109/TENCON55691.2022.9978045.
D. Xu, H. Shao, X. Deng, and X. Wang, “The Hidden-Layers Topology Analysis of Deep Learning Models in Survey for Forecasting and Generation of the Wind Power and Photovoltaic Energy,” Mar. 14, 2022, Tech Science Press. doi: 10.32604/cmes.2022.019245.
O. M. Osama, K. Alakkari, M. Abotaleb, and E. S. M. El-Kenawy, “Forecasting Global Monkeypox Infections Using LSTM: A Non-Stationary Time Series Analysis,” in ICEEM 2023 - 3rd IEEE International Conference on Electronic Engineering, Institute of Electrical and Electronics Engineers Inc., 2023. doi: 10.1109/ICEEM58740.2023.10319532.
E. Noersasongko, “Capitalization Feature and Learning Rate for Improving NER Based on RNN BiLSTM-CRF,” in 2022 IEEE International Conference on Cybernetics and Computational Intelligence (CyberneticsCom), Institute of Electrical and Electronics Engineers Inc., 2022, pp. 398–403. doi: 10.1109/CyberneticsCom55287.2022.9865660.
Y. Li et al., “A Survey on Dropout Methods and Experimental Verification in Recommendation,” IEEE Trans. Knowl. Data Eng., vol. 35, no. 7, pp. 6595–6615, Jul. 2023, doi: 10.1109/TKDE.2022.3187013.
V. A. Dasu, A. Kumar, S. Tizpaz-Niari, and G. Tan, “NeuFair: Neural Network Fairness Repair with Dropout,” in ISSTA 2024 - Proceedings of the 33rd ACM SIGSOFT International Symposium on Software Testing and Analysis, Jul. 2024, pp. 1541–1553. doi: 10.1145/3650212.3680380.
E. Hassan, M. Y. Shams, N. A. Hikal, and S. Elmougy, “The effect of choosing optimizer algorithms to improve computer vision tasks: a comparative study,” Multimed. Tools Appl., vol. 82, no. 11, pp. 16591–16633, May 2023, doi: 10.1007/s11042-022-13820-0.
S. Sang and L. Li, “A Stock Prediction Method Based on Heterogeneous Bidirectional LSTM,” Appl. Sci., vol. 14, no. 20, pp. 1–16, Oct. 2024, doi: 10.3390/APP14209158.
C. Kosma, G. Nikolentzos, N. Xu, and M. Vazirgiannis, “Time Series Forecasting Models Copy the Past: How to Mitigate,” in Lecture Notes in Computer Science (including subseries Lecture Notes in Artificial Intelligence and Lecture Notes in Bioinformatics), Springer, Cham, 2022, pp. 366–378. doi: 10.1007/978-3-031-15919-0_31.
T. O. Hodson, “Root-mean-square error (RMSE) or mean absolute error (MAE): when to use them or not,” Geosci. Model Dev., vol. 15, no. 14, pp. 5481–5487, Jul. 2022, doi: 10.5194/GMD-15-5481-2022.
V. Plevris, G. Solorzano, N. P. Bakas, and M. E. A. Ben Seghier, “Investigation of Performance Metrics in Regression Analysis and Machine Learning-based Prediction Models,” in World Congress in Computational Mechanics and ECCOMAS Congress, Scipedia S.L., Nov. 2022. doi: 10.23967/eccomas.2022.155.
V. M. Perez Cortes, A. Chatterjee, and D. Khovalyg, “Dynamic personalized human body energy expenditure: Prediction using time series forecasting LSTM models,” Biomed. Signal Process. Control, vol. 87, p. 105381, Jan. 2024, doi: 10.1016/j.bspc.2023.105381.
Z. Wang, Z. Hu, F. Li, S. B. Ho, and E. Cambria, “Learning-Based Stock Trending Prediction by Incorporating Technical Indicators and Social Media Sentiment,” Cognit. Comput., vol. 15, no. 3, pp. 1092–1102, May 2023, doi: 10.1007/s12559-023-10125-8.
Downloads
Submitted
Accepted
Published
Issue
Section
License
Copyright (c) 2024 Yenie Syukriyah, Adi Purnama
This work is licensed under a Creative Commons Attribution-ShareAlike 4.0 International License.
Authors who publish with this journal agree to the following terms:
- Authors retain copyright and grant the journal right of first publication with the work simultaneously licensed under a Creative Commons Attribution License that allows others to share the work with an acknowledgment of the work's authorship and initial publication in this journal.
- Authors are able to enter into separate, additional contractual arrangements for the non-exclusive distribution of the journal's published version of the work (e.g., post it to an institutional repository or publish it in a book), with an acknowledgment of its initial publication in this journal.
- Authors are permitted and encouraged to post their work online (e.g., in institutional repositories or on their website) prior to and during the submission process, as it can lead to productive exchanges, as well as earlier and greater citation of published work (See The Effect of Open Access).