Next Article in Journal
An Evolutionary Game Theoretic Analysis of Cybersecurity Investment Strategies for Smart-Home Users against Cyberattacks
Previous Article in Journal
Mechanism of Time-Dependent Instability of Deep Soft-Rock Roadway and Crack-Filling Reinforcement Technology
 
 
Font Type:
Arial Georgia Verdana
Font Size:
Aa Aa Aa
Line Spacing:
Column Width:
Background:
Article

Forecasting Stock Market Indices Using the Recurrent Neural Network Based Hybrid Models: CNN-LSTM, GRU-CNN, and Ensemble Models

Department of Nano & Semiconductor Engineering, Tech University of Korea, Siheung-si 15073, Republic of Korea
*
Author to whom correspondence should be addressed.
Appl. Sci. 2023, 13(7), 4644; https://doi.org/10.3390/app13074644
Submission received: 19 December 2022 / Revised: 27 March 2023 / Accepted: 4 April 2023 / Published: 6 April 2023
(This article belongs to the Section Computing and Artificial Intelligence)

Abstract

:
Various deep learning techniques have recently been developed in many fields due to the rapid advancement of technology and computing power. These techniques have been widely applied in finance for stock market prediction, portfolio optimization, risk management, and trading strategies. Forecasting stock indices with noisy data is a complex and challenging task, but it plays an important role in the appropriate timing of buying or selling stocks, which is one of the most popular and valuable areas in finance. In this work, we propose novel hybrid models for forecasting the one-time-step and multi-time-step close prices of DAX, DOW, and S&P500 indices by utilizing recurrent neural network (RNN)–based models; convolutional neural network-long short-term memory (CNN-LSTM), gated recurrent unit (GRU)-CNN, and ensemble models. We propose the averaging of the high and low prices of stock market indices as a novel feature. The experimental results confirmed that our models outperformed the traditional machine-learning models in 48.1% and 40.7% of the cases in terms of the mean squared error (MSE) and mean absolute error (MAE), respectively, in the case of one-time-step forecasting and 81.5% of the cases in terms of the MSE and MAE in the case of multi-time-step forecasting.

1. Introduction

Forecasting stock market indices is one of the most critical yet challenging areas in finance, as a key task in investment management. The stock market indices are used to formulate and implement economic policy, and they are also used to inform decisions about the timing and size of various investments, such as stocks and real estate for investors.
In finance, stock market forecasting is one of the most challenging tasks due to the inherently volatile, noisy, dynamic, nonlinear, complex, non-parametric, non-stationary, and chaotic nature of stock markets, making any prediction model subject to large errors [1,2]. Additionally, price fluctuations are influenced not only by historical stock trading data, but also by nonlinear factors, such as political factors, investor behavior, and unexpected events [3,4,5,6].
To overcome these difficulties, numerous studies have been conducted over the past decades to predict various types of financial time-series data.
Linear models, such as the autoregressive and moving average (ARMA) and autoregressive integrated moving average (ARIMA) models have achieved high predictive accuracy in predicting stock market trends. However, traditional statistical models assume that financial time series are linear, which is not the case in real-world scenarios. Meanwhile, as many machine learning techniques capture nonlinear relationships from the data [7], they might be very useful for decision-making with respect to financial market investments [8].
A variety of deep learning models has been shown to significantly improve upon previous machine learning models in tasks, such as speech recognition, image captioning, question answering, natural language processing, autonomous self-driving cars, sports, arts, and regression tasks [9,10,11]. Deep-learning-based models have also been widely used in financial areas, such as forecasting stock price and index, portfolio optimization, risk management, financial information processing, and trade execution strategies.
In particular, RNNs, LSTMs, and GRUs have been designed to deal with time-series data and have been shown to perform better than traditional time-series models when a series of previous events is essential to predict future events. Thus, they have been actively applied to tasks, such as stock market index prediction and language translation [12,13].
RNNs have many advantages when processing short sequences. However, when the distance between the relevant information and the point using the information increases, the learning ability of the network is significantly reduced. The reason for this problem is that the back-propagation algorithm has difficulty in long-term dependency learning. In the process of updating the weights, the gradient disappears as values smaller than one are continuously multiplied, which is called the vanishing gradient problem. To solve the long-term dependency problem of RNNs, the LSTM and GRU models have been proposed, which represent the transformation algorithms of RNNs. In the LSTM model, a structure called the cell state is added to resolve long-term dependencies. Additionally, three additional input, forget, and output gates are added where the data are computed, which partially solves the problem of long-term dependencies by storing each state value in a memory space cell. The GRU is similar to LSTM; however, it has only update and reset gates and no output gate, thus being a simpler model with fewer parameters than LSTM. Recently, the LSTM model has shown great success in various domains, including speech recognition and machine translation, outperforming vanilla RNNs and conventional machine learning algorithms.
In this study, we propose hybrid models based on a variation of RNN models, such as LSTMs and GRUs, to improve stock market index prediction performance. The proposed models are divided into three types: a CNN-LSTM model that stacks a one-dimensional CNN and LSTM, a GRU-CNN model that stacks GRU and a one-dimensional CNN, and an ensemble model that takes the average value of each output result by placing RNN, LSTM, and GRU in parallel. The experiments were conducted on various daily stock market indices (i.e., Deutscher Aktienindex (DAX), Dow Jones Industrial Average (DOW), and Standard and Poor’s 500 (S&P500)) for the periods from 1 January 2017 through 31 December 2019 and from 1 January 2019 through 31 December 2021 for three years before and after the COVID-19 pandemic, respectively. Additionally, we considered a long period of time from 1 January 2000 through 31 December 2019 for the DOW and S&P500 and from 24 October 2014 through 31 December 2019 for DAX because the DAX data were only available from 24 October 2014 in the pandas D a t a R e a d e r module.
We considered the look-back periods of 5, 21, and 42 days and look-ahead periods of one day for one-time-step and five days for multi-time-step prediction. To verify the robustness of our results, we compared our models with conventional deep-learning models such as RNN, LSTM, GRU, and WaveNet.
The main contributions of this study include the following:
  • Novel RNN-based hybrid models are proposed to forecast one-time-step and multi-time-step closing prices of the DAX, DOW, and S&P500 indices by utilizing neural network structures: CNN-LSTM, GRU-CNN, and ensemble models.
  • The novel feature, which is the average of the high and low prices of stock market indices, is used as an input feature.
  • Comparisons between the proposed and traditional benchmark models with various look-back periods and features are presented.
  • The experimental results indicate that the proposed models outperform the benchmark models in 48.1% and 40.7% of the cases in terms of the mean squared error (MSE) and mean absolute error (MAE), respectively, in the case of one-time-step forecasting and 81.5% of the cases in terms of the MSE and MAE in the case of multi-time-step forecasting.
  • Further, compared with previous studies that involved using open, high, and low prices, and trading volume of stock market indices as features, in this study, we evaluate the performance of our models by adding a novel feature to reduce the influence of the highest and lowest prices. The results confirm that the newly proposed feature contributes to improving the performance of the models in forecasting stock market indices.
  • In particular, the ensemble model provides significant results for one-time-step forecasting.
The remainder of this paper is organized as follows. Section 2 presents an overview of deep learning models and reviews the relevant existing literature on stock market forecasting. Section 3 describes the proposed models designed using RNN-based hybrid architectures and provides the implementation details of the experiment, including the data and experimental setting. In Section 4, we present the experimental results, where we evaluate the proposed models on three stock market indices, compare them with benchmark models, and analyze the effect of the novel feature. Section 5 discusses the implications and advantages of the proposed models. Finally, Section 6 summarizes the conclusions of the study.

2. Background and Related Work

2.1. Deep-Learning Background

In this subsection, we review the artificial neural network (ANN), multilayer perceptron (MLP), CNN, RNN, LSTM, and GRU.

2.1.1. ANN

ANNs, also known as feedforward neural networks, are computing systems inspired by the biological human brain and consist of input, hidden, and output layers with connected neurons, wherein connections between neurons do not form a cycle. An ANN is capable of learning nonlinear functions and processing information in parallel [14]. Each neuron computes the weighted sum of all of its inputs, and a nonlinear activation function is applied to this sum to produce the output result of each neuron. The weights are adjusted to minimize a metric of the difference between the actual and predicted values of the data using the back-propagation algorithm [15].

2.1.2. MLP

The perceptron was proposed by [16] in 1943, representing an algorithm for the supervised learning of binary classifiers. As a linear classifier, a single-layer perceptron is the simplest feedforward neural network. Minsky and Papert [17] showed that a single-layer perceptron is incapable of learning the exclusive or (XOR) problem, whereas an MLP is capable of solving the XOR problem.
An MLP is a fully connected class of ANN. Attempts to solve linearly inseparable problems, such as the XOR problem, have led to different variations in the number of layers and neurons as well as nonlinear activation functions, such as a logistic sigmoid function or a hyperbolic tangent function [18].

2.1.3. CNN

The CNN was proposed to automatically learn spatial hierarchies of features in tasks, such as image recognition and speech recognition [19], by exploiting the spatial relationships among the pixels in an image. In [20], a CNN is composed of convolutional layers, pooling layers, and fully connected layers, and is trained with the adaptive moment estimation (Adam) optimizer on mini batches [21]. The convolutional layers extract the useful features, while the pooling layers reduce the dimensions of the feature maps. The rectified linear unit (ReLU) is applied as a nonlinear activation function [22], and a dropout layer is used as a regularization method in which the output of each hidden neuron is set to zero with a given probability [23].

2.1.4. RNN

The assumption of a traditional neural network is that all the inputs are independent of each other, which makes them ineffective when dealing with sequential data and varied sizes of inputs and outputs [24]. The RNN is an extension of the conventional feedforward neural network and is well suited to sequential data, such as time series, gene sequences, and weather data.
An RNN has memory loops and handles a variable length of input sequence by having a recurrent hidden state [25]. It is known to have a shortcoming of a significant decrease in learning ability as the gradient gradually decreases during back-propagation when the distance between the relevant information and the point is long, which is called the vanishing gradient problem [26]. Errors from later time steps are difficult to propagate back to previous time steps, which results in difficulty in training deep RNNs to preserve information over multiple time steps because the gradients tend to either vanish or explode as they cycle through feedback loops [27]. To address this problem, Hochreiter and Schmidhuber [26] proposed the LSTM, which is capable of solving the vanishing gradient problem using memory cells.

2.1.5. LSTM

The LSTM was proposed by [26] as a variant of the vanilla RNN to overcome the vanishing or exploding gradient problem by adding the cell state to the hidden state of an RNN. The LSTM is composed of a cell state and three gates: input, output, and forget gates. The following equations describe the LSTM architecture.
The forget gate f t determines which information is input to forget or keep from the previous cell state C t 1 and is computed as
f t = σ ( W f · [ h t 1 , x t ] + b f ) ,
where x t is the input vector at time t the function σ is a logistic sigmoid function.
The input gate i t determines which information is updated to the cell state C t and is computed by
i t = σ ( W i · [ h t 1 , x t ] + b i ) .
The candidate value C ˜ t that can be added to the state is created by a tanh activation function and is computed by
C ˜ t = tanh ( W C · [ h t 1 , x t ] + b C ) .
The cell state C t can store information over long periods of time by updating the internal state and is computed by
C t = f t C t 1 + i t C ˜ t ,
where the operator ⊙ represents the element-wise Hadamard product.
The output gate o t determines what information from the cell state to be used as an output by taking the logistic sigmoid activation function, and is computed by
o t = σ ( W o · [ h t 1 , x t ] + b o ) ,
and the output h t is computed as
h t = o t tanh ( C t ) ,
where W * and b * represent weight matrices and bias vectors, respectively.
Following [26], the gates decide which information to be forgotten or to be remembered; therefore, the LSTM is suitable for managing long-term dependencies and forecasting time series with different numbers of time steps. Further, it can generalize and handle noise, distributed representations, and continuous values well.

