RF-MAF-AttnGRU:A Novel Hybrid Machine Learning Model for Stock Price Prediction and Algorithmic Trading

Choujun Zhan,Mingbo Zhao,Guanzhi Li,Du Yin,Fujian Wu,Tianyong Hao
DOI: https://doi.org/10.2139/ssrn.4383372
2023-01-01
Abstract:Accurate forecasting of financial market prices helps investors to make financial decisions and even the government to formulate appropriate macroeconomic policies in a country. In this work, we propose a hybrid model called RF-MAF-AttnGRU, combining random forest (RF), moving average filter (MAF), and gated recurrent units (GRUs) based on an attention mechanism. Firstly, input features such as historical data and technical indicators of the stock market are ranked in importance by RF. Secondly, a MAF based decomposition procedure is developed to decompose the filtered feature time series into the trend and residual series, which can avoid the data leakage problem. Then, the GRU based on the attention mechanism is used to model these two series for the price prediction task. Six stocks listed in China and the US were used to evaluate the performance of the proposed model. The prediction results of the RF-MAF-AttnGRU are compared with five classical prediction models and four state-of-art time series prediction models. The experimental results show that the proposed model yields the best results on all four evaluation metrics among all the algorithms. To further demonstrate the usefulness of the prediction model, we develop a corresponding trading strategy based on the price prediction results of the proposed model. Then, the trading strategy is compared with other trading strategies in terms of common return indicators. The annualized return of the trading strategy based on the proposed model is 23.08\%, which is much higher than the best-annualized return of the other trading strategies with only 9.37\%.
What problem does this paper attempt to address?