Machine Learning for Stock Price Prediction on the Casablanca Stock Exchange: A Comparative Study of ANN and LSTM Approaches
DOI:
https://doi.org/10.14738/abr.1305.18770Keywords:
Stock price forecasting, Casablanca Stock Exchange, Long Short-Term Memory (LSTM), Artificial Neural Networks (ANN), Prediction accuracyAbstract
Capital markets play a fundamental role in the economy by facilitating the flow of funds between investors with capital surpluses and those with financing needs. However, these markets' inherent complexity and high volatility—amplified by economic crises and geopolitical events—make decision-making particularly challenging. In this context, artificial intelligence (AI), especially machine learning (ML) and deep learning (DL), has become increasingly relevant for modeling complex financial time series such as stock prices. Among various learning approaches, Long Short-Term Memory (LSTM) networks stand out for their ability to capture long-term dependencies in sequential data.
This study compares the predictive performance of LSTM and Artificial Neural Networks (ANN) models, on ten stocks comprising the MADEX index of the Casablanca Stock Exchange, across three forecasting horizons (10, 20, and 30 days). Results demonstrate that the LSTM model consistently outperforms the ANN model in terms of accuracy and trend detection. For instance, over a 30-day horizon, the LSTM correctly predicted 8 out of 10 stocks, compared to only 4 for the ANN. This work is part of a broader research effort aimed at identifying the most effective model for stock price forecasting. Building on the results of this and previous studies, particularly those involving LSTM models optimized using genetic algorithms, future research will explore other models such as Gated Recurrent Units (GRU) and Support Vector Machines (SVM) to further enhance prediction accuracy and robustness.
References
Abdullah, H. S., Ali, N. H., Jassim, A. H., & Hussain, S. H. (2024). An analytical comparison of the behavior of machine learning and deep learning in stock market prediction. Baghdad Science Journal. https://doi.org/10.21123/bsj.2024.10017
Budiharto, W. (2021). Data science approach to stock prices forecasting in Indonesia during Covid-19 using Long Short-Term Memory (LSTM). Journal of Big Data, 8(1), 47. https://doi.org/10.1186/s40537-021-00430-0
Dargan, S., & Kumar, M. (2019). A survey of deep learning and its applications: A new paradigm to machine learning. Archives of Computational Methods in Engineering, 27, 1071–1092. https://doi.org/10.1007/s11831-019-09344-w
Fischer, T., & Krauß, C. (2018). Deep learning with Long Short-Term Memory networks for financial market predictions. European Journal of Operational Research, 270(2), 654-669. https://doi.org/10.1016/j.ejor.2018.03.029
Goel, H., & Singh, N.P. (2022). Dynamic prediction of Indian stock market: An artificial neural network approach. International Journal of Ethics and Systems, 38(1), 35–46. https://doi.org/10.1108/IJOES-11-2020-0184
Hedayati Moghaddam, M., Hedayati Moghaddam, S., & Esfandyari, M. (2016). Stock market index prediction using artificial neural network. Journal of Economics and Finance, 40(3), 551–563. https://doi.org/10.1007/s12197-015-9310-4
Hu, J. (2024). A high-performance stock prediction system leveraging LSTM neural networks. Applied and Computational Engineering, 114, 65–72. https://doi.org/10.54254/2755-2721/2024.18219
Jillali, S. A., & Belkasseh, M. (2022). Financial performance of initial public offerings: Exploratory study. Archives of Business Research, 10(3), 171–190. https://doi.org/10.14738/abr.103.12067
Li, Y. (2017). Deep reinforcement learning: An overview. arXiv:1701.07274. https://arxiv.org/abs/1701.07274
Liu, F., Guo, S., Xing, Q., Sha, X., Chen, Y., Jin, Y., Zheng, Q., & Yu, C. (2024). Application of an ANN and LSTM-based ensemble model for stock market prediction. arXiv. https://arxiv.org/abs/2410.20253
Ma, Q. (2020). Comparison of ARIMA, ANN, and LSTM for stock price prediction. E3S Web of Conferences, 218, 01026. https://doi.org/10.1051/e3sconf/202021801026
Meena, K. S., & Suriya, S. (2020). A survey on supervised and unsupervised learning techniques. Proceedings of the International Conference on Artificial Intelligence, Smart Grid, and Smart City Applications. https://doi.org/10.1007/978-3-030-24051-6_58
Olotu, S. I. (2023). A multivariate LSTM-based deep learning model for stock market prediction. Journal of Financial Engineering and Applications, 9(2), 45-52. https://doi.org/10.1016/j.jfea.2023.01.017
Pardeshi, K., Gill, S.S., & Abdelmoniem, A.M. (2023). Stock market price prediction: A hybrid LSTM and sequential self-attention based approach. arXiv. https://arxiv.org/abs/2308.04419
Sen, J., Dutta, A., & Mehtab, S. (2021). Profitability analysis in stock investment using an LSTM-based deep learning model. arXiv. https://arxiv.org/abs/2104.06259
Sezer, S., Ozbayoglu, A., & Dogdu, E. (2017). An artificial neural network-based stock trading system using technical analysis and big data framework. Proceedings of the 2017 IEEE 16th International Symposium on Network Computing and Applications, 1–8. https://doi.org/10.1109/INCA.2017.8368255
Shahrour, M.H., & Dekmak, M. (2022). Intelligent stock prediction: A neural network approach. International Journal of Financial Engineering, 9(4), 2250016. https://doi.org/10.1142/S2424786322500165
Talhartit, I., Ifleh, A., & El Kabbouri, M. (2024). Prédire les cours des actions à l’aide d’algorithmes de machine learning : Étude comparative entre les réseaux LSTM (Long Short-Term Memory) simples et les LSTM optimisés par des algorithmes génétiques. African Scientific Journal, 3(25), 0686. https://doi.org/10.5281/zenodo.13388410
Touzani, Y., & Douzi, K. (2021). An LSTM and GRU based trading strategy adapted to the Moroccan market. Journal of Big Data, 8, 126. https://doi.org/10.1186/s40537-021-00512-z
Varshney, A., & Srivastava, S. (2023). A comparative study of future stock price prediction through artificial neural network and ARIMA modelling. International Journal of Computer Applications, 175(1), 1–5. https://doi.org/10.5120/ijca2023922642
Wen, H. (2024). Prediction of stock price by neural network based on CNN, LSTM, ANN. Advances in Economics, Management and Political Sciences, 87, 229–237. https://doi.org/10.54254/2754-1169/87/20240899
Xiao, J. (2023). Stock prediction using LSTM model. Applied and Computational Engineering, 8, 74–79. https://doi.org/10.54254/2755-2721/8/20230084
Zhang, J. (2023). Stock price prediction based on the Long Short-Term Memory network. Applied and Computational Engineering, 115, 50-58. https://doi.org/10.1016/j.apceng.2023.04.014
Downloads
Published
How to Cite
Issue
Section
License
Copyright (c) 2025 Imad Talhartit, Sanae Ait Jillali, Mounime El Kabbouri

This work is licensed under a Creative Commons Attribution 4.0 International License.