2.1.6. GRU

The GRU, proposed in [28], is a simpler variation of LSTM and has fewer parameters than LSTM. The LSTM has update, input, forget, and output gates and maintains the internal memory state, whereas the GRU has only update and reset gates. It combines the forget and input gates of LSTM into a single update gate and has fewer tensor operations, resulting in faster training than LSTM.
The GRU merges the cell and hidden states. It performs well in sequence learning tasks and overcomes the problems of vanishing or exploding gradients in vanilla RNNs when learning long-term dependencies [29]. It also tends to perform better than LSTM on fewer training data, whereas LSTM is more efficient in remembering longer sequences [30,31,32]. The following equations describe how memory cells at each hidden layer are updated at each time step [33]. The reset gate r t controls the influence of h t 1 and is computed as
r t = σ W r · [ h t 1 , x t ] ,
where x t and h t 1 are the input and the previous hidden state, respectively.
The update gate z t specifies whether to ignore the current information x t and is computed as
z t = σ W z · [ h t 1 , x t ] .
The computation of candidate activation h t is similar to that of the traditional recurrent unit, that is,
h t = z t h t 1 + ( 1 z t ) h ˜ t ,
where
h ˜ t = tanh W h · [ r t h t 1 , x t ] ,
W r , W z and W h are weight matrices which are learned.

2.2. Related Work

A stock market index is an important indicator of changes in the share prices of different companies, thus informing investment decisions. It is also more advantageous to invest in an index fund than to invest in individual stocks because it keeps costs low and removes the need to constantly manage reports from many companies. However, stock market index forecasting is extremely challenging because of the multiple factors affecting the stock market, such as politics, global economic conditions, unexpected events, and the financial performance of companies listed on the stock market.
Recently, deep-learning models have been extensively applied to numerous areas in finance, such as the forecasting future prices of stocks, prediction of stock price movements, portfolio management, risk assessment, and trading strategies [34,35,36,37,38,39]. Using deep learning-based models, such as CNNs, RNNs, LSTMs, and GRUs, studies have shown that such models outperform classical methods for time series forecasting tasks because of their ability to handle nonlinearity [19,25,26,33].
CNN models have been used in different time series forecasting applications. Chen et al. [40] and Sezer and Ozbayoglu [41] transformed time-series data into two-dimensional image data and used them as inputs for a CNN to classify the movement of the data. Meanwhile, Gross et al. [42] interpreted multivariate time series as space-time pictures.
RNN-based models have been used to predict time-series data. Fischer and Krauss [43] showed that LSTM outperformed memory-free classification methods, such as random forests, deep ANNs, and logistic regression classifiers, in prediction tasks. Dutta et al. [44] proposed the GRU model with recurrent dropout to predict the daily cryptocurrency prices.
Other deep learning models have been applied for time series forecasting. Heaton et al. [45] stacked autoencoders to predict and classify stock prices and their movements. Abrishami et al. [7] used a variational autoencoder to remove noise from the data and stacked LSTM to predict the close price of stocks. Wang et al. [2] used wavelet transform to forecast time-series data.
Moreover, various architectures combining deep learning-based models have been proposed in the literature. Ilyas et al. [46] combined technical and content features via learning time series and textual data, Livieris et al. [47] introduced the CNN-LSTM model to predict gold prices and movements, while Daradkeh [6] integrated a CNN and a bidirectional LSTM to predict stock trends. Zhang et al. [4] combined attention and LSTM models for financial time series prediction. Livieris and Pintelas [48] proposed ensemble learning strategies with advanced deep learning models for forecasting cryptocurrency prices and movements. Bao et al. [24] combined wavelet transforms, stacked autoencoders, and LSTM to forecast the closing stock prices for the next day by eliminating noise from the data and generating deep high-level features. Meanwhile, Zhang et al. [49] proposed a novel architecture of a generative adversarial network (GAN) with an MLP as the discriminator and an LSTM as the generator for forecasting the closing price of stocks.
Further, Leung et al. [50] proposed a two-timescale duplex neurodynamic approach for solving the portfolio optimization problem, and several studies have applied an LSTM to construct a portfolio [36,51,52,53,54,55].
This study proposes three models by combining CNN and RNN-based models for predicting the stock market index. Additionally, in contrast to existing studies, which employed open, high, and low prices, trading volume, and change in stock market indices, we introduce a novel input feature: the average of high and low prices. Furthermore, the three proposed models are evaluated on three daily stock market indices with two different optimizers and four different features. Finally, we compare the performance of the proposed models with conventional benchmark models with respect to forecasting the closing prices of the stock market indices.

3. Materials and Methods

3.1. Proposed Models

Following Livieris and Pintelas [48], by combining prediction models, a bias is added, which in turn reduces the variance, resulting in a better performance than that of single models. Therefore, we propose three RNN-based hybrid models that predict the stock market indices for one-time-step and multi-time-step at a time.

3.1.1. Proposed CNN-LSTM Model

CNNs can effectively learn the internal representations of time-series data [47]. The one-dimensional convolutional layer filters out the noise, extracts spatial features, and reduces the number of parameters. The causal convolution ensures that the output at time t derives only inputs from time t 1 . RNNs are considered the best sequential deep-learning models for forecasting time-series data. To this end, we combine a one-dimensional CNN and an LSTM in a new model: CNN-LSTM. The CNN-LSTM model consists of (1) a one-dimensional convolutional layer, (2) an LSTM layer, (3) a batch-normalization layer, (4) a dropout layer, and (5) a dense layer.
To determine the best-performing parameters, we examined different variants of the model: the number of hidden layers (1 and 2), the number of neurons (64 and 128), the batch size (32 and 64), and the dropout rate ( 0.2 and 0.5 ).
The best-performing CNN-LSTM model comprised a one-dimensional convolutional layer with 32 filters of size 3 with a stride of 1, causal padding, and the ReLU activation function; an LSTM layer with 128 units and tanh activation function; a batch-normalization layer; a dropout layer with a rate of 0.2 ; and a dense layer with a prediction window size of units and the ReLU activation function. Figure 1 illustrates the architecture of the proposed CNN-LSTM model, while Table 1 summarizes the configuration.

3.1.2. Proposed GRU-CNN Model

The GRU is simpler than LSTM, has the ability to train sequential patterns, and takes less time to train the model with improved network performance. To utilize both GRU and one-dimensional CNN, we propose a stacked architecture where a GRU and a one-dimensional CNN are combined, namely the GRU-CNN model. The parameters used for the GRU-CNN model were similar to those of the CNN-LSTM model, as described in Section 3.1.1. The difference between the CNN-LSTM and GRU-CNN models is in the order of stacking the RNN and CNN layers.
The GRU-CNN model consists of a GRU layer with 128 units and the tanh activation function; a one-dimensional convolutional layer with 32 filters of size 3 with a stride of 1, causal padding, and the ReLU activation function; a one-dimensional global max-pooling layer; a batch-normalization layer; a dense layer with 10 units and the ReLU activation function; a dropout layer with a rate of 0.2 ; and a dense layer with a prediction window size of units and the ReLU activation function. In the GRU-CNN model, the GRU layer returns a sequence, and the one-dimensional global max-pooling layer takes only important features and reduces the dimension of the feature map. The architecture of the proposed GRU-CNN model is illustrated in Figure 1, while the configuration is listed in Table 1.

3.1.3. Proposed Ensemble Model

While evaluating the performance of the benchmark models, various RNN models, such as RNN, LSTM, and GRU, exhibited high predictive performance on different types of datasets. There are three types of widely employed ensemble learning strategies: ensemble averaging, bagging, and stacking. Based on the results of the benchmarks, the CNN-LSTM, and the GRU-CNN as implemented above, we propose an average ensemble of three RNN-based models to achieve averaged high performance for various datasets. The proposed ensemble model can utilize the representations of the RNN, LSTM, and GRU models. The parameters used for the ensemble model were similar to those of the CNN-LSTM and GRU-CNN models, as described in Section 3.1.1.
The ensemble model consists of an RNN layer with 128 units and the tanh activation function; an LSTM layer with 128 units and the tanh activation function; a GRU layer with 128 units and the tanh activation function; followed by taking the average of all the hidden states from RNN, LSTM, and GRU; a dropout layer with a rate of 0.2 ; a dense layer with 32 units and the ReLU activation function; and a dense layer with a prediction window size of units and the ReLU activation function. Figure 1 illustrates the details of each layer of the proposed ensemble model, while Table 1 presents the configuration.

3.2. Implementation Details

In this subsection, we present an extensive empirical analysis of the proposed models on three datasets. First, we describe the datasets and the experimental setting used to demonstrate the validity of our financial time-series prediction models. Next, we evaluate the performance of our models on several datasets and compare them with those of conventional deep learning models.

3.2.1. Dataset

We evaluated the performance of the proposed models on daily stock market indices to verify the robustness of our models. We considered three stock market indices from major stock markets listed below.
(1)
DAX: Deutscher Aktienindex, which is a stock market index consisting of the 40 (expanded from 30 in 2021) major German blue-chip companies trading on the Frankfurt stock exchange.
(2)
DOW: Dow Jones Industrial Average, which is a stock market index of 30 prominent companies in the United States.
(3)
S&P500: Standard and Poor’s 500, which is a stock market index of 500 large companies in the United States.
The DOW is the most influential and widely used stock market index in the literature. We considered three types of periods for all three indices: the period from 1 January 2000 through 31 December 2019 for DOW and S&P500 and from 24 October 2014 through 31 December 2019 for DAX as long periods; from 1 January 2017 through 31 December 2019 and from 1 January 2019 through 31 December 2021 as short periods before and after the COVID-19 pandemic, respectively.
The historical prices of each stock market index were obtained using the FinanceDataReader open-source library available in the pandas D a t a R e a d e r module of the Python programming language [56]. The raw data included six features: open, high, low, and close prices, trading volume, and change. The incomplete data were removed.
Before feeding the raw data into our models, we pre-processed the data. We normalized the raw data using Scikit-learn’s M i n M a x S c a l e r tool, as follows:
x = x x m a x x m a x x m i n ,
where x is the input feature of the stock market index and x m a x and x m i n are the maximum and minimum values of each input feature, respectively. Granger [57] suggested holding approximately 20 % of the data for out-of-sample testing. Following this suggestion, the first 80 % of the data were used as the training set for in-sample training, while the remaining 20 % were used as the test set, to ensure that our models were evaluated on unseen out-of-sample data. The first 90 % of the training set was used to train the network and to iteratively adjust its parameters such that the loss function was minimized. The trained network predicted the remaining 10 % for validation, and the validation loss was computed after each epoch.

3.2.2. Generation of the Inputs and Outputs Using the Sliding Window Technique

This subsection describes the generation of the inputs and outputs. The daily open, high, and low prices, trading volume, and change were commonly used as input features in other studies. However, in the current study, we introduce a novel feature named medium, which is the average of high and low prices, to reduce the influence of the unusually extreme highest and lowest prices and to ensure generalizability.
For each stock market index, the partial features of daily open, high, low, and medium prices, trading volume, and change (OHLMVC) were used as the input to train the model, and the daily close prices were used as the output to predict one-time-step and multi-time-step ahead.
For the input and output generation, the normalized data were segmented using the sliding window technique, by which a fixed window size of time-series data was chosen as the input and a fixed number of the following observations was chosen as the output. This process was repeated for the entire dataset by sliding the window in intervals of one time step to obtain the next input and output. We trained the proposed models to look at m consecutive past data of features. The input at time t was denoted by
X t = x t O , x t H , x t L , x t M , x t V , x t C h R m × 6 ,
where for each k { O , H , L , M , V , C h } ,
x t k = x t m + 1 k , , x t 1 k , x t k T R m ,
x O , x H , x L , x M , x V , and x C h are the daily open, high, low, and medium prices, trading volume, and change from time t m + 1 to time t, respectively.
The input X t was fed sequentially into the proposed models to predict the following n daily close prices of stock market indices, with the output denoted by
y t + 1 C = y t + 1 , y t + 2 , . . . y t + n T R n .
The look-back periods of 5 , 21 , and 42 days were considered as one week, one month, and two months, respectively; while the look-ahead periods of one and five days were considered to predict the future one-time-step or multi-time-step ahead. Figure 2 illustrates the sliding window technique.

3.2.3. Software and Hardware

The proposed models were implemented, trained, and analyzed in Python 3.7 . 6 [58] with the Keras library 2.4 . 3 [59] as a high-level neural network API using TensorFlow 2.3 . 1 as back-end [60], relying on NumPy 1.19 . 2 [61], Pandas 0.25 . 3 [56], and Scikit-learn 1 . 0.2 [62]. The code used for producing the figures and analysis is available on GitHub at https://github.com/hyunsunsong/Project (accessed on 27 March 2023).
All experiments were performed using a workstation equipped with an Intel Xeon Silver 4208 CPU at 2.10 GHz x8, Nvidia GPU TITAN, and 12 GB RAM on each board.

3.2.4. Experimental Setting

The proposed models were trained with the Huber loss function, which combines the characteristics of MSE and MAE and is less susceptible to outliers in the data than the MSE loss function [63]. It behaves quadratically for small residuals and linearly for large residuals [64]. The parameters of the network were learned to minimize the average of the Huber loss function over the entire training dataset.
The network weights and biases were initialized with the Glorot–Xavier uniform method and zeros, respectively. Glorot and Bengio [65] proposed the Glorot–Xavier uniform method to adopt a properly scaled uniform distribution for initialization.
The successful applications of neural networks require regularization [66]. Introduced by [23], the dropout regularization technique randomly drops a fraction of the units with a specified probability, along with connections during training, while all units are presented during testing. We applied the dropout values of 0.2 and 0.5 to reduce overfitting and have observed that higher dropout value result in a decline in performance. Therefore, we settled on the relatively low dropout value of 0.2 as studied in [67].
The batch size and maximum number of epochs were set to 32 and 50, respectively, and an early stopping patience of 10 was applied [68]. That is, once the validation loss no longer decreased for the patience period, the training was stopped, and the weights of the model with the lowest validation loss were restored using ModelCheckpoint callback in the Keras library [59].
The optimization algorithms used for training were the Adam and root mean square propagation (RMSProp) [69], which are adaptive learning rate methods. The RMSProp is usually a viable choice for RNNs [59]. We compared the performance of the proposed models using two different optimizers.
We applied learning rates of 0.001 and 0.0005 and found that a learning rate of 0.0005 resulted in a better performance. Therefore, the learning rate was set to 0.0005 .
The ReLU activation function proposed in [22] was used for the dense layers, and the data shuffling technique was not used during training.

3.2.5. Predictive Performance Metrics

In this study, we adopted the MSE and MAE as evaluation metrics to compare the performance of the proposed models with that of conventional benchmark models for forecasting time-series data, which are calculated as follows:
MSE = T t = 1 T y t y t ^ 2 ,
MAE = T t = 1 T y t y t ^ ,
where T is the number of prediction time horizons; y t and y t ^ are the true and predicted values, respectively, during one-time-step prediction. During multi-time-step prediction, we only used the value of the last time step; thus, y t and y t ^ represent the true and predicted values of the last time step, respectively.

4. Experimental Results

In this section, we present the experimental results of the proposed models using historical time-series data for three stock market indices: DAX, DOW, and S&P500. We first describe the details of the benchmark models used for comparison. Second, we compare the results for the proposed models and conventional benchmarks with respect to one-time-step and multi-time-step predictions on three datasets over three different periods. Third, we present the results of the impact of different features and optimizers on the performance of the proposed models.

4.1. Benchmark Models

For benchmark comparison, we deploy several conventional deep learning models, such as RNN, LSTM, and GRU, to examine whether the proposed models outperform the benchmarks. In addition, we utilize WaveNet, which combines causal filters with dilated convolutions, so that the model learns long-range temporal dependencies in time-series data [70]. The benchmark models and corresponding architectures are listed below.
  • RNN: Two RNN layers with 128 units and a dense layer with a look-ahead period of units;
  • LSTM: An LSTM layer with 128 units and a dense layer with a look-ahead period of units;
  • GRU: A GRU layer with 128 units and a dense layer with a look-ahead period of units;
  • WaveNet: A simpler architecture of an audio generative model based on PixelCNN [71], as described in [70].
Table 2 lists the training setting for the benchmark models. All benchmark models were trained with 50 epochs, an early stopping patience of 10, a learning rate of 0.0005 , a batch size of 32, the MSE loss function, the Adam optimizer, and the ReLU activation function.

4.2. One-Time-Step Prediction Comparisons between Proposed and Benchmark Models

In this subsection, we provide the experimental results of the proposed models to predict the one-time-step ahead of the three stock market indices. We evaluated the performance of the proposed models with various look-back periods of 5 , 21 , and 42 days as one week, one month, and two months, respectively, for different periods. The proposed and benchmark models were implemented as described in previous sections. The Adam optimizer and OHLV features were used for all methods in Table 3.
Table 3 compares our models and the benchmark models for the different look-back periods for one-time-step prediction, where the best performance results are marked in bold for each stock market index, period, and metric.
According to the results in Table 3, increasing the look-back period slightly enhances the performance across all operating conditions by keeping all other hyperparameters constant. Moreover, a very long sequence length, such as the look-back period of 42, increases the performance. From 1 January 2000 through 31 December 2019, the proposed models improved the benchmarks in 77.8% and 77.8% of cases in terms of MSE and MAE, respectively. Additionally, our models outperformed the benchmarks in 66.7% and 77.8% of cases in terms of MSE and MAE, respectively, for the period from 1 January 2017 through 31 December 2019, before the COVID-19 pandemic, and in 100% of cases for the period from 1 January 2019 through 31 December 2021, after the COVID-19 pandemic, in terms of both MSE and MAE. Some results were the same for different benchmarks because the training algorithm might find the local optima. Further, an overall comparison between the ensemble model and other models in Table 3 indicates that the ensemble model significantly outperformed the other models.
We evaluated the performance of the proposed models with four different features (i.e., MV, MVC, OHLV, and OHLMVC) in addition to a novel feature, medium, defined as the average of high and low prices. In comparison, OHLVs have been commonly used as features in other studies.
In addition, we evaluated the performance of our models using two different optimizers, Adam and RMSProp, by keeping all other hyperparameters constant. The average MSE and MAE over the three periods for the impact of different features and optimizers of the proposed models are shown in Table 4 and Table 5, where the best performance results are marked in bold for each stock market index, a look-back period, and optimizer.
Regarding the one-time-step prediction, Table 4 shows that the CNN-LSTM, GRU-CNN, and ensemble models with the novel medium feature outperformed the other models in 83.3%, 33.3%, and 0% of cases with the DAX dataset; 83.3%, 100%, and 16.7% of cases with the DOW dataset; and 83.3%, 83.3%, and 33.3% of cases with the S&P500 dataset, respectively, in terms of the average MSE over the three periods.
Table 5 shows that the CNN-LSTM, GRU-CNN, and ensemble models incorporating the medium feature outperformed the other models in 83.3%, 33.3%, and 16.7% of cases with the DAX dataset; 83.3%, 100%, and 16.7% of cases with the DOW dataset; and 66.7%, 66.7%, and 33.3% of cases with the S&P500 dataset, respectively, in terms of the average MAE over the three periods.
An overall comparison between the models incorporating the medium feature and the models without the medium feature shows that adding the medium feature improves the performances of all models.
In addition, the proposed models were trained for 1500 epochs with the RMSProp optimizer and MV features to achieve higher performance than that of the model trained as described in Section 3.2.4. Figure 3, Figure 4 and Figure 5 compare the actual and predicted close prices of the DAX, DOW, and S&P500 indices, respectively, for the different look-back periods. In Figure 3, Figure 4 and Figure 5, the left, middle, and right plots correspond to the look-back periods of 5 , 21 , and 42 days, respectively. Further, the look-back period and stock market index evidently affect the model performance.
Moreover, the proposed models were trained for 1500 epochs with the Adam optimizer and a look-back period of 5 days. The comparisons of true and predicted close prices of the DAX, DOW, and S&P500 indices between different input features for one-time-step prediction are provided in Figure 6, Figure 7 and Figure 8, respectively.

4.3. Multi-Time-Step Prediction Comparisons between Proposed and Benchmark Models

In this subsection, we evaluated the performance of the proposed models with various look-back periods and provided the experimental results to predict multi-time-step ahead for the three stock market indices. The look-back periods of 5, 21, and 42 days and the look-ahead period of five days were adopted for each period. The proposed and benchmark models were implemented as described in previous sections. The Adam optimizer and OHLV features were used for all methods in Table 6.
Table 6 compares the proposed and benchmark models in terms of different look-back periods for five-time-step prediction, where the best performance results are marked in bold for each stock market index, period, and metric.
From the table, the proposed models outperformed the benchmarks in 66.7% and 66.7% of cases for the period from 1 January 2000 through 31 December 2019; in 22.2% and 11.1% of cases for the period from 1 January 2017 through 31 December 2019, before the COVID-19 pandemic; and in 55.6% and 55.6% of cases for the period from 1 January 2019 through 31 December 2021, after the COVID-19 pandemic in terms of MSE and MAE, respectively.
For long-term predictions, the MSE and MAE were not as good as for short-term predictions. Specifically, the results showed that the errors grew with the increase in prediction steps, highlighting that long-term predictions are more challenging than short-term ones. Nonetheless, the ensemble model still outperformed conventional benchmark models in long-term predictions.
We evaluated the performance of the proposed models with four different features and two different optimizers.
The average MSE and MAE for the use of different features and optimizers of the proposed models over the three periods are shown in Table 7 and Table 8, where the best performance results are marked in bold for each stock market index, a look-back period, and optimizer.
For multi-time-step prediction, in terms of the average MSE over the three periods, Table 7 confirms that the CNN-LSTM, GRU-CNN, and ensemble models with the introduced medium feature outperformed the other models in 66.7%, 83.3%, and 83.3% of cases with the DAX dataset; 66.7%, 66.7%, and 50% of cases with the DOW dataset; and 66.7%, 50%, and 83.3% of cases with the S&P500 dataset.
Further, for multi-time-step prediction, in terms of the average MAE over the three periods, Table 8 shows that the CNN-LSTM, GRU-CNN, and ensemble models with the novel medium feature outperformed the other models in 83.3%, 100%, and 83.3% of cases with the DAX dataset; 66.7%, 100%, and 66.7% of cases with the DOW dataset; and 66.7%, 50%, and 83.3% of cases with the S&P500 dataset.
In addition, the proposed models were trained for 1500 epochs with the Adam optimizer and OHLV features to achieve higher performance than that of the model as described in Section 3.2.4. Figure 9, Figure 10 and Figure 11 compare the actual and predicted close prices of the DAX, DOW, and S&P500 indices, respectively, with respect to the different look-back periods. In Figure 9, Figure 10 and Figure 11, the left, middle, and right plots correspond to the look-back periods of 5 , 21 , and 42 days, respectively. The look-back period and stock market index also evidently affect the model performance.
Moreover, the proposed models were trained for 1500 epochs with the Adam optimizer and a look-back period of 5 days. The comparisons of true and predicted close prices of the DAX, DOW, and S&P500 indices between different input features for five-time-step prediction are provided in Figure 12, Figure 13 and Figure 14, respectively.

5. Discussion

Various deep-learning techniques have been applied extensively in the field of finance for stock market prediction, portfolio optimization, risk management, and trading strategies. Although forecasting stock market indices with noisy data is a complex and challenging process, it significantly affects the appropriate timing of buying or selling investment assets for investors as they reduce the risk, which is one of the most valuable areas in finance.
Combining multiple deep-learning models results in a better performance [48]. We proposed to integrate RNNs, namely, CNN-LSTM, GRU-CNN, and ensemble models. The proposed models were evaluated to forecast the one-time-step and multi-time-step closing prices of stock market indices using various stock market indices, look-back periods, optimizers, features, and the learning rate.
The experimental results revealed that the proposed models that combine variants of RNNs outperformed the traditional machine learning models, such as RNN, LSTM, GRU, and WaveNet in most cases. In particular, the ensemble model produced significant results for one-time-step forecasting. Moreover, compared with the performance of previous studies that used open, high, and low prices and trading volume of stock market indices as features, that of our models improved by incorporating the proposed novel feature, which is the average of the high and low prices. Furthermore, our models with MV features provided favorable results in numerous cases. Notably, reducing the number of features could be interpreted as circumventing the overfitting.
The performance of the proposed and benchmark models with the Adam optimizer and OHLV features over three periods were evaluated to predict one-time-step and five-time-step using look-back periods of 5 , 21 , and 42 days as provided in Table 3 and Table 6, respectively. The comparisons of the average MSE and MAE over three periods for different look-back and look-ahead periods are provided in Figure 15 and Figure 16, respectively. An overall comparison between the ensemble model and other models in Figure 15 and Figure 16 indicates that the ensemble model significantly outperformed the other models.
In addition, the performance of the proposed and benchmark models over three periods were evaluated to compare the impact of four different input features (i.e., MV, MVC, OHLV, and OHLMVC) for one-time-step and five-time-step predictions with three look-back periods and two optimizers as described in Section 3.2. The comparisons of the average MSE and MAE of the proposed and benchmark models over all periods, optimizers, look-back, and look-ahead periods are provided in Figure 17 and Figure 18, respectively. The proposed models outperform the benchmark models and the performance of our models improves by incorporating the proposed medium feature.
During the course of this study, the Russia–Ukraine crisis escalated on 24 February 2022. Additional experiments were conducted to examine the impact of this crisis on each stock market index for the period from 1 January 2021 through 15 February 2023.
We evaluated the performance of the proposed and benchmark models to predict one-time-step and five-time-step ahead with various look-back periods of 5 , 21 , and 42 days as one week, one month, and two months, respectively. The architectures of the proposed and benchmark models have been described in Section 3.1 and Section 4.1, respectively.
The proposed and benchmark models were implemented with 50 epochs, an early stopping patience of 10, a batch size of 32, a learning rate of 0.0005 , the Adam optimizer, the ReLU activation function, and OHLV features. The network weights and biases were initialized with the Glorot-Xavier uniform method and zeros, respectively. The proposed and benchmark models were trained with the Huber loss function and MSE loss function, respectively.
Table 9 compares our models with the benchmark models for the different look-back periods for one-time-step and five-time-step predictions, where the best performance results are marked in bold for each stock market index, period, and metric. Table 9 indicates that the proposed models improved the benchmarks in several cases and that the ensemble model significantly outperformed the other models.
Further, compared with other forecasting methods in other fields, the proposed framework herein can be applied to forecasting time-series data, such as energy consumption, oil price, gas concentration, air quality, and river flow. Moreover, the performance of forecasting can be improved by combining different types of RNN-based models and constructing a portfolio using predicted stock market prices in future studies.

6. Conclusions

In this paper, we proposed three RNN-based hybrid models, namely CNN-LSTM, GRU-CNN, and ensemble models, to make one-time-step and multi-time-step predictions of the closing price of three stock market indices in different financial markets. We evaluated and compared the performance of the proposed models with conventional benchmarks (i.e., RNN, LSTM, GRU, and WaveNet) over three different periods: a long period of more than 15 years and two short periods of three years before and after the COVID-19 pandemic. The proposed models significantly outperformed the benchmark models by achieving high predictive performance for various sizes of look-back and look-ahead periods in terms of MSE and MAE. Moreover, we found that the proposed ensemble model was comparable to the GRU, which performed well among benchmarks and outperformed the benchmarks in many cases.
Additionally, we introduced a novel feature, medium, which is the average of high and low prices, and evaluated the performance of the proposed models with four different features and two different optimizers. The results indicated that incorporating the novel feature improved model performance. Overall, our experiments verified that the proposed models outperformed the benchmark models in many cases and that incorporating the medium feature improved their performance.

Author Contributions

Conceptualization, H.S. and H.C.; methodology, H.S. and H.C.; software, H.S. and H.C.; validation, H.S. and H.C.; formal analysis, H.S. and H.C.; writing—original draft preparation, H.S. and H.C.; writing—review and editing, H.S.; supervision, H.S.; project administration, H.S.; funding acquisition, H.S. All authors have read and agreed to the published version of the manuscript.

Funding

This work was supported by the Basic Science Research Program through the National Research Foundation of Korea (NRF) grant funded by the Ministry of Science and ICT (MSIT, Korea) (No. NRF-2020R1G1A1A01006808).

Institutional Review Board Statement

Not applicable.

Informed Consent Statement

Not applicable.

Data Availability Statement

Data used in this study was obtained using the FinanceDataReader open-source library.

Conflicts of Interest

The authors declare no conflict of interest.

Abbreviations

The following abbreviations are used in this manuscript:
AdamAdaptive Moment Estimation
ANNArtificial Neural Network
ARIMAAutoregressive Integrated Moving Average
ARMAAutoregressive and Moving Average
CNNConvolutional Neural Network
DAXDeutscher Aktienindex
DOWDow Jones Industrial Average
GANGenerative Adversarial Network
GRUGated Recurrent Unit
LSTMLong Short Term Memory
MAEMean Absolute Error
MLPMultilayer Perceptron
MSEMean Squared Error
ReLURectified Linear Unit
RMSPropRoot Mean Square Propagation
RNNRecurrent Neural Network
S&P500Standard and Poor’s 500

References

  1. Tan, T.; Quek, C.; Ng, G. Brain-inspired genetic complementary learning for stock market prediction. In Proceedings of the IEEE Congress on Evolutionary Computation, Edinburgh, UK, 2–5 September 2005; Volume 3, pp. 2653–2660. [Google Scholar] [CrossRef]
  2. Wang, J.Z.; Wang, J.J.; Zhang, Z.G.; Guo, S.P. Forecasting stock indices with back propagation neural network. Expert Syst. Appl. 2011, 38, 14346–14355. [Google Scholar] [CrossRef]
  3. Fama, E.F. The behavior of stock market prices. J. Bus. 1965, 38, 34–105. [Google Scholar] [CrossRef] [Green Version]
  4. Zhang, X.; Liang, X.; Zhiyuli, A.; Zhang, S.; Xu, R.; Wu, B. AT-LSTM: An Attention-based LSTM Model for Financial Time Series Prediction. IOP Conf. Ser. Mater. Sci. Eng. 2019, 569, 052037. [Google Scholar] [CrossRef]
  5. Shields, R.; Zein, S.A.E.; Brunet, N.V. An Analysis on the NASDAQ’s Potential for Sustainable Investment Practices during the Financial Shock from COVID-19. Sustainability 2021, 13, 3748. [Google Scholar] [CrossRef]
  6. Daradkeh, M.K. A Hybrid Data Analytics Framework with Sentiment Convergence and Multi-Feature Fusion for Stock Trend Prediction. Electronics 2022, 11, 250. [Google Scholar] [CrossRef]
  7. Abrishami, S.; Turek, M.; Choudhury, A.R.; Kumar, P. Enhancing Profit by Predicting Stock Prices using Deep Neural Networks. In Proceedings of the IEEE 31st International Conference on Tools with Artificial Intelligence (ICTAI), Portland, OR, USA, 4–6 November 2019; pp. 1551–1556. [Google Scholar]
  8. Aggarwal, S.; Aggarwal, S. Deep Investment in Financial Markets using Deep Learning Models. Int. J. Comput. Appl. 2017, 162, 40–43. [Google Scholar] [CrossRef]
  9. Graves, A.; Rahman Mohamed, A.; Hinton, G. Speech Recognition With Deep Recurrent Neural Networks. In Proceedings of the IEEE International Conference on Acoustics, Speech and Signal Processing, Vancouver, BC, Canada, 26–31 May 2013; pp. 6645–6649. [Google Scholar]
  10. Xu, K.; Ba, J.; Kiros, R.; Cho, K.; Courville, A.; Salakhudinov, R.; Zemel, R.; Bengio, Y. Show, Attend and Tell: Neural Image Caption Generation with Visual Attention. In Proceedings of the 32nd International Conference on Machine Learning, Lille, France, 7–9 July 2015; Volume 37, pp. 2048–2057. [Google Scholar]
  11. Zhu, Y.; Groth, O.; Bernstein, M.S.; Li, F. Visual7W: Grounded Question Answering in Images. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition (CVPR), Las Vegas, NV, USA, 26 June–1 July 2016; pp. 4995–5004. [Google Scholar]
  12. Ren, B. The use of machine translation algorithm based on residual and LSTM neural network in translation teaching. PLoS ONE 2020, 15, e0240663. [Google Scholar] [CrossRef]
  13. Bhandari, H.N.; Rimal, B.; Pokhrel, N.R.; Rimal, R.; Dahal, K.R.; Khatri, R.K. Predicting stock market index using LSTM. Mach. Learn. Appl. 2022, 9, 100320. [Google Scholar] [CrossRef]
  14. Walczak, S.; Cerpa, N. Artificial Neural Networks. In Encyclopedia of Physical Science and Technology, 3rd ed.; Academic Press: New York, NY, USA, 2003; pp. 631–645. [Google Scholar] [CrossRef]
  15. Rumelhart, D.E.; Hinton, G.E.; Williams, R.J. Learning representations by back-propagating errors. Nature 1986, 323, 533–536. [Google Scholar] [CrossRef]
  16. Mcculloch, W.; Pitts, W. A Logical Calculus of Ideas Immanent in Nervous Activity. Bull. Math. Biophys. 1943, 5, 115–133. [Google Scholar] [CrossRef]
  17. Minsky, M.; Papert, S. Perceptrons: An Introduction to Computational Geometry; MIT Press: Cambridge, MA, USA, 1969. [Google Scholar]
  18. Popescu, M.C.; Balas, V.E.; Perescu-Popescu, L.; Mastorakis, N. Multilayer Perceptron and Neural Networks. WSEAS Trans. Circuits Syst. 2009, 8, 579–588. [Google Scholar]
  19. Lecun, Y.; Bengio, Y. Convolutional Networks for Images, Speech, and Time-Series; MIT Press: Cambridge, MA, USA, 1997. [Google Scholar]
  20. Krizhevsky, A.; Sutskever, I.; Hinton, G.E. ImageNet Classification with Deep Convolutional Neural Networks. In Proceedings of the 25th International Conference on Neural Information Processing Systems, NIPS’12, Lake Tahoe, NV, USA, 3–6 December 2012; Curran Associates Inc.: Red Hook, NY, USA, 2012; Volume 1, pp. 1097–1105. [Google Scholar]
  21. Kingma, D.P.; Ba, J.L. Adam: A Method for Stochastic Optimization. In Proceedings of the 3rd International Conference for Learning Representations (ICLR), San Diego, CA, USA, 7–9 May 2015. [Google Scholar]
  22. Nair, V.; Hinton, G.E. Rectified Linear Units Improve Restricted Boltzmann Machines. In Proceedings of the 27th International Conference on Machine Learning (ICML), Haifa, Israel, 21–24 June 2010; pp. 807–814. [Google Scholar]
  23. 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–1958. [Google Scholar]
  24. Bao, W.; Yue, J.; Rao, Y. A deep learning framework for financial time series using stacked autoencoders and long-short term memory. PLoS ONE 2017, 12, e0180944. [Google Scholar] [CrossRef] [PubMed] [Green Version]
  25. Rumelhart, D.E.; McClelland, J.L. Learning Internal Representations by Error Propagation. In Parallel Distributed Processing: Explorations in the Microstructure of Cognition: Foundations; MIT Press: Cambridge, MA, USA, 1987; pp. 318–362. [Google Scholar]
  26. Hochreiter, S.; Schmidhuber, J. Long Short-Term Memory. Neural Comput. 1997, 9, 1735–1780. [Google Scholar] [CrossRef]
  27. Bengio, Y.; Simard, P.; Frasconi, P. Learning long-term dependencies with gradient descent is difficult. IEEE Trans. Neural Netw. 1994, 5, 157–166. [Google Scholar] [CrossRef]
  28. Cho, K.; van Merriënboer, B.; Bahdanau, D.; Bengio, Y. On the Properties of Neural Machine Translation: Encoder–Decoder Approaches. In Proceedings of the SSST-8, Eighth Workshop on Syntax, Semantics and Structure in Statistical Translation, Doha, Qatar, 25 October 2014; Association for Computational Linguistics: Cedarville, OH, USA, 2014; pp. 103–111. [Google Scholar]
  29. Shen, G.; Tan, Q.; Zhang, H.; Zeng, P.; Xu, J. Deep Learning with Gated Recurrent Unit Networks for Financial Sequence Predictions. Procedia Comput. Sci. 2018, 131, 895–903. [Google Scholar] [CrossRef]
  30. Chung, J.; Gulcehre, C.; Cho, K.; Bengio, Y. Empirical Evaluation of Gated Recurrent Neural Networks on Sequence Modeling. In Proceedings of the NIPS 2014 Workshop on Deep Learning, Montreal, QC, Canada, 13 December 2014. [Google Scholar]
  31. Kaiser, L.; Sutskever, I. Neural GPUs Learn Algorithms. In Proceedings of the 4th International Conference on Learning Representations, ICLR, San Juan, PR, USA, 2–4 May 2016. [Google Scholar]
  32. Yin, W.; Kann, K.; Yu, M.; Schütze, H. Comparative Study of CNN and RNN for Natural Language Processing. arXiv 2017, arXiv:1702.01923. [Google Scholar]
  33. Cho, K.; van Merriënboer, B.; Gulcehre, C.; Bahdanau, D.; Bougares, F.; Schwenk, H.; Bengio, Y. Learning Phrase Representations using RNN Encoder–Decoder for Statistical Machine Translation. In Proceedings of the 2014 Conference on Empirical Methods in Natural Language Processing (EMNLP), Doha, Qatar, 25–29 October 2014; Association for Computational Linguistics: Doha, Qatar, 2014; pp. 1724–1734. [Google Scholar]
  34. Nguyen, T.T.; Yoon, S. A Novel Approach to Short-Term Stock Price Movement Prediction using Transfer Learning. Appl. Sci. 2019, 9, 4745. [Google Scholar] [CrossRef] [Green Version]
  35. Kamal, I.M.; Bae, H.; Sunghyun, S.; Yun, H. DERN: Deep Ensemble Learning Model for Short- and Long-Term Prediction of Baltic Dry Index. Appl. Sci. 2020, 10, 1504. [Google Scholar] [CrossRef] [Green Version]
  36. Ta, V.D.; Liu, C.M.; Tadesse, D.A. Portfolio Optimization-Based Stock Prediction Using Long-Short Term Memory Network in Quantitative Trading. Appl. Sci. 2020, 10, 437. [Google Scholar] [CrossRef] [Green Version]
  37. Rouf, N.; Malik, M.B.; Arif, T.; Sharma, S.; Singh, S.; Aich, S.; Kim, H.C. Stock Market Prediction Using Machine Learning Techniques: A Decade Survey on Methodologies, Recent Developments, and Future Directions. Electronics 2021, 10, 2717. [Google Scholar] [CrossRef]
  38. Aldhyani, T.H.H.; Alzahrani, A. Framework for Predicting and Modeling Stock Market Prices Based on Deep Learning Algorithms. Electronics 2022, 11, 3149. [Google Scholar] [CrossRef]
  39. Lin, Y.L.; Lai, C.J.; Pai, P.F. Using Deep Learning Techniques in Forecasting Stock Markets by Hybrid Data with Multilingual Sentiment Analysis. Electronics 2022, 11, 3513. [Google Scholar] [CrossRef]
  40. Chen, J.F.; Chen, W.L.; Huang, C.P.; Huang, S.H.; Chen, A.P. Financial Time-Series Data Analysis Using Deep Convolutional Neural Networks. In Proceedings of the 7th International Conference on Cloud Computing and Big Data (CCBD), Macau, China, 16–18 November 2016; pp. 87–92. [Google Scholar] [CrossRef]
  41. Sezer, O.B.; Ozbayoglu, A.M. Algorithmic financial trading with deep convolutional neural networks: Time series to image conversion approach. Appl. Soft Comput. 2018, 70, 525–538. [Google Scholar] [CrossRef]
  42. Gross, W.; Lange, S.; Bödecker, J.; Blum, M. Predicting Time Series with Space-Time Convolutional and Recurrent Neural Networks. In Proceedings of the European Symposium on Artificial Neural Networks, Computational Intelligence and Machine Learning, Bruges, Belgium, 26–28 April 2017; pp. 26–28. [Google Scholar]
  43. Fischer, T.; Krauss, C. Deep learning with long short-term memory networks for financial market predictions. Eur. J. Oper. Res. 2018, 270, 654–669. [Google Scholar] [CrossRef] [Green Version]
  44. Dutta, A.; Kumar, S.; Basu, M. A Gated Recurrent Unit Approach to Bitcoin Price Prediction. J. Risk Financ. Manag. 2020, 13, 23. [Google Scholar] [CrossRef] [Green Version]
  45. Heaton, J.; Polson, N.; Witte, J. Deep Learning for Finance: Deep Portfolios. Appl. Stoch. Model. Bus. Ind. 2016, 33, 3–12. [Google Scholar] [CrossRef]
  46. Ilyas, Q.M.; Iqbal, K.; Ijaz, S.; Mehmood, A.; Bhatia, S. A Hybrid Model to Predict Stock Closing Price Using Novel Features and a Fully Modified Hodrick–Prescott Filter. Electronics 2022, 11, 3588. [Google Scholar] [CrossRef]
  47. Livieris, I.E.; Pintelas, E.; Pintelas, P. A CNN-LSTM model for gold price time-series forecasting. Neural Comput. Appl. 2019, 32, 17351–17360. [Google Scholar] [CrossRef]
  48. Livieris, I.E.; Pintelas, E.; Stavroyiannis, S.; Pintelas, P. Ensemble Deep Learning Models for Forecasting Cryptocurrency Time-Series. Algorithms 2020, 13, 121. [Google Scholar] [CrossRef]
  49. Zhang, K.; Zhong, G.; Dong, J.; Wang, S.; Wang, Y. Stock Market Prediction Based on Generative Adversarial Network. Procedia Comput. Sci. 2018, 147, 400–406. [Google Scholar] [CrossRef]
  50. Leung, M.F.; Wang, J.; Che, H. Cardinality-constrained portfolio selection via two-timescale duplex neurodynamic optimization. Neural Netw. 2022, 153, 399–410. [Google Scholar] [CrossRef] [PubMed]
  51. Troiano, L.; Villa, E.M.; Loia, V. Replicating a Trading Strategy by Means of LSTM for Financial Industry Applications. IEEE Trans. Ind. Inform. 2018, 14, 3226–3234. [Google Scholar] [CrossRef]
  52. Chalvatzis, C.; Hristu-Varsakelis, D. High-performance stock index trading: Making effective use of a deep LSTM neural network. arXiv 2019, arXiv:1902.03125. [Google Scholar]
  53. Park, S.; Song, H.; Lee, S. Linear programing models for portfolio optimization using a benchmark. Eur. J. Financ. 2019, 25, 435–457. [Google Scholar] [CrossRef]
  54. Lee, S.I.; Yoo, S.J. Threshold-based portfolio: The role of the threshold and its applications. J. Supercomput. 2020, 76, 8040–8057. [Google Scholar] [CrossRef] [Green Version]
  55. Sen, J.; Dutta, A.; Mehtab, S. Stock Portfolio Optimization Using a Deep Learning LSTM Model. In Proceedings of the IEEE Mysore Sub Section International Conference, Hassan, India, 24–25 October 2021; pp. 263–271. [Google Scholar]
  56. McKinney, W. Data Structures for Statistical Computing in Python. In Proceedings of the 9th Python in Science Conference, Austin, TX, USA, 28 June– 3 July 2010; pp. 56–61. [Google Scholar]
  57. Granger, C.W.J. Strategies for Modelling Nonlinear Time-Series Relationships. Econ. Rec. 1993, 69, 233–238. [Google Scholar] [CrossRef] [Green Version]
  58. Python Core Team. Python: A Dynamic, Open Source Programming Language. Python Software Foundation. 2019. Available online: https://www.python.org (accessed on 18 December 2022).
  59. Keras. 2015. Available online: https://keras.io (accessed on 18 December 2022).
  60. Abadi, M.; Agarwal, A.; Barham, P.; Brevdo, E.; Chen, Z.; Citro, C.; Corrado, G.S.; Davis, A.; Dean, J.; Devin, M.; et al. TensorFlow: Large-Scale Machine Learning on Heterogeneous Systems. arXiv 2015, arXiv:1603.04467. [Google Scholar]
  61. van der Walt, S.; Colbert, S.C.; Varoquaux, G. The NumPy Array: A Structure for Efficient Numerical Computation. Comput. Sci. Eng. 2011, 13, 22–30. [Google Scholar] [CrossRef] [Green Version]
  62. Pedregosa, F.; Varoquaux, G.; Gramfort, A.; Michel, V.; Thirion, B.; Grisel, O.; Blondel, M.; Prettenhofer, P.; Weiss, R.; Dubourg, V.; et al. Scikit-Learn: Machine Learning in Python. J. Mach. Learn. Res. 2011, 12, 2825–2830. [Google Scholar]
  63. Huber, P.J. Robust Estimation of a Location Parameter. Ann. Math. Stat. 1964, 35, 73–101. [Google Scholar] [CrossRef]
  64. Ku, J.; Mozifian, M.; Lee, J.; Harakeh, A.; Waslander, S.L. Joint 3D Proposal Generation and Object Detection from View Aggregation. In Proceedings of the 2018 IEEE/RSJ International Conference on Intelligent Robots and Systems (IROS), Madrid, Spain, 1–5 October 2018; pp. 1–8. [Google Scholar] [CrossRef] [Green Version]
  65. Glorot, X.; Bengio, Y. Understanding the difficulty of training deep feedforward neural networks. In Proceedings of the 13th International Conference on Artificial Intelligence and Statistics, Sardinia, Italy, 13–15 May 2010; Volume 9, pp. 249–256. [Google Scholar]
  66. Zaremba, W.; Sutskever, I.; Vinyals, O. Recurrent Neural Network Regularization. arXiv 2014, arXiv:1409.2329. [Google Scholar]
  67. Gal, Y.; Ghahramani, Z. A Theoretically Grounded Application of Dropout in Recurrent Neural Networks. In Advances in Neural Information Processing Systems; Lee, D., Sugiyama, M., Luxburg, U., Guyon, I., Garnett, R., Eds.; Curran Associates, Inc.: Red Hook, NY, USA, 2016; Volume 29. [Google Scholar]
  68. Yao, Y.; Rosasco, L.; Caponnetto, A. On Early Stopping in Gradient Descent Learning. Constr. Approx. 2007, 26, 289–315. [Google Scholar] [CrossRef]
  69. Tieleman, T.; Hinton, G. Lecture 6.5-rmsprop: Divide the gradient by a running average of its recent magnitude. COURSERA Neural Netw. Mach. Learn. 2012, 4, 26–31. [Google Scholar]
  70. van den Oord, A.; Dieleman, S.; Zen, H.; Simonyan, K.; Vinyals, O.; Graves, A.; Kalchbrenner, N.; Senior, A.W.; Kavukcuoglu, K. WaveNet: A Generative Model for Raw Audio. In Proceedings of the 9th ISCA Speech Synthesis Workshop, Sunnyvale, CA, USA, 13–15 September 2016; p. 125. [Google Scholar]
  71. van den Oord, A.; Kalchbrenner, N.; Espeholt, L.; Koray, K.; Vinyals, O.; Graves, A. Conditional Image Generation with PixelCNN Decoders. In Advances in Neural Information Processing Systems; Curran Associates, Inc.: Red Hook, NY, USA, 2016; Volume 29. [Google Scholar]
Figure 1. (a) Architecture of the CNN-LSTM model. (b) Architecture of the GRU-CNN model. (c) Architecture of the ensemble model.
Figure 1. (a) Architecture of the CNN-LSTM model. (b) Architecture of the GRU-CNN model. (c) Architecture of the ensemble model.
Applsci 13 04644 g001
Figure 2. Sliding window technique.
Figure 2. Sliding window technique.
Applsci 13 04644 g002
Figure 3. Comparison of true and predicted close prices of the DAX index between different look-back periods for one-time-step prediction over the period from 24 October 2014 through 31 December 2019.
Figure 3. Comparison of true and predicted close prices of the DAX index between different look-back periods for one-time-step prediction over the period from 24 October 2014 through 31 December 2019.
Applsci 13 04644 g003
Figure 4. Comparison of true and predicted close prices of the DOW index between different look-back periods for one-time-step prediction over the period from 1 January 2000 through 31 December 2019.
Figure 4. Comparison of true and predicted close prices of the DOW index between different look-back periods for one-time-step prediction over the period from 1 January 2000 through 31 December 2019.
Applsci 13 04644 g004
Figure 5. Comparison of true and predicted close prices of the S&P500 index between different look-back periods for one-time-step prediction over the period from 1 January 2000 through 31 December 2019.
Figure 5. Comparison of true and predicted close prices of the S&P500 index between different look-back periods for one-time-step prediction over the period from 1 January 2000 through 31 December 2019.
Applsci 13 04644 g005
Figure 6. Comparison of true and predicted close prices of the DAX index between different input features for one-time-step prediction over the period from 24 October 2014 through 31 December 2019.
Figure 6. Comparison of true and predicted close prices of the DAX index between different input features for one-time-step prediction over the period from 24 October 2014 through 31 December 2019.
Applsci 13 04644 g006
Figure 7. Comparison of true and predicted close prices of the DOW index between different input features for one-time-step prediction over the period from 1 January 2000 through 31 December 2019.
Figure 7. Comparison of true and predicted close prices of the DOW index between different input features for one-time-step prediction over the period from 1 January 2000 through 31 December 2019.
Applsci 13 04644 g007
Figure 8. Comparison of true and predicted close prices of the S&P500 index between different input features for one-time-step prediction over the period from 1 January 2000 through 31 December 2019.
Figure 8. Comparison of true and predicted close prices of the S&P500 index between different input features for one-time-step prediction over the period from 1 January 2000 through 31 December 2019.
Applsci 13 04644 g008
Figure 9. Comparison of true and predicted close prices of the DAX index between different look-back periods for five-time-step prediction over the period from 24 October 2014 through 31 December 2019.
Figure 9. Comparison of true and predicted close prices of the DAX index between different look-back periods for five-time-step prediction over the period from 24 October 2014 through 31 December 2019.
Applsci 13 04644 g009
Figure 10. Comparison of true and predicted close prices of the DOW index between different look-back periods for five-time-step prediction over the period from 1 January 2000 through 31 December 2019.
Figure 10. Comparison of true and predicted close prices of the DOW index between different look-back periods for five-time-step prediction over the period from 1 January 2000 through 31 December 2019.
Applsci 13 04644 g010
Figure 11. Comparison of true and predicted close prices of the S&P500 index between different look-back periods for five-time-step prediction over the period from 1 January 2000 through 31 December 2019.
Figure 11. Comparison of true and predicted close prices of the S&P500 index between different look-back periods for five-time-step prediction over the period from 1 January 2000 through 31 December 2019.
Applsci 13 04644 g011
Figure 12. Comparison of true and predicted close prices of the DAX index between different input features for five-time-step prediction over the period from 24 October 2014 through 31 December 2019.
Figure 12. Comparison of true and predicted close prices of the DAX index between different input features for five-time-step prediction over the period from 24 October 2014 through 31 December 2019.
Applsci 13 04644 g012
Figure 13. Comparison of true and predicted close prices of the DOW index between different input features for five-time-step prediction over the period from 1 January 2000 through 31 December 2019.
Figure 13. Comparison of true and predicted close prices of the DOW index between different input features for five-time-step prediction over the period from 1 January 2000 through 31 December 2019.
Applsci 13 04644 g013
Figure 14. Comparison of true and predicted close prices of the S&P500 index between different input features for five-time-step prediction over the period from 1 January 2000 through 31 December 2019.
Figure 14. Comparison of true and predicted close prices of the S&P500 index between different input features for five-time-step prediction over the period from 1 January 2000 through 31 December 2019.
Applsci 13 04644 g014
Figure 15. Comparison of the average MSE over three periods for different look-back and look-ahead periods using RNN, LSTM, GRU, WaveNet, CNN-LSTM, GRU-CNN, and ensemble with OHLV features.
Figure 15. Comparison of the average MSE over three periods for different look-back and look-ahead periods using RNN, LSTM, GRU, WaveNet, CNN-LSTM, GRU-CNN, and ensemble with OHLV features.
Applsci 13 04644 g015
Figure 16. Comparison of the average MAE over three periods for different look-back and look-ahead periods using RNN, LSTM, GRU, WaveNet, CNN-LSTM, GRU-CNN, and ensemble with OHLV features.
Figure 16. Comparison of the average MAE over three periods for different look-back and look-ahead periods using RNN, LSTM, GRU, WaveNet, CNN-LSTM, GRU-CNN, and ensemble with OHLV features.
Applsci 13 04644 g016
Figure 17. Comparison of the average MSE of all models using MV, MVC, OHLV, and OHLMVC.
Figure 17. Comparison of the average MSE of all models using MV, MVC, OHLV, and OHLMVC.
Applsci 13 04644 g017
Figure 18. Comparison of the average MAE of all models using MV, MVC, OHLV, and OHLMVC.
Figure 18. Comparison of the average MAE of all models using MV, MVC, OHLV, and OHLMVC.
Applsci 13 04644 g018
Table 1. Model configuration of the proposed models.
Table 1. Model configuration of the proposed models.
ModelDescription
CNN-LSTMOne-dimensional convolutional layer with 32 filters of size 3 with a stride of 1
LSTM layer with 128 units and tanh activation function
Batch-normalization layer
Dropout layer with a rate of 0.2
Dense layer with a prediction window size of units
GRU-CNNGRU layer with 128 units and the tanh activation
One-dimensional convolutional layer with 32 filters of size 3 with a stride of 1
One-dimensional global max-pooling layer
Batch-normalization layer
Dense layer with 10 units and the ReLU activation
Dropout layer with a rate of 0.2
Dense layer with a prediction window size of units
EnsembleRNN layer with 128 units and the tanh activation function
LSTM layer with 128 units and the tanh activation function
GRU layer with 128 units and the tanh activation function
Average of all the hidden states from RNN, LSTM, and GRU
Dropout layer with a rate of 0.2
Dense layer with 32 units and the ReLU activation function
Dense layer with a prediction window size of units
Table 2. Hyperparameter setting for the benchmark models.
Table 2. Hyperparameter setting for the benchmark models.
HyperparameterValue
Number of epochs50
Early stopping patience10
Learning rate0.0005
Batch size32
Loss function MSE
Optimizer Adam
Activation function ReLU
Table 3. Comparison of one-time-step prediction between proposed and benchmark models.
Table 3. Comparison of one-time-step prediction between proposed and benchmark models.
Look-Back
Period
MetricModel2000–2019 1 2017–2019 2019–2021
DAX DOW S&P500 DAX DOW S&P500 DAX DOW S&P500
5 daysMSERNN0.15050.57390.5618 0.11460.69420.6174 0.76260.85760.7843
LSTM0.15050.57390.5618 0.11460.69420.6174 0.76260.85760.7843
GRU0.15050.57390.0004 0.00120.69420.6174 0.76260.85760.0049
WaveNet0.40400.09400.0886 0.49290.04110.0672 0.01770.00750.0189
CNN-LSTM0.00790.00040.0040 0.05390.01540.1333 0.08680.00450.0032
GRU-CNN0.00110.01320.0042 0.00140.00690.0135 0.01110.01030.7843
Ensemble0.00170.00750.0059 0.00120.00230.0011 0.00090.00290.0003
MAERNN0.37560.74100.7376 0.32070.82820.7779 0.87170.92530.8834
LSTM0.37560.74100.7376 0.32070.82820.7779 0.87170.92530.8834
GRU0.37560.74100.0185 0.02730.82820.7779 0.87170.92530.0674
WaveNet0.62840.26450.2680 0.69420.18410.2384 0.12240.07810.1235
CNN-LSTM0.08270.01620.0600 0.21200.11880.3520 0.29090.06500.0544
GRU-CNN0.02550.10310.0593 0.02790.07790.1113 0.10220.09910.8834
Ensemble0.03360.07400.0651 0.02620.04180.0279 0.02440.04680.0143
21 daysMSERNN0.15090.50580.5341 0.09820.65520.6482 0.72520.81190.8070
LSTM0.16580.57340.5602 0.10660.74200.6781 0.75550.88550.8273
GRU0.16580.57340.0002 0.00080.74200.6781 0.75550.88550.8273
WaveNet0.38770.09030.0856 0.49310.03710.0605 0.01960.00650.0154
CNN-LSTM0.00780.01590.0033 0.06320.01480.1074 0.15070.19500.2035
GRU-CNN0.00140.03560.0149 0.10660.01700.0193 0.00900.00330.0018
Ensemble0.00080.00070.0014 0.00090.00230.0011 0.00080.00110.0004
MAERNN0.37690.69340.7188 0.29270.80250.7941 0.84970.89870.8959
LSTM0.39650.74180.7375 0.30740.85590.8145 0.86800.94010.9074
GRU0.39650.74180.0136 0.02220.85590.8145 0.86800.94010.9074
WaveNet0.61660.25960.2639 0.69360.17360.2251 0.13200.07220.1120
CNN-LSTM0.07420.11780.0473 0.22960.11770.3223 0.38650.43980.4479
GRU-CNN0.02900.17410.1135 0.30740.12240.1317 0.08880.05420.0384
Ensemble0.02110.02200.0312 0.02400.04260.0280 0.02010.02810.0160
42 daysMSERNN0.16190.48850.4736 0.11470.59210.5475 0.58880.75510.6797
LSTM0.16830.59040.5766 0.12280.73070.6683 0.73520.88060.8292
GRU0.16830.59040.0013 0.00090.73070.6683 0.73520.88060.8292
WaveNet0.37320.08560.0816 0.50110.03780.0595 0.02110.00580.0125
CNN-LSTM0.00250.03420.0210 0.04960.07830.0392 0.08330.07590.0004
GRU-CNN0.00350.04590.0220 0.00750.01280.0128 0.00190.07120.0270
Ensemble0.00070.00120.0007 0.00150.00130.0039 0.00090.00040.0007
MAERNN0.39400.68290.6795 0.31610.76020.7295 0.76440.86660.8227
LSTM0.40130.75360.7486 0.32820.84920.8087 0.85610.97370.9091
GRU0.40130.75360.0343 0.02390.84920.8087 0.85610.93770.9091
WaveNet0.60530.25320.2583 0.69780.17230.2192 0.13720.06700.1001
CNN-LSTM0.04530.18440.1428 0.18830.27810.1910 0.28550.27380.0152
GRU-CNN0.04590.20040.1399 0.07250.10210.1074 0.03840.26520.1611
Ensemble0.02040.03080.0224 0.02890.03130.0548 0.02300.01670.0217
1 The period from 24 October 2014 through 31 December 2019 for the DAX.
Table 4. Comparison of different optimizers and features in terms of average MSE over the three periods for one-time-step prediction.
Table 4. Comparison of different optimizers and features in terms of average MSE over the three periods for one-time-step prediction.
Look-Back
Period
OptimizerFeatureCNN-LSTM GRU-CNN Ensemble
DAX DOW S&P500 DAX DOW S&P500 DAX DOW S&P500
5 daysAdamMV0.04060.02280.0154 0.00250.00700.2717 0.00140.00390.0026
MVC0.05340.03660.0097 0.00260.00540.0053 0.00140.00390.0026
OHLV0.04950.00680.0468 0.00450.01010.2674 0.00130.00420.0025
OHLMVC0.04960.00250.0030 0.00700.00960.2668 0.00130.00420.0025
RMSPropMV0.02310.02390.0189 0.00230.00880.0063 0.00130.00310.0014
MVC0.09720.07960.0270 0.00350.01970.0171 0.00130.00310.0014
OHLV0.01750.01330.0206 0.00190.01440.2223 0.00130.00310.0014
OHLMVC0.03300.01520.0396 0.00430.25130.0107 0.00130.00310.0014
21 daysAdamMV0.01740.04540.0217 0.00700.01330.0180 0.00100.00290.0011
MVC0.10420.04890.1143 0.00300.01410.0115 0.00210.00400.0080
OHLV0.07390.07520.1047 0.03900.01860.0120 0.00080.00130.0010
OHLMVC0.04060.02280.0154 0.00540.02530.0138 0.00210.00400.0080
RMSPropMV0.02950.17210.2440 0.01630.01830.0242 0.00100.00420.0060
MVC0.03180.06080.1752 0.03950.03060.0178 0.00170.01850.0038
OHLV0.04770.12990.3043 0.01570.02290.0137 0.00080.00140.0015
OHLMVC0.04060.02280.0154 0.02840.02440.0253 0.00210.00400.0080
42 daysAdamMV0.04430.07900.0105 0.01630.01690.2459 0.00140.00280.0022
MVC0.05660.05850.0426 0.02270.02710.2339 0.00100.24550.0129
OHLV0.04510.06280.0202 0.00430.04330.0206 0.00100.00100.0018
OHLMVC0.04880.14130.0102 0.00880.01260.0124 0.00190.00260.0012
RMSPropMV0.13390.07920.1816 0.00840.05030.0223 0.00170.00360.0035
MVC0.06590.29080.1823 0.01910.06090.3112 0.00120.00570.0049
OHLV0.37950.31730.0588 0.00790.03940.0341 0.00080.00210.2784
OHLMVC0.04960.06070.6410 0.01000.02560.0229 0.00100.00210.0017
Table 5. Comparison of different optimizers and features in terms of average MAE over the three periods for one-time-step prediction.
Table 5. Comparison of different optimizers and features in terms of average MAE over the three periods for one-time-step prediction.
Look-Back
Period
OptimizerFeatureCNN-LSTM GRU-CNN Ensemble
DAX DOW S&P500 DAX DOW S&P500 DAX DOW S&P500
5 daysAdamMV0.16350.12850.1161 0.04050.07780.3662 0.02930.04600.0391
MVC0.20470.14330.0810 0.04130.06400.0584 0.02590.05780.0423
OHLV0.19520.06670.1554 0.05190.09340.3513 0.02800.05420.0358
OHLMVC0.18060.04210.0466 0.06390.08600.3503 0.02270.03730.2706
RMSPropMV0.13440.13910.1186 0.03750.07650.0690 0.02880.04260.0311
MVC0.23700.21250.1433 0.04720.09720.1134 0.02950.05560.0582
OHLV0.10570.08130.0999 0.03530.09260.3573 0.02300.03280.0279
OHLMVC0.14380.10120.1770 0.05780.35810.0872 0.02840.06660.0545
21 daysAdamMV0.08100.20760.1332 0.06790.10480.1066 0.02480.04390.0268
MVC0.24290.18040.2890 0.04550.11160.0979 0.03400.04960.0603
OHLV0.23010.22510.2725 0.14170.11690.0945 0.02170.03090.0251
OHLMVC0.16350.12850.1161 0.06160.15190.1057 0.03400.04960.0603
RMSPropMV0.14540.37600.3348 0.10170.11770.1387 0.02360.05260.0645
MVC0.13760.20060.3381 0.14320.14850.1213 0.03420.09400.0542
OHLV0.17830.31550.4366 0.09020.13530.0930 0.02160.02910.0328
OHLMVC0.16350.12850.1161 0.11490.14750.1484 0.03400.04960.0603
42 daysAdamMV0.16640.25700.0850 0.10850.11890.3836 0.02840.04210.0334
MVC0.20520.18080.1750 0.12270.14990.3378 0.02450.31100.0719
OHLV0.17300.24540.1164 0.05230.18920.1361 0.02410.02630.0330
OHLMVC0.19700.34010.0741 0.08160.10130.1014 0.03360.04090.0275
RMSPropMV0.31730.23900.2914 0.07530.21140.1191 0.03300.05100.0512
MVC0.22350.51770.4117 0.11080.22550.4436 0.02590.06070.0615
OHLV0.48220.52510.2263 0.06920.18690.1710 0.02110.03710.3333
OHLMVC0.19230.22530.5319 0.08060.14660.3771 0.02330.03750.0340
Table 6. Comparison of five-time-step prediction between proposed and benchmark models.
Table 6. Comparison of five-time-step prediction between proposed and benchmark models.
Look-Back
Period
MetricModel2000–2019 1 2017–2019 2019–2021
DAX DOW S&P500 DAX DOW S&P500 DAX DOW S&P500
5 daysMSERNN0.05610.30500.2887 0.04210.38560.3378 0.41360.49750.4463
LSTM0.11530.43770.4247 0.09010.53880.4804 0.56860.65580.5995
GRU0.00340.00120.0023 0.00450.00310.0031 0.00110.00300.0015
WaveNet0.03830.31060.2995 0.02180.38570.3240 0.46040.52150.4606
CNN-LSTM0.00700.05290.0865 0.03610.00700.0699 0.07370.11860.1112
GRU-CNN0.00230.01530.0049 0.00420.02990.0359 0.01530.01470.0261
Ensemble0.00410.00370.0037 0.00360.00700.0053 0.00130.00210.0009
MAERNN0.22280.53250.5223 0.18540.61410.5702 0.64070.70330.6650
LSTM0.32850.64690.6411 0.28370.72940.6856 0.75270.80900.7723
GRU0.04590.02850.0407 0.05610.03880.0479 0.03480.03090.0224
WaveNet0.17320.53550.5319 0.12510.61550.5606 0.67660.72120.6762
CNN-LSTM0.06950.21550.2896 0.15820.06870.2522 0.26850.34230.3303
GRU-CNN0.03740.11410.0631 0.05260.16490.1791 0.11950.11730.1585
Ensemble0.05240.05220.0498 0.04600.07430.0645 0.02890.03940.0230
21 daysMSERNN0.16920.57650.5631 0.10830.69570.6176 0.75040.86490.7967
LSTM0.11270.39210.3816 0.07340.47690.4226 0.51050.59590.5468
GRU0.00230.00220.0015 0.00260.00360.0042 0.00160.00340.0141
WaveNet0.04090.31480.3031 0.02270.39700.3374 0.44820.53050.4756
CNN-LSTM0.01990.17720.0423 0.04320.04440.0973 0.04720.11400.0839
GRU-CNN0.00300.02780.0087 0.00920.01730.0217 0.00290.00710.0361
Ensemble0.00220.00170.0019 0.00480.00500.0094 0.00150.00120.0009
MAERNN0.40090.74400.7396 0.30950.82970.7794 0.86500.92930.8911
LSTM0.32630.61290.6083 0.25300.68630.6437 0.71320.77130.7380
GRU0.03640.04030.0330 0.04380.05200.0540 0.03500.05100.1154
WaveNet0.18320.54050.5361 0.12640.62470.5727 0.66790.72750.6877
CNN-LSTM0.13180.40340.1973 0.17940.20170.3030 0.21480.33630.2865
GRU-CNN0.04290.14710.0832 0.08420.12130.1379 0.04760.07870.1876
Ensemble0.03630.03480.0364 0.05450.06140.0834 0.03090.02880.0252
42 daysMSERNN0.15620.59300.5795 0.10450.74320.6845 0.73600.88480.8377
LSTM0.11440.40160.3910 0.08490.50900.4690 0.49940.60700.5733
GRU0.00300.00380.0024 0.00400.00230.0046 0.00130.00110.0017
WaveNet0.04450.32030.3080 0.02420.39830.3445 0.44130.53740.4911
CNN-LSTM0.00790.03880.0654 0.02940.02960.0064 0.07090.20070.0598
GRU-CNN0.00470.03050.0060 0.00990.03180.0274 0.03570.08600.0462
Ensemble0.00230.00210.0011 0.00370.02690.0164 0.00220.00120.0011
MAERNN0.38230.75520.7505 0.29350.85600.8179 0.85670.93990.9137
LSTM0.33010.62090.6160 0.27170.70750.6758 0.70550.77830.7556
GRU0.04320.05510.0435 0.03930.06090.0674 0.02640.02620.0338
WaveNe0.19480.54690.5416 0.12740.62470.5773 0.66250.73220.6991
CNN-LSTM0.07190.18610.2465 0.12680.16060.0684 0.26310.44610.2399
GRU-CNN0.05690.15940.0666 0.09010.16090.1542 0.18410.29130.2123
Ensemble0.03780.03900.0276 0.04680.14950.1132 0.03370.02890.0262
1 The period from 24 October 2014 through 31 December 2019 for the DAX.
Table 7. Comparison of different optimizers and features in terms of average MSE over the three periods for five-time-step prediction.
Table 7. Comparison of different optimizers and features in terms of average MSE over the three periods for five-time-step prediction.
Look-Back
Period
OptimizerFeatureCNN-LSTM GRU-CNN Ensemble
DAX DOW S&P500 DAX DOW S&P500 DAX DOW S&P500
5 daysAdamMV0.02930.05730.0636 0.00850.00990.0160 0.05320.23970.0048
MVC0.01490.05310.1266 0.00380.02290.0128 0.00280.00840.0120
OHLV0.03890.05950.0892 0.00730.02000.0223 0.00300.00430.0033
OHLMVC0.05230.09450.0803 0.00580.02270.0155 0.00240.00510.0029
RMSPropMV0.02550.08480.0340 0.00360.01460.0263 0.00330.00740.0052
MVC0.01840.03330.0926 0.00340.01860.0269 0.00310.01410.0065
OHLV0.01310.03720.0507 0.00380.00220.0201 0.00330.00370.0068
OHLMVC0.01670.07200.0803 0.00310.02530.0322 0.00270.00440.0050
21 daysAdamMV0.04430.05410.1509 0.03950.02730.0106 0.00300.00520.1904
MVC0.17740.17680.2014 0.00660.01070.0217 0.00360.00770.0040
OHLV0.03680.11190.0745 0.00500.01740.0222 0.00280.00260.0041
OHLMVC0.09900.19570.1828 0.00440.01820.0105 0.00270.00260.0025
RMSPropMV0.20700.10480.0475 0.02430.02050.0517 0.00260.01020.0059
MVC0.08110.06690.0804 0.01250.01540.0519 0.00420.01540.0124
OHLV0.12230.03160.1723 0.01470.01520.0543 0.00440.23540.0062
OHLMVC0.06400.13760.1346 0.02640.01890.0496 0.03760.00350.0089
42 daysAdamMV0.03270.20190.1374 0.05320.04770.0562 0.00310.00650.0046
MVC0.06400.09280.0850 0.01150.04430.0320 0.00620.25010.0075
OHLV0.03600.08970.0439 0.01680.04940.0265 0.00270.01010.0062
OHLMVC0.07560.17980.1960 0.00790.03550.0455 0.00280.00450.0093
RMSPropMV0.05060.22160.1771 0.01110.04860.0392 0.00360.01560.0093
MVC0.10860.40980.1259 0.00840.04180.0648 0.00330.30160.0125
OHLV0.12410.32470.1819 0.00520.04710.0301 0.24760.00650.0042
OHLMVC0.09040.15090.0706 0.00550.04530.0621 0.00300.00430.0086
Table 8. Comparison of different optimizers and features in terms of average MAE over the three periods for five-time-step prediction.
Table 8. Comparison of different optimizers and features in terms of average MAE over the three periods for five-time-step prediction.
Look-Back
Period
OptimizerFeatureCNN-LSTM GRU-CNN Ensemble
DAX DOW S&P500 DAX DOW S&P500 DAX DOW S&P500
5 daysAdamMV0.13490.18940.2386 0.07860.09200.1012 0.15610.32170.0551
MVC0.09630.22390.3409 0.05280.14210.1017 0.04090.07810.0832
OHLV0.16540.20880.2907 0.06980.13210.1336 0.04240.05530.0457
OHLMVC0.19630.27750.2648 0.06310.14140.1085 0.03760.05720.0427
RMSPropMV0.12770.24660.1705 0.04760.10980.1520 0.04480.06980.0569
MVC0.10080.16160.2727 0.04720.12080.1544 0.04290.10270.0606
OHLV0.08680.17470.1881 0.05250.13970.1304 0.04470.04930.0620
OHLMVC0.11140.23080.2130 0.04340.14520.1567 0.04000.05310.0560
21 daysAdamMV0.16970.19280.3751 0.08280.15550.0897 0.04140.06030.2791
MVC0.26730.40120.4062 0.06990.09290.1394 0.04570.07700.0484
OHLV0.17530.31380.2623 0.05820.11570.1363 0.04060.04170.0483
OHLMVC0.26920.42710.4016 0.05460.12490.0928 0.03960.04120.0350
RMSPropMV0.33890.26370.1844 0.12180.13330.1993 0.04240.08590.0633
MVC0.25070.23860.2320 0.09800.09820.2102 0.05350.10730.0969
OHLV0.28500.16120.3277 0.09900.10960.2077 0.05470.31920.0671
OHLMVC0.18780.30170.3532 0.12930.12420.2014 0.12800.04760.0810
42 daysAdamMV0.14710.43680.3548 0.18590.20230.1943 0.04150.06480.0476
MVC0.18840.27310.2670 0.09210.18850.1613 0.06160.31780.0592
OHLV0.15390.26430.1849 0.11040.20390.1443 0.03940.07250.0557
OHLMVC0.25550.33320.3816 0.07850.17070.1935 0.04060.05430.0753
RMSPropMV0.20480.43030.3616 0.09040.20190.1691 0.04730.10370.0786
MVC0.26020.53220.2999 0.07440.18890.2186 0.04450.37110.0873
OHLV0.29040.56060.3259 0.06280.20440.1510 0.31720.06830.0493
OHLMVC0.23100.31810.2358 0.06220.19730.2204 0.04170.05310.0657
Table 9. Comparison of one-time-step and five-time-step predictions between proposed and benchmark models for the period from 1 January 2021 through 15 February 2023.
Table 9. Comparison of one-time-step and five-time-step predictions between proposed and benchmark models for the period from 1 January 2021 through 15 February 2023.
Look-Back
Period
MetricModelOne-Time-Step Prediction Five-Time-Step Prediction
DAX DOW S&P500 DAX DOW S&P500
5 daysMSERNN0.17380.30590.1043 0.02500.02190.1122
LSTM0.17350.30600.1043 0.00580.00760.0064
GRU0.17350.30600.1043 0.00810.01870.0058
WaveNet0.48700.31200.5712 0.04770.12300.0177
CNN-LSTM0.14350.05600.0988 0.08310.04470.0912
GRU-CNN0.03700.30600.0053 0.01010.01660.0090
Ensemble0.00170.00510.0027 0.01260.01220.0057
MAERNN0.37380.51630.2934 0.14680.12660.3053
LSTM0.37260.51650.2934 0.05930.06400.0585
GRU0.37270.51640.2934 0.08020.12510.0629
WaveNet0.67410.51850.7456 0.19250.31770.1110
CNN-LSTM0.34400.15870.2864 0.23450.15510.2666
GRU-CNN0.17330.51650.0557 0.09010.11390.0739
Ensemble0.03450.06280.0420 0.10250.09680.0605
21 daysMSERNN0.17870.33150.0995 0.19170.34850.1081
LSTM0.17850.33150.0995 0.01330.00700.0060
GRU0.17850.33150.0995 0.01260.01550.0056
WaveNet0.41260.22320.5259 0.05260.14460.0177
CNN-LSTM0.08050.02250.0680 0.03990.01270.0595
GRU-CNN0.01590.03070.0058 0.02450.01270.0079
Ensemble0.00180.01280.0026 0.01150.01240.0059
MAERNN0.39470.55880.2950 0.41510.58070.3127
LSTM0.39400.55880.2950 0.10190.06450.0625
GRU0.39400.55870.2950 0.10320.11210.0634
WaveNet0.62440.45010.7168 0.20150.36050.1094
CNN-LSTM0.24900.10760.2367 0.14600.08080.2231
GRU-CNN0.11330.16260.0634 0.14290.09940.0678
Ensemble0.03580.10270.0402 0.09660.09800.0650
42 daysMSERNN0.24340.40110.1446 0.04810.00710.1150
LSTM0.24340.40110.1446 0.00710.00400.0066
GRU0.24340.40110.1446 0.00790.01220.0044
WaveNet0.31060.15050.4595 0.06850.17460.0215
CNN-LSTM0.04350.00270.0433 0.01150.00330.0597
GRU-CNN0.04250.40110.0092 0.03510.02610.0075
Ensemble0.00280.00570.0024 0.00920.00790.0083
MAERNN0.48570.63140.3694 0.20090.06930.3288
LSTM0.48570.63140.3694 0.06680.05170.0643
GRU0.48570.63140.3694 0.07680.09850.0548
WaveNet0.55110.38430.6730 0.24880.41430.1246
CNN-LSTM0.19610.04560.1878 0.08470.04720.2295
GRU-CNN0.20300.63140.0878 0.18050.13580.0711
Ensemble0.04760.06930.0414 0.08460.07710.0778
Disclaimer/Publisher’s Note: The statements, opinions and data contained in all publications are solely those of the individual author(s) and contributor(s) and not of MDPI and/or the editor(s). MDPI and/or the editor(s) disclaim responsibility for any injury to people or property resulting from any ideas, methods, instructions or products referred to in the content.

Share and Cite

MDPI and ACS Style

Song, H.; Choi, H. Forecasting Stock Market Indices Using the Recurrent Neural Network Based Hybrid Models: CNN-LSTM, GRU-CNN, and Ensemble Models. Appl. Sci. 2023, 13, 4644. https://doi.org/10.3390/app13074644

AMA Style

Song H, Choi H. Forecasting Stock Market Indices Using the Recurrent Neural Network Based Hybrid Models: CNN-LSTM, GRU-CNN, and Ensemble Models. Applied Sciences. 2023; 13(7):4644. https://doi.org/10.3390/app13074644

Chicago/Turabian Style

Song, Hyunsun, and Hyunjun Choi. 2023. "Forecasting Stock Market Indices Using the Recurrent Neural Network Based Hybrid Models: CNN-LSTM, GRU-CNN, and Ensemble Models" Applied Sciences 13, no. 7: 4644. https://doi.org/10.3390/app13074644

Note that from the first issue of 2016, this journal uses article numbers instead of page numbers. See further details here.

Article Metrics

Back to TopTop