IDEAS home Printed from https://ideas.repec.org/a/gam/jjrfmx/v17y2024i7p293-d1431830.html

Assessing the Predictive Power of Transformers, ARIMA, and LSTM in Forecasting Stock Prices of Moroccan Credit Companies

Author

Listed:
  • Karima Lahboub

    (Laboratory of Research and Studies in Management, Entrepreneurship and Finance (LAREMEF), Nation School of Commerce and Management of Fez, Sidi Mohamed Ben Abdellah University, Fes 30050, Morocco)

  • Mimoun Benali

    (Laboratory of Research and Studies in Management, Entrepreneurship and Finance (LAREMEF), Nation School of Commerce and Management of Fez, Sidi Mohamed Ben Abdellah University, Fes 30050, Morocco)

Abstract

In this paper, we present a data-driven approach to forecasting stock prices in the Moroccan Stock Exchange. Our study tests three predictive models: ARIMA, LSTM, and transformers, applied to the historical stock price data of three prominent credit companies (EQD, LES, and SLF) listed on the Casablanca Stock Exchange. We carefully selected and optimized hyperparameters for each model to achieve optimal performance. Our results showed that the LSTM model achieved high accuracy, with R-squared values exceeding 0.99 for EQD and LES and surpassing 0.95 for SLF. These findings highlighted the effectiveness of LSTM in stock price forecasting. Our study offers practical insights for traders and investors in the Moroccan Stock Exchange, demonstrating how predictive modeling can aid in making informed decisions. This research contributes to advancing stock market forecasting in Morocco, providing valuable tools for navigating the Casablanca Stock Exchange.

Suggested Citation

  • Karima Lahboub & Mimoun Benali, 2024. "Assessing the Predictive Power of Transformers, ARIMA, and LSTM in Forecasting Stock Prices of Moroccan Credit Companies," JRFM, MDPI, vol. 17(7), pages 1-16, July.
  • Handle: RePEc:gam:jjrfmx:v:17:y:2024:i:7:p:293-:d:1431830
    as

    Download full text from publisher

    File URL: https://www.mdpi.com/1911-8074/17/7/293/pdf
    Download Restriction: no

    File URL: https://www.mdpi.com/1911-8074/17/7/293/
    Download Restriction: no
    ---><---

    References listed on IDEAS

    as
    1. Ahmed, Abdullahi D. & Huo, Rui, 2021. "Volatility transmissions across international oil market, commodity futures and stock markets: Empirical evidence from China," Energy Economics, Elsevier, vol. 93(C).
    Full references (including those not matched with items on IDEAS)

    Most related items

    These are the items that most often cite the same works as this one and are cited by the same works as this one.
    1. Mensi, Walid & Rehman, Mobeen Ur & Vo, Xuan Vinh, 2022. "Spillovers and diversification benefits between oil futures and ASEAN stock markets," Resources Policy, Elsevier, vol. 79(C).
    2. Roberto Cellini & Tiziana Cuccia & Johan Lyrvall, 2023. "On the price dynamics of non-fungible tokens: The ‘Bored Apes’ case," PLOS ONE, Public Library of Science, vol. 18(11), pages 1-20, November.
    3. Giang Thi Huong Vuong & Manh Huu Nguyen & Khanh Hoang, 2024. "Oil price uncertainty, oil pricing reform, and corporate profitability: The case of China," PLOS ONE, Public Library of Science, vol. 19(2), pages 1-25, February.
    4. Sen, Chitrakalpa & Chakrabarti, Gagari, 2024. "Beyond the glitter: An empirical assessment of the true risk and hedging role of precious metals," Resources Policy, Elsevier, vol. 96(C).
    5. Shuo YANG, 2025. "Identifying Multiple Bubbles and Time-Varying Contagion Effect between Iron Ore and China's Stock Markets: A New Recursive Evolving Test," Journal for Economic Forecasting, Institute for Economic Forecasting, vol. 0(1), pages 81-100, April.
    6. Javier Sánchez-García & Raffaele Mattera & Salvador Cruz-Rambaud & Roy Cerqueti, 2024. "Measuring financial stability in the presence of energy shocks," Post-Print hal-05115049, HAL.
    7. Ilyes Abid & Khaled Guesmi & Christian Urom & Saad Alshammari & Leila Dagher, 2024. "Strategic Commodities' Price Risk and Financial Contagion in Oil and Gas Exporting Countries," The Energy Journal, , vol. 45(1_suppl), pages 89-114, November.
    8. Elgammal, Mohammed M. & Ahmed, Walid M.A. & Alshami, Abdullah, 2021. "Price and volatility spillovers between global equity, gold, and energy markets prior to and during the COVID-19 pandemic," Resources Policy, Elsevier, vol. 74(C).
    9. Viorica Chirilă & Alina Cristina Nuta, 2025. "Dynamic connectedness analysis between crude oil price changes and Polish stock market sectors," Eastern Journal of European Studies, Centre for European Studies, Alexandru Ioan Cuza University, vol. 16, pages 98-127, June.
    10. Saif-Alyousfi, Abdulazeez Y.H., 2025. "Energy shocks and stock market returns under COVID-19: New insights from the United States," Energy, Elsevier, vol. 316(C).
    11. Banerjee, Ameet Kumar & Dionisio, Andreia & Sensoy, Ahmet & Goodell, John W., 2024. "Extant linkages between Shanghai crude oil and US energy futures: Insights from spillovers of higher-order moments," Energy Economics, Elsevier, vol. 136(C).
    12. Tong, Yuan & Wan, Ning & Dai, Xingyu & Bi, Xiaoyi & Wang, Qunwei, 2022. "China's energy stock market jumps: To what extent does the COVID-19 pandemic play a part?," Energy Economics, Elsevier, vol. 109(C).
    13. Liu, Jian & Chen, Chaoqiang & Mao, Xiaodan, 2025. "Risk spillover effect and portfolio strategy between Chinese commodity futures market and international green finance market," Research in International Business and Finance, Elsevier, vol. 79(C).
    14. Lin, Che-Chun & Chen, Han-Bo & Tsai, I-Chun, 2026. "Hedging extreme risks in US stocks caused by the shortage of US dollar liquidity: Evidence from the COVID-19 outbreak," The Quarterly Review of Economics and Finance, Elsevier, vol. 106(C).
    15. Yin, Libo & Cao, Hong & Xin, Yu, 2024. "Impact of crude oil price innovations on global stock market volatility: Evidence across time and space," International Review of Financial Analysis, Elsevier, vol. 96(PB).
    16. Wang, Kai-Hua & Su, Chi-Wei & Xiao, Yidong & Liu, Lu, 2022. "Is the oil price a barometer of China's automobile market? From a wavelet-based quantile-on-quantile regression perspective," Energy, Elsevier, vol. 240(C).
    17. Muñoz Mendoza, Jorge A. & Veloso Ramos, Carmen L. & Delgado Fuentealba, Carlos L. & Cornejo Saavedra, Edinson E. & Sepúlveda Yelpo, Sandra M., 2024. "Stock, foreign exchange and commodity markets linkages: Implications for risk diversification and portfolio management," Global Finance Journal, Elsevier, vol. 63(C).
    18. Coskun, Merve & Taspinar, Nigar, 2022. "Volatility spillovers between Turkish energy stocks and fossil fuel energy commodities based on time and frequency domain approaches," Resources Policy, Elsevier, vol. 79(C).
    19. Roudari, Soheil & Farahanifard, Saeed & Shahabadi, Abolfazl & Adeli, OmidAli, 2022. "بررسی مقیاس-زمان سرریز نوسانات میان نرخ ارز، تورم، سهام و مسکن در ایران [Investigating the time-frequency volatility spillover between exchange rate, inflation, stocks, and housing in Iran]," MPRA Paper 127004, University Library of Munich, Germany, revised 01 Nov 2022.
    20. Mensi, Walid & Aslan, Aylin & Vo, Xuan Vinh & Kang, Sang Hoon, 2023. "Time-frequency spillovers and connectedness between precious metals, oil futures and financial markets: Hedge and safe haven implications," International Review of Economics & Finance, Elsevier, vol. 83(C), pages 219-232.

    More about this item

    Keywords

    ;
    ;
    ;
    ;
    ;

    Statistics

    Access and download statistics

    Corrections

    All material on this site has been provided by the respective publishers and authors. You can help correct errors and omissions. When requesting a correction, please mention this item's handle: RePEc:gam:jjrfmx:v:17:y:2024:i:7:p:293-:d:1431830. See general information about how to correct material in RePEc.

    If you have authored this item and are not yet registered with RePEc, we encourage you to do it here. This allows to link your profile to this item. It also allows you to accept potential citations to this item that we are uncertain about.

    If CitEc recognized a bibliographic reference but did not link an item in RePEc to it, you can help with this form .

    If you know of missing items citing this one, you can help us creating those links by adding the relevant references in the same way as above, for each refering item. If you are a registered author of this item, you may also want to check the "citations" tab in your RePEc Author Service profile, as there may be some citations waiting for confirmation.

    For technical questions regarding this item, or to correct its authors, title, abstract, bibliographic or download information, contact: MDPI Indexing Manager The email address of this maintainer does not seem to be valid anymore. Please ask MDPI Indexing Manager to update the entry or send us the correct address (email available below). General contact details of provider: https://www.mdpi.com .

    Please note that corrections may take a couple of weeks to filter through the various RePEc services.

    IDEAS is a RePEc service. RePEc uses bibliographic data supplied by the respective publishers.