Predicting Stock Price Movements with Technical, Fundamental, and Sentiment Analysis Using the LSTM Model

Authors

DOI:

https://doi.org/10.31294/informatika.v12i1.12248

Keywords:

Stock, LSTM, Sentiment analysis

Abstract

The challenge of minimizing risk and maximizing profit is what traders in the stock market have been endeavoring to solve for years. Stock prices typically exhibit the characteristic of volatility, influenced by various factors and necessitate a substantial amount of data to identify patterns in price movements. Considering the significant data requirements and the rapid advancement of big data and artificial intelligence, the LSTM (Long-Short Term Memory) model stands as a suitable approach for utilization in Deep Learning. The independent variables employed encompass technical indicator variables, currency exchange rates, interest rates, the Jakarta Composite Index (IHSG), and sentiment data extracted from Twitter tweets. The results indicate that sentiment analysis using the IndoBERT model achieved an accuracy of 0.69, while LSTM analysis produced the model with the smallest error for the fourth (4th) combination of variables, comprising closing price, technical indicators, IHSG, exchange rate, and Twitter sentiment, as well as the twelfth (12th) combination of variables, encompassing closing price, technical indicators, and IHSG. These combinations yielded average RMSE errors of 1.765E-04 and 1.978E-04, respectively. Hyperparameter optimization is done to six hyperparameter, number of unit layer, dropout rate, learning rate, batch size, optimizer, and timestamps. Following hyperparameter optimization, the best-identified model was the fourth (4th) combination of variables, yielding a minimal error of 7.580E-05 and an RMSE of 332.66 in the evaluation of test data. 

Downloads

Download data is not yet available.

References

Aggarwal, D. (2022). Defining and measuring market sentiments: A review of the literature. Qualitative Research in Financial Markets, 14(2), 270–288.

Ardyanta, E. I., & Sari, H. (2021). A Prediction of Stock Price Movements Using Support Vector Machines in Indonesia.

Asia, B. C. (2022). Kepemilikan Saham BCA.

Attanasio, G., Cagliero, L., Garza, P., & Baralis, E. (2019). Combining news sentiment and technical analysis to predict stock trend reversal. 2019 International Conference on Data Mining Workshops (ICDMW), 514–521.

Baranochnikov, I., & Ślepaczuk, R. (2022). A comparison of LSTM and GRU architectures with novel walk-forward approach to algorithmic investment strategy (Vol. 21). University of Warsaw, Faculty of Economic Sciences.

Bhandari, H. N., Rimal, B., Pokhrel, N. R., Rimal, R., Dahal, K. R., & Khatri, R. K. C. (2022). Predicting stock market index using LSTM. Machine Learning with Applications, 9, 100320.

Derakhshan, A., & Beigy, H. (2019). Sentiment analysis on stock social media for stock price movement prediction. Engineering Applications of Artificial Intelligence, 85, 569–578.

Huang, Y., Capretz, L. F., & Ho, D. (2021). Machine learning for stock prediction based on fundamental analysis. 2021 IEEE Symposium Series on Computational Intelligence (SSCI), 1–10.

Indonesia, B. (2022). Data Suku Bunga.

Investing.com. (2022). USD IDR Historical Data.

Jiang, M., Liu, J., Zhang, L., & Liu, C. (2020). An improved Stacking framework for stock index prediction by leveraging tree-based ensemble models and deep learning algorithms. Physica A: Statistical Mechanics and Its Applications, 541, 122272. https://doi.org/10.1016/j.physa.2019.122272

Katoch, S., Chauhan, S. S., & Kumar, V. (2021). A review on genetic algorithm: past, present, and future. Multimedia Tools and Applications, 80, 8091–8126.

Kumbure, M. M., Lohrmann, C., Luukka, P., & Porras, J. (2022). Machine learning techniques and data for stock market forecasting: A literature review. Expert Systems with Applications, 197, 116659.

Mesquita, C. M., Oliveira, R. A. De, & Pereira, A. C. M. (2020). Combining an LSTM neural network with the Variance Ratio Test for time series prediction and operation on the Brazilian stock market. 2020 International Joint Conference on Neural Networks (IJCNN), 1–8.

Mndawe, S. T., Paul, B. S., & Doorsamy, W. (2022). Development of a stock price prediction framework for intelligent media and technical analysis. Applied Sciences, 12(2), 719.

Peng, Y., Albuquerque, P. H. M., Kimura, H., & Saavedra, C. A. P. B. (2021). Feature selection and deep neural networks for stock price direction forecasting using technical analysis indicators. Machine Learning with Applications, 5, 100060.

pypi. (2023). Snscrape python project.

Qu, Q., Li, Z., Tang, J., Wu, S., & Wang, R. (2019). A trend forecast of import and export trade total volume based on LSTM. IOP Conference Series: Materials Science and Engineering, 646(1), 012002.

Shah, J., Vaidya, D., & Shah, M. (2022). A comprehensive review on multiple hybrid deep learning approaches for stock prediction. Intelligent Systems with Applications, 200111.

Sivapurapu, S. A. (2020). Comparitive Study of Time Series and Deep Learning Algorithms for Stock Price Prediction. International Journal of Advanced Computer Science and Applications, 11(6).

Turchin, A., Masharsky, S., & Zitnik, M. (2023). Comparison of BERT implementations for natural language processing of narrative medical documents. Informatics in Medicine Unlocked, 36, 101139.

Wahyuddin, E. P. (2022). Pemodelan Prediksi Harga Saham Menggunakan Long-Short Term Memory: Studi Empiris pada Saham Bank Rakyat Indonesia.

Wu, S., Liu, Y., Zou, Z., & Weng, T.-H. (2022). S_I_LSTM: stock price prediction based on multiple data sources and sentiment analysis. Connection Science, 34(1), 44–62.

Yahoo. (2022). Yahoo Finance - Stock Market Live, Quotes, Business & Finance News.

Yang, C., Zhai, J., & Tao, G. (2020). Deep learning for price movement prediction using convolutional neural network and long short-term memory. Mathematical Problems in Engineering, 2020.

Yang, L., & Shami, A. (2020). On hyperparameter optimization of machine learning algorithms: Theory and practice. Neurocomputing, 415, 295–316.

Yu, Y., Si, X., Hu, C., & Zhang, J. (2019). A review of recurrent neural networks: LSTM cells and network architectures. Neural Computation, 31(7), 1235–1270.

Downloads

Published

2025-03-04

Issue

Section

Articles