{"status":"ok","message-type":"work","message-version":"1.0.0","message":{"indexed":{"date-parts":[[2026,11,26]],"date-time":"2026-11-26T17:57:13Z","timestamp":1795715833037,"version":"4.11.3"},"reference-count":40,"publisher":"Springer Science and Business Media LLC","issue":"1","license":[{"start":{"date-parts":[[2021,9,24]],"date-time":"2021-09-24T00:00:00Z","timestamp":1632441600000},"content-version":"tdm","delay-in-days":0,"URL":"https:\/\/creativecommons.org\/licenses\/by\/4.0"},{"start":{"date-parts":[[2021,9,24]],"date-time":"2021-09-24T00:00:00Z","timestamp":1632441600000},"content-version":"vor","delay-in-days":0,"URL":"https:\/\/creativecommons.org\/licenses\/by\/4.0"}],"content-domain":{"domain":["link.springer.com"],"crossmark-restriction":false},"short-container-title":["J Big Data"],"published-print":{"date-parts":[[2021,12]]},"abstract":"<jats:title>Abstract<\/jats:title><jats:p>Forecasting stock prices is an extremely challenging job considering the high volatility and the number of variables that influence it (political, economical, social, etc.). Predicting the closing price provides useful information and helps the investor make the right decision. The use of deep learning and more precisely of recurrent neural networks (RNNs) in stock market forecasting is an increasingly common practice in the literature. Long Short Term Memory (LSTM) and Gated Recurrent Unit (GRU) architectures are among the most widely used types of RNNs, given their suitability for sequential data. In this paper, we propose a trading strategy designed for the Moroccan stock market, based on two deep learning models: LSTM and GRU to predict the closing price in the short and medium term respectively. Decision rules for buying and selling stocks are implemented based on the forecasting given by the two models, then over four 3-year periods, we simulate transactions using these decision rules with different settings for each stock. The returns obtained will be used to estimate an expected return. We only hold stocks that outperform a benchmark index (expected return &gt; threshold). The random search is then used to choose one of the available parameters and the performance of the portfolio built from the selected stocks will be tested over a further period. The repetition of this process with a variation of portfolio size makes it possible to select the best possible combination of stock each with the optimized parameter for the decision rules. The proposed strategy produces very promising results and outperforms the performance of indices used as benchmarks in the local market. Indeed, the annualized return of our strategy proposed during the test period is 27.13%, while it is 0.43% for Moroccan all share Indice (MASI), 15.24% for the distributor sector indices, and 19.94% for the pharmaceutical industry indices. Noted that brokerage fees are estimated and subtracted for each transaction. which makes the performance found even more realistic.<\/jats:p>","DOI":"10.1186\/s40537-021-00512-z","type":"journal-article","created":{"date-parts":[[2021,9,24]],"date-time":"2021-09-24T12:42:32Z","timestamp":1632487352000},"update-policy":"https:\/\/doi.org\/10.1007\/springer_crossmark_policy","source":"Crossref","is-referenced-by-count":50,"title":["An LSTM and GRU based trading strategy adapted to the Moroccan market"],"prefix":"10.1186","volume":"8","author":[{"ORCID":"https:\/\/orcid.org\/0000-0003-0911-9780","authenticated-orcid":false,"given":"Yassine","family":"Touzani","sequence":"first","affiliation":[],"role":[{"vocabulary":"crossref","role":"author"}]},{"given":"Khadija","family":"Douzi","sequence":"additional","affiliation":[],"role":[{"vocabulary":"crossref","role":"author"}]}],"member":"297","published-online":{"date-parts":[[2021,9,24]]},"reference":[{"key":"512_CR1","doi-asserted-by":"publisher","first-page":"383","DOI":"10.2307\/2325486","volume":"25","author":"EF Fama","year":"1970","unstructured":"Fama EF. Efficient capital markets: a review of theory and empirical work. J Finance. 1970;25:383\u2013417.","journal-title":"J Finance"},{"key":"512_CR2","doi-asserted-by":"publisher","first-page":"692","DOI":"10.1007\/s11142-013-9231-1","volume":"18","author":"J Green","year":"2013","unstructured":"Green J, Hand JRM, Zhang XF. The supraview of return predictive signals. Rev Account Stud. 2013;18:692\u2013730.","journal-title":"Rev Account Stud."},{"key":"512_CR3","doi-asserted-by":"publisher","first-page":"1","DOI":"10.1016\/j.inffus.2018.09.013","volume":"49","author":"D Praveen Kumar","year":"2019","unstructured":"Praveen Kumar D, Amgoth T, Annavarapu CSR. Machine learning algorithms for wireless sensor networks: a survey. Informat Fusion. 2019;49:1\u201325.","journal-title":"Informat Fusion."},{"key":"512_CR4","doi-asserted-by":"publisher","first-page":"110212","DOI":"10.1016\/j.chaos.2020.110212","volume":"140","author":"F Shahid","year":"2020","unstructured":"Shahid F, Zameer A, Muneeb M. Predictions for COVID-19 with deep learning models of LSTM, GRU and Bi-LSTM. Chaos Solitons Fractals. 2020;140:110212.","journal-title":"Chaos Solitons Fractals."},{"key":"512_CR5","doi-asserted-by":"publisher","first-page":"110861","DOI":"10.1016\/j.chaos.2021.110861","volume":"146","author":"KE ArunKumar","year":"2021","unstructured":"ArunKumar KE, Kalaga DV, Kumar ChMS, Kawaji M, Brenza TM. Forecasting of COVID-19 using deep layer recurrent neural networks (RNNs) with gated recurrent units (GRUs) and long short-term memory (LSTM) cells. Chaos Solitons Fractals. 2021;146:110861.","journal-title":"Chaos Solitons Fractals."},{"key":"512_CR6","doi-asserted-by":"publisher","first-page":"208158","DOI":"10.1109\/ACCESS.2020.3038788","volume":"8","author":"S Wang","year":"2020","unstructured":"Wang S, Zhao J, Shao C, Dong C, Yin C. Truck traffic flow prediction based on LSTM and GRU methods with sampled GPS data. IEEE Access. 2020;8:208158\u201369.","journal-title":"IEEE Access."},{"key":"512_CR7","doi-asserted-by":"publisher","first-page":"17351","DOI":"10.1007\/s00521-020-04867-x","volume":"32","author":"IE Livieris","year":"2020","unstructured":"Livieris IE, Pintelas E, Pintelas P. A CNN-LSTM model for gold price time-series forecasting. Neural Comput Appl. 2020;32:17351\u201360.","journal-title":"Neural Comput Appl."},{"key":"512_CR8","doi-asserted-by":"publisher","first-page":"102741","DOI":"10.1016\/j.dsp.2020.102741","volume":"102","author":"H Liu","year":"2020","unstructured":"Liu H, Long Z. An improved deep learning model for predicting stock market price time series. Digital Signal Process. 2020;102:102741.","journal-title":"Digital Signal Process."},{"key":"512_CR9","doi-asserted-by":"publisher","first-page":"3999","DOI":"10.1109\/TSP.2013.2265222","volume":"61","author":"J Empirical Gilles","year":"2013","unstructured":"Empirical Gilles J. Transform wavelet. IEEE Trans Signal Process. 2013;61:3999\u20134010.","journal-title":"IEEE Trans Signal Process"},{"key":"512_CR10","doi-asserted-by":"crossref","unstructured":"Kennedy J, Eberhart R. Particle swarm optimization. In: Proceedings of ICNN\u201995\u2014International Conference on Neural Networks. 1995;4:1942\u20131948.","DOI":"10.1109\/ICNN.1995.488968"},{"key":"512_CR11","doi-asserted-by":"crossref","unstructured":"Althelaya KA, El-Alfy E-SM, Mohammed S. Stock market forecast using multivariate analysis with bidirectional and stacked (LSTM, GRU). In: 2018 21st Saudi Computer Society National Computer Conference (NCC). 2018. pp. 1\u20137.","DOI":"10.1109\/NCG.2018.8593076"},{"key":"512_CR12","first-page":"102583","volume":"55","author":"MM Patel","year":"2020","unstructured":"Patel MM, Tanwar S, Gupta R, Kumar N. A deep learning-based cryptocurrency price prediction scheme for financial institutions. J Informat Secur Appl. 2020;55:102583.","journal-title":"J Informat Secur Appl"},{"key":"512_CR13","doi-asserted-by":"publisher","first-page":"8040","DOI":"10.1007\/s11227-018-2577-1","volume":"76","author":"SI Lee","year":"2020","unstructured":"Lee SI, Yoo SJ. Threshold-based portfolio: the role of the threshold and its applications. J Supercomput. 2020;76:8040\u201357.","journal-title":"J Supercomput."},{"key":"512_CR14","doi-asserted-by":"publisher","first-page":"127","DOI":"10.1016\/j.physa.2018.11.061","volume":"519","author":"J Cao","year":"2019","unstructured":"Cao J, Li Z, Li J. Financial time series forecasting model based on CEEMDAN and LSTM. Phys A Statis Mech Appl. 2019;519:127\u201339.","journal-title":"Phys A Statis Mech Appl"},{"key":"512_CR15","doi-asserted-by":"publisher","first-page":"903","DOI":"10.1098\/rspa.1998.0193","volume":"454","author":"NE Huang","year":"1998","unstructured":"Huang NE, Shen Z, Long SR, Wu MC, Shih HH, Zheng Q, et al. The empirical mode decomposition and the Hilbert spectrum for nonlinear and non-stationary time series analysis. Proc R Soc Lond Ser A Math Phys Eng Sci. 1998;454:903\u201395.","journal-title":"Proc R Soc Lond Ser A Math Phys Eng Sci"},{"key":"512_CR16","doi-asserted-by":"crossref","unstructured":"Torres ME, Colominas MA, Schlotthauer G, Flandrin P. A complete ensemble empirical mode decomposition with adaptive noise. In: 2011 IEEE International Conference on Acoustics, Speech and Signal Processing (ICASSP). 2011. pp. 4144\u20134147.","DOI":"10.1109\/ICASSP.2011.5947265"},{"key":"512_CR17","doi-asserted-by":"publisher","first-page":"102212","DOI":"10.1016\/j.ipm.2020.102212","volume":"57","author":"X Li","year":"2020","unstructured":"Li X, Wu P, Wang W. Incorporating stock prices and news sentiments for stock market prediction: a case of Hong Kong. Informat Process Manage. 2020;57:102212.","journal-title":"Informat Process Manage"},{"key":"512_CR18","doi-asserted-by":"publisher","first-page":"47","DOI":"10.1186\/s40537-021-00430-0","volume":"8","author":"W Budiharto","year":"2021","unstructured":"Budiharto W. Data science approach to stock prices forecasting in Indonesia during Covid-19 using long short-term memory (LSTM). J Big Data. 2021;8:47.","journal-title":"J Big Data."},{"key":"512_CR19","doi-asserted-by":"publisher","first-page":"2091","DOI":"10.1016\/j.procs.2020.03.257","volume":"167","author":"A Yadav","year":"2020","unstructured":"Yadav A, Jha CK, Sharan A. Optimizing LSTM for time series prediction in Indian stock market. Proc Comput Sci. 2020;167:2091\u2013100.","journal-title":"Proc Comput Sci"},{"key":"512_CR20","doi-asserted-by":"crossref","unstructured":"Samarawickrama AJP, Fernando TGI. A recurrent neural network approach in predicting daily stock prices an application to the Sri Lankan stock market. 2017 IEEE International Conference on Industrial and Information Systems (ICIIS). 2017. pp. 1\u20136.","DOI":"10.1109\/ICIINFS.2017.8300345"},{"key":"512_CR21","doi-asserted-by":"publisher","first-page":"33","DOI":"10.2478\/acss-2020-0004","volume":"25","author":"Nti I kofi","year":"2020","unstructured":"kofi Nti I, Adekoya A, Weyori B. Predicting stock market price movement using sentiment analysis: evidence from Ghana. Appl Comput Syst. 2020;25:33\u201342.","journal-title":"Appl Comput Syst."},{"key":"512_CR22","doi-asserted-by":"publisher","first-page":"436","DOI":"10.1038\/nature14539","volume":"521","author":"Y LeCun","year":"2015","unstructured":"LeCun Y, Bengio Y, Hinton G. Deep learning. Nature. 2015;521:436\u201344.","journal-title":"Nature."},{"key":"512_CR23","unstructured":"Goodfellow I, Bengio Y, Courville A. Deep learning [Internet]. MIT Press; 2016. Available from: https:\/\/www.deeplearningbook.org."},{"key":"512_CR24","doi-asserted-by":"publisher","first-page":"85","DOI":"10.1016\/j.neunet.2014.09.003","volume":"61","author":"J Schmidhuber","year":"2015","unstructured":"Schmidhuber J. Deep learning in neural networks: an overview. Neural Netw. 2015;61:85\u2013117.","journal-title":"Neural Netw."},{"key":"512_CR25","doi-asserted-by":"publisher","first-page":"157","DOI":"10.1109\/72.279181","volume":"5","author":"Y Bengio","year":"1994","unstructured":"Bengio Y, Simard P, Frasconi P. Learning long-term dependencies with gradient descent is difficult. IEEE Trans Neural Netw. 1994;5:157\u201366.","journal-title":"IEEE Trans Neural Netw"},{"key":"512_CR26","doi-asserted-by":"publisher","first-page":"1735","DOI":"10.1162\/neco.1997.9.8.1735","volume":"9","author":"S Hochreiter","year":"1997","unstructured":"Hochreiter S, Schmidhuber J. Long short-term memory. Neural Comput. 1997;9:1735\u201380.","journal-title":"Neural Comput"},{"key":"512_CR27","doi-asserted-by":"crossref","unstructured":"Gers F, Schmidhuber J, Cummins FA. Learning to forget: continual prediction with LSTM. Neural Comput. 2000.","DOI":"10.1162\/089976600300015015"},{"key":"512_CR28","doi-asserted-by":"crossref","unstructured":"Cho K, van Merrienboer B, Gulcehre C, Bahdanau D, Bougares F, Schwenk H, et al. Learning phrase representations using RNN encoder-decoder for statistical machine translation. arXiv:14061078. 2014.","DOI":"10.3115\/v1\/D14-1179"},{"key":"512_CR29","unstructured":"Chung J, Gulcehre C, Cho K, Bengio Y. Empirical evaluation of gated recurrent neural networks on sequence modeling. arXiv:14123555. 2014."},{"key":"512_CR30","unstructured":"Jozefowicz R, Zaremba W, Sutskever I. An empirical exploration of recurrent network architectures. In: International Conference on Machine Learning PMLR. 2015;2342\u201350."},{"key":"512_CR31","doi-asserted-by":"crossref","unstructured":"Shewalkar A. Performance evaluation of deep neural networks applied to speech recognition: RNN, LSTM and GRU. JArtif Intell Soft Comput Res. 2019;235\u201345.","DOI":"10.2478\/jaiscr-2019-0006"},{"key":"512_CR32","unstructured":"http:\/\/www.casablanca-bourse.com\/bourseweb\/Liste-Societe.aspx?IdLink=20&Cat=7 1. The Casablanca Stock Exchange. http:\/\/www.casablanca-bourse.com\/bourseweb\/Liste-Societe.aspx?IdLink=20&Cat=7. Accessed 07 Feb 2021."},{"key":"512_CR33","unstructured":"Cogswell M, Ahmed F, Girshick R, Zitnick L, Batra D. Reducing overfitting in deep networks by decorrelating representations. arXiv:151106068. 2016"},{"key":"512_CR34","unstructured":"pandas-datareader https:\/\/pandas-datareader.readthedocs.io\/en\/. Accessed 12 Feb 2021."},{"key":"512_CR35","unstructured":"investpy 1.0.2 documentation, (n.d.). https:\/\/investpy.readthedocs.io\/. Accessed 12 Feb 2021."},{"key":"512_CR36","unstructured":"Team K. Keras documentation: Getting started. https:\/\/keras.io\/getting_started\/. Accessed 13 Oct 2020."},{"key":"512_CR37","doi-asserted-by":"crossref","unstructured":"He K, Zhang X, Ren S, Sun J. Delving deep into rectifiers: surpassing human-level performance on ImageNet Classification. Proceedings of the 2015 IEEE International Conference on Computer Vision (ICCV) [Internet]. USA: IEEE Computer Society; 2015. pp. 1026\u20131034.","DOI":"10.1109\/ICCV.2015.123"},{"key":"512_CR38","unstructured":"Kingma DP, Ba J. Adam: a method for stochastic optimization. arXiv:14126980. 2017."},{"key":"512_CR39","first-page":"1929","volume":"15","author":"N Srivastava","year":"2014","unstructured":"Srivastava N, Hinton G, Krizhevsky A, Sutskever I, Salakhutdinov R. Dropout: a simple way to prevent neural networks from overfitting. J Mach Learn Res. 2014;15:1929\u201358.","journal-title":"J Mach Learn Res"},{"key":"512_CR40","doi-asserted-by":"crossref","unstructured":"Zheng S, Song Y, Leung T, Goodfellow I. Improving the Robustness of Deep Neural Networks via Stability Training. arXiv:160404326 [cs] . 2016","DOI":"10.1109\/CVPR.2016.485"}],"container-title":["Journal of Big Data"],"original-title":[],"language":"en","link":[{"URL":"https:\/\/link.springer.com\/content\/pdf\/10.1186\/s40537-021-00512-z.pdf","content-type":"application\/pdf","content-version":"vor","intended-application":"text-mining"},{"URL":"https:\/\/link.springer.com\/article\/10.1186\/s40537-021-00512-z\/fulltext.html","content-type":"text\/html","content-version":"vor","intended-application":"text-mining"},{"URL":"https:\/\/link.springer.com\/content\/pdf\/10.1186\/s40537-021-00512-z.pdf","content-type":"application\/pdf","content-version":"vor","intended-application":"similarity-checking"}],"deposited":{"date-parts":[[2021,9,24]],"date-time":"2021-09-24T12:46:36Z","timestamp":1632487596000},"score":1,"resource":{"primary":{"URL":"https:\/\/journalofbigdata.springeropen.com\/articles\/10.1186\/s40537-021-00512-z"}},"subtitle":[],"short-title":[],"issued":{"date-parts":[[2021,9,24]]},"references-count":40,"journal-issue":{"issue":"1","published-print":{"date-parts":[[2021,12]]}},"alternative-id":["512"],"URL":"https:\/\/doi.org\/10.1186\/s40537-021-00512-z","relation":{},"ISSN":["2196-1115"],"issn-type":[{"value":"2196-1115","type":"electronic"}],"subject":[],"published":{"date-parts":[[2021,9,24]]},"assertion":[{"value":"13 May 2021","order":1,"name":"received","label":"Received","group":{"name":"ArticleHistory","label":"Article History"}},{"value":"28 August 2021","order":2,"name":"accepted","label":"Accepted","group":{"name":"ArticleHistory","label":"Article History"}},{"value":"24 September 2021","order":3,"name":"first_online","label":"First Online","group":{"name":"ArticleHistory","label":"Article History"}},{"order":1,"name":"Ethics","group":{"name":"EthicsHeading","label":"Declarations"}},{"value":"The author confirms the sole responsibility for this manuscript. The author read and approved the final manuscript","order":2,"name":"Ethics","group":{"name":"EthicsHeading","label":"Ethics approval and consent to participate"}},{"value":"The authors consent for publication.","order":3,"name":"Ethics","group":{"name":"EthicsHeading","label":"Consent for publication"}},{"value":"The authors declare that they have no competing interests.","order":4,"name":"Ethics","group":{"name":"EthicsHeading","label":"Competing interests"}}],"article-number":"126"}}