Abstract

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 > 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.

Highlights

  • The semi-strong form of market efficiency hypothesis [1] which states that security prices react very quickly to publicly available new information is commonly accepted in the financial field

  • We propose a new trading strategy tailored to the Moroccan market comprising two parts: the first part for forecasting and the second is dedicated to decision rules for buying and selling stocks

  • The rest of this article is structured as follows: In the related work section, we go through a non-exhaustive list of previous work using Long Short Term Memory (LSTM) and Gated Recurrent Unit (GRU) in several areas, and we focus on articles using both architectures for stock price forecasting

Read more

Summary

Introduction

The semi-strong form of market efficiency hypothesis [1] which states that security prices react very quickly to publicly available new information is commonly accepted in the financial field. Accurate forecasts provide valuable information to investors and allow them to adjust their position (buy, hold or sell) according to the price trend, it allows building a winning trading strategy. This will explain the large number of works published in this field in recent years. We propose a new trading strategy tailored to the Moroccan market comprising two parts: the first part for forecasting and the second is dedicated to decision rules for buying and selling stocks. The proposed strategy address this problem and guarantees a high return even in a crisis period (impact of COVID 19 on the Moroccan stock market). This paper ends with a conclusion and future work

Results
Discussion
Conclusion
Full Text
Published version (Free)

Talk to us

Join us for a 30 min session where you can share your feedback and ask us any queries you have

Schedule a call