Predicting Stock Market Trends Based on Moving Average Using LSTM Algorithm
DOI:
https://doi.org/10.31154/cogito.v10i2.648.486-495Keywords:
LSTM, Machine Learning, Moving average, Moving average crossover, RNN, Stock Market Trend PredictionAbstract
Prediction of the stock market is highly needed to assist traders in making decisions. Many methods are used by traders to predict this such as technical analysis and moving averages. Moving averages predict stock trends based on the past data of the stock. The disadvantage of using a moving average analysis is the delay in crossover signals. As a solution, a deep learning technique known as LSTM is applied to the moving average strategy in this paper. In this research, the BBCA stock dataset spanning from 2010 to 2018 was utilized. The data was segmented into two parts: 2010-2017 for training data and 2018 for testing data. The training process employed Long Short-Term Memory (LSTM) networks, with the subsequent results being combined with moving average crossover techniques. Validation results indicate that BBCA shows a relatively minimal error. BBCA's average MAPE is 1.1%, and its RMSE is 65.402, classifying it within the "Highly Accurate Forecasting" category. Various combinations of moving average crossovers were tested during model training, with the combination of SMA05 and SMA50 for BBCA yielding the highest profit potential. Stocks that exhibit a downward trend are more likely to incur substantial losses. The model can predict the reversal of trends by predicting the trading signal given by the moving averages.References
N. Fitriani, A. Minanurohman, and G. Lusiano Firmansah, “Financial ratio analysis in stock price: Evidence from Indonesia,” JASET, vol. 14, no. 2, pp. 285–296, Dec. 2022, doi: 10.17509/jaset.v14i2.49132.
Y. Pan, “Stock Price Forecast of Chinese Leading Liquor Stocks Using the Simple Moving Average,” BCPBM, vol. 36, pp. 16–24, Jan. 2023, doi: 10.54691/bcpbm.v36i.3380.
D. D. P. Asthri, “Analisis Teknikal Dengan Indikator Moving Average Convergence Divergence Untuk Menentukan Sinyal Membeli Dan Menjual Dalam Perdagangan Saham (Studi Pada Perusahaan Sub Sektor Makanan Dan Minuman Di Bei Tahun 2013-2015),” 2016.
M. Nabipour, P. Nayyeri, H. Jabani, S. S., and A. Mosavi, “Predicting Stock Market Trends Using Machine Learning and Deep Learning Algorithms Via Continuous and Binary Data; a Comparative Analysis,” IEEE Access, vol. 8, pp. 150199–150212, 2020, doi: 10.1109/ACCESS.2020.3015966.
H. Xiao-feng and W. Ya-jun, “Research on Simple Moving Average Trading System Based on SVM,” International Conference on Management Science & Engineering, vol. 19, pp. 1393–1397, 2012.
Wu, Haoran, Chen, Shuqi, and Ding, Yicheng, “Comparison of ARIMA and LSTM for Stock Price Prediction,” FERM, vol. 6, no. 1, 2023, doi: 10.23977/ferm.2023.060101.
J. Sen, S. Mehtab, and A. Dutta, “Stock Price Prediction Using Machine Learning and LSTM-Based Deep Learning Models.” Aug. 05, 2021. doi: 10.36227/techrxiv.15103602.
S. Hansun and J. C. Young, “Predicting LQ45 financial sector indices using RNN-LSTM,” J Big Data, vol. 8, no. 1, p. 104, Dec. 2021, doi: 10.1186/s40537-021-00495-x.
H. Qian, “Stock Predicting based on LSTM and ARIMA,” in Proceedings of the 2022 2nd International Conference on Economic Development and Business Culture (ICEDBC 2022), vol. 225, Y. Jiang, Y. Shvets, and H. Mallick, Eds., in Advances in Economics, Business and Management Research, vol. 225. , Dordrecht: Atlantis Press International BV, 2022, pp. 485–490. doi: 10.2991/978-94-6463-036-7_72.
School of Computer Science and Engineering, Vellore Institute of Technology, Chennai, India, K. Sakshi, and V. A, “An ARIMA- LSTM Hybrid Model for Stock Market Prediction Using Live Data,” JESTR, vol. 13, no. 4, pp. 117–123, Aug. 2020, doi: 10.25103/jestr.134.11.
S. Dinesh, “STOCK PRICE PREDICTION USING LSTM,” vol. 10, no. 6, pp. 436–442, 2021.
S. K. Lakshminarayanan and J. McCrae, “A Comparative Study of SVM and LSTM Deep Learning Algorithms for Stock Market Prediction”.
D. Wei, “Prediction of Stock Price Based on LSTM Neural Network,” in 2019 International Conference on Artificial Intelligence and Advanced Manufacturing (AIAM), Dublin, Ireland: IEEE, Oct. 2019, pp. 544–547. doi: 10.1109/AIAM48774.2019.00113.
D. Liu, A. Chen, and J. Wu, “Research on Stock Price Prediction Method Based on Deep Learning,” in 2020 2nd International Conference on Information Technology and Computer Application (ITCA), Guangzhou, China: IEEE, Dec. 2020, pp. 69–72. doi: 10.1109/ITCA52113.2020.00022.
M. M. Hasan, P. Roy, S. Sarkar, and M. M. Khan, “Stock Market PredictionWeb Service Using Deep Learning by LSTM,” in 2021 IEEE 11th Annual Computing and Communication Workshop and Conference (CCWC), NV, USA: IEEE, Jan. 2021, pp. 0180–0183. doi: 10.1109/CCWC51732.2021.9375835.
D. M. Q. Nelson, A. C. M. Pereira, and R. A. De Oliveira, “Stock market’s price movement prediction with LSTM neural networks,” in 2017 International Joint Conference on Neural Networks (IJCNN), Anchorage, AK, USA: IEEE, May 2017, pp. 1419–1426. doi: 10.1109/IJCNN.2017.7966019.
N. Sawalkar, A. Kadam, M. Patil, and O. Jadhav, “Stock Price Prediction Using LSTM on Indian share market,” vol. 3, no. 4, 2022.
O. Colliot, Ed., Machine Learning for Brain Disorders, vol. 197. in Neuromethods, vol. 197. New York, NY: Springer US, 2023. doi: 10.1007/978-1-0716-3195-9.
N. Sakinah, M. Tahir, T. Badriyah, and I. Syarif, “LSTM With Adam Optimization-Powered High Accuracy Preeclampsia Classification,” in 2019 International Electronics Symposium (IES), Surabaya, Indonesia: IEEE, Sep. 2019, pp. 314–319. doi: 10.1109/ELECSYM.2019.8901536.
H. N. Bhandari, B. Rimal, N. R. Pokhrel, R. Rimal, K. R. Dahal, and R. K. C. Khatri, “Predicting stock market index using LSTM,” Machine Learning with Applications, vol. 9, p. 100320, Sep. 2022, doi: 10.1016/j.mlwa.2022.100320.
E. Eka Patriya, “IMPLEMENTASI SUPPORT VECTOR MACHINE PADA PREDIKSI HARGA SAHAM GABUNGAN (IHSG),” tekno, vol. 25, no. 1, pp. 24–38, 2020, doi: 10.35760/tr.2020.v25i1.2571.
Downloads
Published
How to Cite
Issue
Section
License
Copyright (c) 2025 CogITo Smart Journal

This work is licensed under a Creative Commons Attribution 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).