Forecasting the Moroccan Stock Market: A Theoretical Approach Integrating Macroeconomic and Sentiment Data Through Deep Learning
Author(s)
Sanae Ait Jillali , Imad Talhartit , Mounime El Kabbouri ,
Download Full PDF Pages: 10-23 | Views: 15 | Downloads: 5 | DOI: 10.5281/zenodo.15576354
Abstract
In today’s data-driven economy, predicting stock market behavior has become a key focus for both finance professionals and academics. Traditionally reliant on historical and economic data, stock price forecasting is now being enhanced by AI technologies, especially Deep Learning and Natural Language Processing (NLP), which allow the integration of qualitative data like news sentiment and investor opinions.
Deep Learning uses multi-layered neural networks to analyze complex patterns, while NLP enables machines to interpret human language, making it useful for extracting sentiment from media sources. Though most research has focused on developed markets, emerging economies like Morocco offer a unique context due to their evolving financial systems and data limitations.
This study takes a theoretical and exploratory approach, aiming to conceptually examine how macroeconomic indicators and sentiment analysis can be integrated using deep learning models to enhance stock price prediction in Morocco. Rather than building a model, the paper reviews literature, evaluates data sources, and identifies key challenges and opportunities.
Ultimately, the study aims to bridge AI techniques with financial theory in an emerging market setting, providing a foundation for future empirical research and interdisciplinary collaboration.
Keywords
Stock Price Prediction, Deep Learning, Natural Language Processing (NLP), Sentiment Analysis, Macroeconomic Indicators, Emerging Markets, Moroccan Financial Market.
JEL classification: C45, G17, E37
References
1. Abdullah, H. S., Ali, N. H., Jassim, A. H., and Hussain, S. H. (2024). An analytical comparison of the behavior of machine learning and deep learning in stock market prediction. Baghdad Science Journal, 22(1), 297-309. https://doi.org/10.21123/bsj.2024.10017
2. Alam, Z., and Rashid, K. (2015). Time series analysis of the relationship between macroeconomic factors and the stock market returns in Pakistan. Yaşar Üniversitesi E-Dergisi, 9(36), 6361–6370. https://doi.org/10.19168/jyu.55431
3. Alam, Z., Mohsin, M., Latif, K., and Rehman, M. Z. (2020). The impact of macroeconomic factors on stock market: An evidence from China and Pakistan. NICE Research Journal, 13(2). https://doi.org/10.51239/nrjss.v0i0.171
4. Ali, S., Nzotta, S. M., Akujuobi, L. C., and Nwaimo, I. O. (2017). The impact of macroeconomic variables on stock market performance in Sub-Saharan Africa: Evidence from Nigeria, Ghana, and South Africa. African Journal of Economic Review, 5(2), 1–16.
5. Alimoussa, A., and Assalih, H. (2023). The répercussion of macroeconomic factors on the performance of the Moroccan stock market: Econometric study using the VAR model. International Journal of Accounting, Finance, Auditing, Management and Economics, 4(4-2), 581–601. https://doi.org/10.5281/zenodo.8299557
6. Araci, D. (2019). FinBERT: A Pretrained Language Model for Financial Communications. arXiv preprint arXiv:1908.10063. https://arxiv.org/abs/1908.10063
7. Belcaid, K., and El Ghini, A. (2021). Macro-finance determinants and the stock market development: Evidence from Morocco. Middle East Development Journal, 13(1), 1–29. https://doi.org/10.1080/17938120.2021.1898191
8. Bollen, J., Mao, H., and Zeng, X. (2011). Twitter mood predicts the stock market. Journal of Computational Science, 2(1), 1–8. https://doi.org/10.1016/j.jocs.2010.12.007
9. Bourezk, N., Kadri, A., and Gassara, H. (2020). Analyzing the Moroccan stock market using machine learning and sentiment analysis. Proceedings of the 5th International Conference on Advanced Computer Science and Information Systems, 341–348. https://doi.org/10.1109/ICACSIS49394.2020.9243833
10. 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
11. Chen, N. F., Roll, R., and Ross, S. A. (1986). Economic forces and the stock market. Journal of Business, 59(3), 383–403. https://doi.org/10.1086/296344
12. Dahlman, C. (2023). The influence of macroeconomic variables on stock market indices: A study of the United States. Journal of Financial Economics, 15(2), 1–18.
13. Deveikyte, D., Campbell, A., and Ojo, A. (2020). Sentiment analysis of financial news and tweets for stock market prediction. arXiv preprint arXiv:2012.05906. https://arxiv.org/abs/2012.05906
14. El Yamani, R. (2023). The impact of stock market development on economic growth in Morocco: An analysis using the VAR approach. International Journal of Accounting, Finance, Auditing, Management and Economics, 4(4-2), 625–645. https://doi.org/10.5281/zenodo.6611955
15. Elbousty, M. D., and Oubdi, L. (2020). Volatility stylized facts in the Moroccan stock market: Evidence from both aggregate and disaggregate data. Turkish Economic Review, 7(2), 99–127. Researchgate
16. Epalanga, P. (2021). The impact of macroeconomic variables on stock market returns: Evidence from Egypt, Mauritius, and South Africa. African Journal of Economic Review, 9(1), 1–20.
17. Epaphra, M., and Salema, S. (2016). Macroeconomic variables and stock market performance in Tanzania: Evidence from Dar es Salaam Stock Exchange. International Journal of Economics and Finance Studies, 8(2), 1–12.
18. Fama, E. F. (1970). Efficient capital markets: A review of theory and empirical work. Journal of Finance, 25(2), 383–417. https://doi.org/10.1111/j.1540-6261.1970.tb00518.x
19. Ferson, W. E., and Harvey, C. R. (1991). The variation of economic risk premiums. Journal of Political Economy, 99(2), 385–411. https://doi.org/10.1086/261756
20. Filis, G. (2010). Macroeconomic determinants of stock market fluctuations: The case of BIST-100. International Research Journal of Finance and Economics, 49, 111–120.
21. Fischer, T., and Krauss, C. (2018). Deep learning with long short-term memory networks for financial market prediction. European Journal of Operational Research, 270(2), 654–669. https://doi.org/10.1016/j.ejor.2017.11.054
22. Goel, H., and 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
23. 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
24. Iqbal, J., Sohail, M. K., and Malik, M. K. (2023). Predicting the future financial performance of Islamic banks: A sentiment analysis approach. International Journal of Islamic and Middle Eastern Finance and Management, 16(6), 1287–1305. https://doi.org/10.1108/IMEFM-07-2022-0267
25. Jiang, T., and Zeng, A. (2023). Financial sentiment analysis using FinBERT with application in predicting stock movement. arXiv. https://doi.org/10.48550/arXiv.2306.02136
26. Katende, S. (2021). Natural language financial forecasting: The South African context (Master’s thesis, University of Cape Town). http://hdl.handle.net/11427/33828
27. Kejriwal, S., Kumar, A., and Sharma, S. (2024). Empirical evaluation of classification techniques for financial text sentiment analysis. Journal of Financial Data Science, 10(1), 1–18. https://doi.org/10.2139/ssrn.3572345
28. Kharbouch, O., and Ouaskou, H. (2023). Assessment of the impact of monetary policy on stock price volatility: Revisiting the short and long-term underlying relationship. International Journal of Accounting, Finance, Auditing, Management and Economics, 4(4-2), 603–623. https://doi.org/10.5281/zenodo.10038807
29. Kitov, I., Kitov, O., and Dolinskaya, I. (2008). Long-term economic growth and the stock market: A cointegration approach. Journal of Applied Econometrics, 23(6), 755–775.
30. Koukaras, P., Nousi, C., and Tjortjis, C. (2022). Stock market prediction using microblogging sentiment analysis and machine learning. Telecom, 3(2), 358–378. https://doi.org/10.3390/telecom3020019
31. Lemeirut, L. (2021). The impact of macroeconomic variables on stock market returns in Tanzania. African Journal of Economic Review, 9(2), 1–15.
32. Liu, F., Guo, S., Xing, Q., Sha, X., Chen, Y., Jin, Y., Zheng, Q., and Yu, C. (2024). Application of an ANN and LSTM-based ensemble model for stock market prediction. arXiv. https://doi.org/10.48550/arXiv.2410.20253
33. Liu, H., and Guo, X. (2024). Financial market sentiment analysis using epistemic neural networks optimized with the elk herd algorithm. Journal of Electrical Systems, 20(1), 1–12. https://journal.esrgroups.org/jes/article/view/4146
34. Liu, Y., Huang, J., and Yang, T. (2023). Forecasting US stock prices through sentiment analysis and machine learning: A case study of Tesla Inc. Advances in Economics, Management and Political Sciences, 44, 198–212. https://doi.org/10.54254/2754-1169/44/20232233
35. Liu, Y., Qin, Z., Li, P., and Wan, T. (2017). Stock volatility prediction using recurrent neural networks with sentiment analysis. In S. Benferhat, K. Tabia, & M. Ali (Eds.), Advances in Artificial Intelligence: From Theory to Practice (pp. 255–267). Springer. https://doi.org/10.1007/978-3-319-60042-0_22
36. Loughran, M., and McDonald, B. (2011). When is a liability not a liability? Textual analysis, dictionaries, and 10‐Ks. The Journal of Finance, 66(1), 35–65. https://doi.org/10.1111/j.1540-6261.2010.01625.x
37. 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
38. Mitta, N. R. (2023). Leveraging Natural Language Processing (NLP) for AI-Based Sentiment Analysis in Financial Markets: Real-Time Insights for Trading Strategies and Risk Management. African Journal of Artificial Intelligence and Sustainable Development, 3(2). https://africansciencegroup.com/index.php/AJAISD/article/view/209
39. Muchir, M. (2012). The impact of macroeconomic variables on stock market performance: Evidence from Kenya. International Journal of Business and Social Science, 3(10), 1–10.
40. Neifar, S., Dhouib, S., Bouhamed, S., et al. (2021). The relationship between macroeconomic variables and stock market performance: Evidence from the United Kingdom. International Journal of Economics and Finance, 13(3), 1–12.
41. 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
42. Pardeshi, K., Gill, S.S., and Abdelmoniem, A.M. (2023). Stock market price prediction: A hybrid LSTM and sequential self-attention based approach. arXiv. https://arxiv.org/abs/2308.04419
43. Pinto Souza, T., Kolchyna, O., Treleaven, P. C., and Aste, T. (2015). Twitter sentiment analysis applied to finance: A case study in the retail industry. arXiv preprint arXiv:1507.00784. https://doi.org/10.48550/arXiv.1507.00784
44. Ranco, G., Aleksovski, D., Caldarelli, G., Grčar, M., and Mozetič, I. (2014). The effects of Twitter sentiment on stock price returns. PloS One, 10(9), e0138441. https://doi.org/10.1371/journal.pone.0138441
45. Rawat, D., Patni, S., and Mehta, R. (2021). Stock prices and macroeconomic indicators: Investigating a correlation in the Indian context. arXiv. https://doi.org/10.48550/arXiv.2112.08071
46. Razouk, A., Melliani, H., El Adnani, J. M., and Falloul, M. E. (2023). Analyzing public sentiment towards Islamic finance through social media: Using sentiment analysis on Twitter data. International Review on Modelling and Simulations, 37(6). https://doi.org/10.18280/ria.370610
47. Sawhney, R., Singh, M., and Mathur, P. (2021). Sentiment-aware stock market prediction using deep learning models. Journal of Theoretical and Applied Electronic Commerce Research, 16(6), 2494–2515. https://doi.org/10.3390/jtaer160600141
48. Sen, J., Dutta, A., and Mehtab, S. (2021). Profitability analysis in stock investment using an LSTM-based deep learning model. arXiv. https://arxiv.org/abs/2104.06259
49. Shiller, R. J. (2003). From Efficient Markets Theory to Behavioral Finance. Journal of Economic Perspectives, 17(1), 83–104. https://doi.org/10.1257/089533003321164967
50. Talhartit, I., Ait Jillali, S., and El Kabbouri, M. (2022). BEHAVIORAL FINANCE: HOW ARE TRADERS' FINANCIAL DECISIONS AND PERFORMANCE IMPACTED BY BEHAVIORAL BIASES UNDER UNCERTAINTY?. International Journal of Sciences Academic Research, 3(10), 4588-4597.
51. Talhartit, I., Ait Jillali, S., and El Kabbouri, M. (2025). Machine Learning for Stock Price Prediction on the Casablanca Stock Exchange: A Comparative Study of ANN and LSTM Approaches. Archives of Business Research, 13(05), 46-57. http://doi.org/10.14738/abr.1305.18770
52. Talhartit, I., Ifleh, A., and 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
53. Terblanche, M., and Marivate, V. (2021). Towards financial sentiment analysis in a South African landscape. arXiv preprint arXiv:2106.10004. https://doi.org/10.48550/arXiv.2106.10004
54. Tetlock, P. C. (2007). Giving content to investor sentiment: The role of media in the stock market. Journal of Finance, 62(3), 1139–1168. https://doi.org/10.1111/j.1540-6261.2007.01232.x
55. Touzani, Y., and 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
56. Visković, A., Miletić, S., and Grbac, M. (2022). The impact of macroeconomic variables on stock market returns: Evidence from the United States. Journal of Applied Economics and Business, 10(1), 1–15.
57. Wang, X. (2024). Impact of macroeconomics variables on stock market indices during the period 2010–2020. Highlights in Business, Economics and Management, 24, 366–375. https://doi.org/10.54097/mccfv866
58. 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
59. Worlu, R. O., and Omodero, C. O. (2017). Macroeconomic variables and stock market performance in selected African countries. International Journal of Economics and Financial Issues, 7(4), 1–9.
60. Xiao, J. (2023). Stock prediction using LSTM model. Applied and Computational Engineering, 8, 74–79. https://doi.org/10.54254/2755-2721/8/20230084
61. Xie, L., Zhang, Z., and Zheng, Y. (2020). Stock price prediction using sentiment analysis and deep learning. Procedia Computer Science, 175, 38–45.
62. Yang, Y., Zhang, X., and Chen, H. (2024). Stock price prediction based on hybrid PCA-EMD-LSTM framework with sentiment analysis. Applied Sciences, 12(21), 10823.
63. Zahhar, A. A. Y. (2024). Exploring the impact of sentiment analysis on price prediction. Lehigh University Theses and Dissertations. https://preserve.lehigh.edu/lehigh-scholarship/graduate-publications-theses-dissertations/theses-dissertations/exploring-impact
64. 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
65. Zhong, Y., and Enke, D. (2017). Financial market prediction with deep learning: A survey. Proceedings of the 2017 IEEE International Conference on Data Mining Workshops, 618–625. https://doi.org/10.1109/ICDMW.2017.56
Cite this Article: