Abstract
Stock price returns forecasting is challenging task for day traders to yield more returns. In the past, most of the literature was focused on machine learning algorithm to predict the stock returns. In this work, the recurrent neural network (RNN) with long short term memory (LSTM) is studied to forecast future stock returns. It has the ability to keep the memory of historical stock returns in order to forecast future stock return output. RNN with LSTM is used to store recent stock information than old related stock information. We have considered a recurrent dropout in RNN layers to avoid overfitting in the model. To accomplish the task we have calculated stock return based on stock closing prices. These stock returns are given as input to the recurrent neural network. The objective function of the prediction model is to minimize the error in the model. To conduct the experiment, data is collected from the National Stock Exchange, India (NSE). The proposed RNN with LSTM model outperforms compared to an feed forward artificial neural network.
Access provided by Autonomous University of Puebla. Download conference paper PDF
Similar content being viewed by others
Keywords
1 Introduction
Stock market predictions is a difficult task for stock fund managers and financial analysts due to unstable stock data which is noisy and nonlinear. The variation in policies such as economic, macroeconomic data, political uncertainty, and government policy are affected in the direction of the stock market. This impact may be reflected in stock prices and the market may be volatile. For a day trader to gain more profits, it is significant to know how to identify the quality of stocks for intraday trading. Most of the traders are not able to gain profits because they fail to select appropriate stocks to trade during the day. Hence there is a need for the short-term daily trading framework is to predict stock price. This will help investors and traders to gain the profit from the day trade. In this paper, we have proposed the recurrent neural network (RNN) with long short term memory (LSTM) to forecast future stock returns.
The related works are described in Table 1. Extensive literature suggested that most of the stock returns work is based on artificial neural network, fuzzy, simulation-based and genetic algorithm. In this paper, the recurrent neural network with LSTM is studied to forecast future stock returns. It has the ability to keep the memory of historical stock returns in order to forecast future stock return output.
2 Related Work
Existing trading rules were not gainful for future periods when the market condition changes dynamically. Chourmouziadis and Chatzoglou [2] proposed short-term technical trading strategy by considering the daily price of the stock using fuzzy systems.
An automatic way of buying and selling financial securities without the help of portfolio managers has been discussed. The combination of technical trading indicators like moving average, alpha, beta and volatility of the stock over a period of time has been proposed [1]. Nakano et al. [7] proposed a method in which non-linear financial time-series data are considered and machine learning techniques were used for predicting stock prices. Mousavi et al. [6] proposed generalized Exponential Moving Average technical indicator model to predict the stock prices. The future performance of stock indices has been studied using fuzzy time series modeling [11]. Return and risk are important objectives for managing a portfolio. Macedo et al. [5] proposed a model to enhance technical trading rule indicator based on Moving average convergence/divergence, Relative Strength Index, Bollinger Bands and Contrarian Bollinger Bands. Artificial Neural Network(ANN) has been widely used in predicting stock for financial markets. Zhang and Wu [16] proposed back propagation ANN to predict stock prices and indices.
Technical indicators like moving average, moving average convergence and divergence, relative strength index and commodity channel index have been used to predict the stock price [14]. Performing feature extraction could help to reduce the redundant features, which can reduce the measurements, storage requirements and the running time of classifiers. It also avoids the curse of dimensionality and improves prediction performance as well as facilitate data visualization and understanding [13]. Ticknor [12] proposed artificial neural network approach to improve the prediction performance. Preis et al. [9] hypothesized that investors may use a Google hits ratio of pages are used to take the decision to predict stock price. Macroeconomic factors are believed to influence stock market movements. Machine learning methods, which are data-driven and assumption-free have become more popular in stock market prediction [15].
3 Data Specification
In this paper, stock data are collected from http://www.nseindia.com. The data contain information about stock such as stock day open price, day low price, day high price and day close price. We have considered CIPLA stock, ITC stock, TCS stock, ONGC stock and Nifty index for the experiment. The dataset range is obtained from the year 2009 to 2018.
4 Proposed Work
The proposed workflow of stock return forecasting is described in Fig. 1. The stock data are collected from Indian stock exchange, i.e., national stock exchange (NSE). The stock returns are calculated based on stock closing prices. Let \(C^s\)= \(C^s_t\) be defined as the closing price of stock s at time t and simple returns of stock over n period are given in Eq. 1. We standardize the stock returns by subtracting the mean and dividing them by the standard deviation. These stock returns are given as input to the recurrent neural network.
RNN with LSTM. The proposed model that takes stock return as input data from the recent past and predicts the stock returns for the next 24 h in the future. Existing literature suggested that RNN is not able to hold long-term dependencies in stock returns [4, 8]. Therefore LSTM has been proposing to capture long-term dependencies in stock returns. The LSTM organized as a cell, each cell has an internal state variable that passes information from one cell to another cell. A sigmoid layer of forget gate takes the previous output at \(t-1\) and the present input at time t and performed concatenation operation. The output of this layer lies between 0 and 1 and it is shown in Fig. 2. If \(ft=0\) then the internal state variable is completely forgotten, and \(ft=1\) it will be passed through one cell to another.
The forget gate and input gate are given Eqs. 2, 3, 4, 5, 6 and 7.
5 Experimental Results and Discussion
NSE datasets consist of 2400 rows, we have split 70% data for training and 30% for validation. The RNN model built in three layers, and we have considered the rectifier unit as the activation function. The experiment is carried out in R Studio platform. Decreasing in training rate and increasing validation rate suggests that the model is overfitting and it is described in Fig. 3. Therefore, we have added dropout function to RNN layers that avoid the overfitting problem and it is described in Fig. 4.
MAE and RMSE is used to evaluate the performance of the prediction model and it is described in Eqs. 8, 9. The proposed model outperforms compared to with feed forward artificial neural network(ANN) and it is shown in Table 2.
6 Conclusion
Stock price movements forecasting is challenging task for day traders to yield more returns. Recurrent neural network with LSTM is a state-of-the-art method for sequence learning. They are less commonly applied to stock return predictions. The first the recurrent neural network with LSTM is studied to forecast the future stock returns. Second, considered a recurrent dropout in RNN layers to avoid overfitting in the model. The future work can be time series forecasting of stock prices by combining technical and fundamental analysis of stocks.
References
Berutich, J.M., López, F., Luna, F., Quintana, D.: Robust technical trading strategies using GP for algorithmic portfolio selection. Expert Syst. Appl. 46, 307–315 (2016)
Chourmouziadis, K., Chatzoglou, P.D.: An intelligent short term stock trading fuzzy system for assisting investors in portfolio management. Expert Syst. Appl. 43, 298–311 (2016)
Enke, D., Mehdiyev, N.: Stock market prediction using a combination of stepwise regression analysis, differential evolution-based fuzzy clustering, and a fuzzy inference neural network. Intell. Autom. Soft Comput. 19(4), 636–648 (2013)
Graves, A.: Generating sequences with recurrent neural networks. arxiv preprint arxiv: 1308.0850 (2013)
Macedo, L.L., Godinho, P., Alves, M.J.: Mean-semivariance portfolio optimization with multiobjective evolutionary algorithms and technical analysis rules. Expert Syst. Appl. 79, 33–43 (2017)
Mousavi, S., Esfahanipour, A., Zarandi, M.H.F.: A novel approach to dynamic portfolio trading system using multitree genetic programming. Knowl.-Based Syst. 66, 68–81 (2014)
Nakano, M., Takahashi, A., Takahashi, S.: Generalized exponential moving average (EMA) model with particle filtering and anomaly detection. Expert Syst. Appl. 73, 187–200 (2017)
Olah, C.: Understanding LSTM networks (2015)
Preis, T., Moat, H.S., Stanley, H.E.: Quantifying trading behavior in financial markets using google trends. Sci. Rep. 3, 01684 (2013)
Qiu, M., Song, Y., Akagi, F.: Application of artificial neural network for the prediction of stock market returns: the case of the Japanese stock market. Chaos, Solitons Fractals 85, 1–7 (2016)
Rubio, A., Bermúdez, J.D., Vercher, E.: Improving stock index forecasts by using a new weighted fuzzy-trend time series method. Expert Syst. Appl. 76, 12–20 (2017)
Ticknor, J.L.: A bayesian regularized artificial neural network for stock market forecasting. Expert Syst. Appl. 40(14), 5501–5506 (2013)
Tsai, C.-F., Hsiao, Y.-C.: Combining multiple feature selection methods for stock prediction: union, intersection, and multi-intersection approaches. Decis. Support Syst. 50(1), 258–269 (2010)
Tsai, C.-F., Lin, Y.-C., Yen, D.C., Chen, Y.-M.: Predicting stock returns by classifier ensembles. Appl. Soft Comput. 11(2), 2452–2459 (2011)
Vaisla, K.S., Bhatt, A.K.: An analysis of the performance of artificial neural network technique for stock market forecasting. Int. J. Comput. Sci. Eng. 2(6), 2104–2109 (2010)
Zhang, Y., Lenan, W.: Stock market prediction of s&p 500 via combination of improved bco approach and bp neural network. Expert Syst. Appl. 36(5), 8849–8854 (2009)
Zhong, X., Enke, D.: Forecasting daily stock market return using dimensionality reduction. Expert Syst. Appl. 67, 126–139 (2017)
Acknowledgment
This work is supported by the Visvesvaraya Ph.D Scheme for Electronics and IT the departments of MeitY, Government of India. The Task carried out at the Department of IT, NITK Surathkal, Mangalore, India.
Author information
Authors and Affiliations
Corresponding author
Editor information
Editors and Affiliations
Rights and permissions
Copyright information
© 2019 Springer Nature Switzerland AG
About this paper
Cite this paper
Naik, N., Mohan, B.R. (2019). Study of Stock Return Predictions Using Recurrent Neural Networks with LSTM. In: Macintyre, J., Iliadis, L., Maglogiannis, I., Jayne, C. (eds) Engineering Applications of Neural Networks. EANN 2019. Communications in Computer and Information Science, vol 1000. Springer, Cham. https://doi.org/10.1007/978-3-030-20257-6_39
Download citation
DOI: https://doi.org/10.1007/978-3-030-20257-6_39
Published:
Publisher Name: Springer, Cham
Print ISBN: 978-3-030-20256-9
Online ISBN: 978-3-030-20257-6
eBook Packages: Computer ScienceComputer Science (R0)