Frontiers
A new LSTM based reversal point prediction method using upward/downward reversal point feature sets

https://doi.org/10.1016/j.chaos.2019.109559Get rights and content

Highlights

  • A new method for predicting the reversal point of stock trends is proposed.

  • Feature sets are constructed by combining of new defined candlestick indicators and technical indicators.

  • Upward/downward reversal point predictors are respectively designed to increase the predictive power.

  • LSTM network is used to construct the reversal point prediction model.

Abstract

A novel Long-Short Term Memory (LSTM)-based prediction model of stock price reversal point was proposed by using upward/downward reversal point feature sets. (1) Based on the combinations of candlestick indicators and technical indicators, 27 sets of feature candidates were constructed, and then the feature sets suitable to each stock in terms of URP/DRP prediction were respectively extracted. (2) LSTM-based URP/DRP predictors were constructed, the results of which are combined to improve the prediction accuracy. Using this model, reversal point prediction has been conducted for 10 Chinese stocks and 10 American stocks. In results, the mean prediction accuracy (F1) was 68.6% and 55.2% for the Chinese and the American stock markets, respectively. Results show that the average prediction accuracy has been evaluated to be higher for Chinese market by 13.4% compared to American one. Comparing with Support Vector Machine (SVM), Multilayer Perceptron (MLP) and Convolutional Neural Networks (CNN) model, F1 of proposed model has been increased by 5.9%, 11.7% and 5.3%, respectively.

Introduction

Financial market is considered as a complex system with nonlinear characteristics affected by many interrelated economic, political and psychological factors. Therefore, in such a financial market, an accurate prediction of stock fluctuation is very important as well as regarded as a difficult problem [1]. According to the efficient market hypothesis, as all the available information are reflected in the stock prices, it is impossible to predict the stock prices using historical information [2,3]. Many studies provide evidence agreeing to this hypothesis [4], [5], [6], [7], while some studies have been conducted showing that the efficient market hypothesis is not established. Lo et al. [8] proposed a systematic method to recognize technical patterns such as head-and-shoulders using nonparametric kernel regression, showing that some technical patterns can provide incremental information for American stock markets. Brock [9] analyzed the data of American stock prices for historical 90 years, and found that the investment returns are higher when investors use technical analysis compared to using a buy-and-hold strategy.

As providing a lot of evidence does not conform to the efficient market hypothesis, researches on stock price prediction based on statistical analysis or machine learning have actively being conducted. Most typical research methods contain time series based prediction and text mining based prediction. Text mining based prediction method extracts features, such as sentiment, from news data, and predicts the stock price using these features [10], [11], [12]. Time series based prediction method predicts stock price by constructing a prediction model by using stock time series data, while it contains statistical model based method and artificial intelligence based method. Statistical model based method predicts stock price by applying time series model, such as ARIMA (Autoregressive Integrated Moving Average) [13,14], to historical stock price data, while artificial intelligence based method predicts stock price by applying Support Vector Machine (SVM) [15], [16], [17], Artificial Neural Network (ANN) [18], [19], [20], etc.

Recently, deep learning technology has been attracted great interest in the artificial intelligence research area. Being a species of multilayer ANN based machine learning, deep learning can solve a series of problems in traditional ANN, and can improve the performance of the algorithm. For these advantages, it has shown better performance in most artificial intelligence, including speech recognition, computer vision, etc., and has been widely applied in stock price prediction.

Li et al. [21] compared six prediction models, i.e., SVM, Naive Bayes, Decision Tree, Multilayer Perceptron (MLP), Recurrent Neural Networks (RNN), and Long-Short Term Memory (LSTM) in the prediction of next day stock trend. Results showed that the performance of deep learning models MLP, RNN, LSTM is better than other models with respect to accuracy. For the prediction of future stock price fluctuation, Tsantekidis et al [22] proposed CNN model and conducted a comparison with SVM and MLP model. In result, CNN model has been evaluated to have the best performance. [23,24] proposed deep learning models for stock price prediction, including MLP, RNN, LSTM and CNN, and compared their performance with ARIMA model. In this experiment, all the deep learning models outperformed ARIMA. Especially, CNN has been observed to have better performance than others. Maknickiene et al. [25] used the LSTM networks to predict the exchange rate and forex trading and thus improved the prediction accuracy compared to feedforward neural networks. Chen et al. [26] have used the LSTM model to estimate the rate of return of the Chinese stock market and have verified that the LSTM model performs better than the random prediction method. To evaluate the performance of LSTM in financial time series prediction, Fischer et al. [27] compared it with deep networks, random forests and logistic regression. For the prediction of stock price volatility, Kim et al. [28] proposed a new hybrid model that combined the LSTM model with various generalized autoregressive conditional heteroscedasticity (GARCH)-type models. For the prediction of next day stock price, Pang et al. [29] proposed LSTM model with an embedded layer (ELSTM) and LSTM model with an automatic encoder (AELSTM). Embedded layer and automatic encoder have been used to reduce the dimension of data, and ELSTM model has been observed to be more stable. Bao et al. [30] have obtained higher prediction accuracy of stock price by combining wavelet transforms (WT), stacked autoencoders (SAEs) and LSTM, where WT has been used to eliminate noise, while SAEs has been used to generate deep high-level features. Recently, many research works tried to use cloud computing to solve the constraints of the desktop in the analysis of stock market and prediction of stock price [31,32].

Although there have been conducted a lot of studies on stock market as mentioned above, their mainstream is the prediction of future stock price. However, the prediction of the ever-changing stock price is very difficult to be accurately conducted and therefore has no so much contribution to the decision-making of investors. Moreover, investors actually pay more attention to the reversal point (RP) of stock price change trend instead of the ever-changing stock price itself. In other words, when the change of stock price is suddenly stopped or reversed after sustaining a constant rising or falling trend for a certain period, whether it is a temporary fluctuation of stock price or a reverse of its trend has a crucial impact on the decision-making of investors. Therefore, the main objective of this study is to propose a novel prediction model of trend reversal point, actually contributable to the decision-making of investors.

Recently, many technical analysis methods are widely used in the prediction of RP by using a series of technical indicators. The technical indicator analysis is a method of predicting the stock price by selecting certain indicator and setting some evaluation criteria. New technical indicators such as Moving Average Convergence and Divergence (MACD), Relative Strength Index (RSI), Commodity Channel Index (CCI), etc. are created by secondary processing of basic data such as price and trading volume by using a time series analysis and statistical methodology. Evaluation of overbought or oversold is used to predict the RP and the trading point. Many research works on prediction of RP have previously been conducted by selecting these technical indicators as input and by using different machine learning tools such as SVM, ANN, etc. [33], [34], [35], [36], [37], [38]. Chang et al. [33] used MACD, RSI and trading volume as input variables, and constructed a prediction model by using backpropagation neural network (BPN). Luo and Chen [34] proposed a prediction model(PLR-WSVM ) by combining of piecewise linear representation (PLR) and weighted support vector machine (WSVM), and empirically used 15 technical indicators as input variables. Luo et al. [35] considered that the relative indicators are more useful than the absolute indicators in the prediction of RP. Absolute indicators are removed from the existing system, and relative indicators such as the turnover rate (TR), changing rate of turnover rate (CTR) and accumulated turnover rate (ATR), are added in. Zhang et al. [36] proposed a new status box method for the prediction of stock price trends. 12 trend tracking indicators and 7 trend reversal indicators were used to construct the status box. Chang et al. [37] proposed a new method for predicting RP of trends by using the Takagi-Sugeno fuzzy rule-based model (TS model). A support vector regression (SVR) classifier has been used for training of trading signal by using 28 technical indicators. Wu et al. [38] improved the accuracy in the prediction of RP by using the sentiment indicators extracted from the news together with technical indicators.

On the other hand, many studies have used Japanese candlestick patterns for the prediction of future stock prices and trends. The Japanese candlestick chart was firstly developed by a Munehisa Homma in the 18th century and has been applied to the rice market in Osaka, Japan [39,40]. For its strong stereoscopic and intuitiveness and sufficient amount of information, Japanese candlestick chart makes it possible to fully understand the basic trends of the stock market. Therefore, many research works have been conducted to understand the movements of stock prices by using candlestick chart analysis. Particularly, researches for establishing a trading strategy using the candlestick reversal pattern and studies proving its effectiveness have been conducted. Zhu et al. [41] verified the usefulness of the five candlestick reversal patterns, such as engulfing and harami, to the Chinese market. According to their research, bearish harami and cross patterns are effective in predicting downward trends, while bullish piercing, engulfing and harami are beneficial for upward trend prediction. Lu [42] investigated the profitability of twelve one-day candlestick patterns in the Taiwanese stock market. The results show that four patterns are profitable and candlestick approach is more appropriate for small firms and lower priced stocks. Chen et al. [43] studied the prediction accuracy of four pairs of two-day candlestick patterns in the Chinese stock market. For all of four pairs, the prediction accuracy declines as the increment of predicting time, and the prediction accuracy is stronger for stocks of medium market value rather than those of large market value. On the base of fuzzy theory, Naranjo et al. [44] proposed a method of modeling trading rules based on candlestick patterns. They used three fuzzied patterns including bullish kicking, Hammer and Piercing and tested in two markets: Nasdaq-100 and Eurostoxx. do Prado et al. [45] verified its validation to the Brazilian stock market for 16 candlestick patterns. Results showed that no patterns can uniformly be applied to the Brazilian stock market and some patterns such as Harami-Bullish have a local prediction accuracy.

As shown above, many studies on prediction of RP have been conducted by using technical indicators. However, it is still not clear which combination of indicators is most appropriate. In addition, there have been a number of studies to predict the reversal of trends and to establish a trading strategy by using the candlestick reversal pattern. However, as mentioned above, no pattern can be uniformly applied to all stocks and it is necessary to find individual patterns that can be effectively applied to each stock. According to [25], [26], [27], [28], [29], it has been verified that LSTM is superior to other learning methods for the effective extracting of significant information from complex financial time series data. As one type of Recurrent Neural Networks (RNN), LSTM networks have feedback connections inside the neural network for the training of sequence data. Therefore, it can be effectively used for sequential data modeling and time series analysis.

Although many researchers have used candlestick patterns or technical indicators for the prediction of trend reversal points, no one has ever used both of them together. Moreover, there is no any combination of candlestick patterns and technical indicators uniformly applicable to URP and DRP predictions of all stocks. Therefore, we have proposed a new LSTM-based prediction model of trend reversal point. (1) Based on the combinations of candlestick indicators and technical indicators, 27 sets of feature candidates were constructed, and then the feature sets suitable to each stock in terms of URP/DRP prediction were respectively extracted. (2) LSTM-based URP/DRP predictors were constructed, the results of which are combined to improve the prediction accuracy. URP/DRP predictors are constructed by using the LSTM networks which consist of input and output layers and a hidden layer, and the structural parameters of both predictors are all determined through training process. The hidden layer is exploited to capture the nonlinear relationships between variables.

The latter part of the paper consists of the followings. Section 2 introduces LSTM and Japanese candlestick patterns. The proposed model is described in Section 3. Section 4 illustrates the experimental results and analysis. The discussions and objects of lateral research works will be given in Section 5.

Section snippets

Japanese candlestick chart

Japanese candlestick chart has been developed in the 18th century by Munehisa Homma, and has been introduced to the Western world by Steve Nison [39] in his book published in 1991. Candlesticks are composed of open, high, low and close prices of each time unit. The color of candlestick can be decided by comparing open and close prices. A white candlestick means that close price is higher than open price, while a black candlestick means that close price is lower than open price. Schematic

Reversal point definition

The main purpose of the current study is to predict the reversal point of stock prices. The most important problem of the current study is to determine whether the time point when the stock prices in upward or downward trend alternate the direction is a real reversal point or a temporary fluctuation. Therefore, it is very important how to define the trend, candidate reversal point and reversal point.

Trend

Since the candlestick reversal pattern is known to be valid only when the stock price in upward

Experimental results and discussion

Stock data that has been used in the current study have been downloaded from Yahoo Finance. Since deep learning requires as much training data as possible, 10 stocks with more than 2500 trading days have been randomly selected in Chinese and American markets, respectively. 90% of the stock data of each corporation has been used as training data, while 10% has been used as testing data. Stock data of Chinese and American markets have been shown in Table 2 and Table 3, respectively.

Conclusion

A novel LSTM based stock price reversal point prediction model has been proposed. The proposed model consists of URP and DRP predictors, and the results of both predictors have been combined to improve the prediction accuracy. Current study tried to improve the prediction accuracy for each stock by choosing URP/DRP feature sets appropriate them among 27 feature candidate sets constructed by combining of candlestick indicators and technical indicators, not by uniformly using a certain feature

Declaration of Competing Interest

None.

Funding

This research did not receive any specific grant from funding agencies in the public, commercial, or not-for-profit sectors.

References (48)

  • V Chang

    The Business intelligence as a service in the cloud

    Future Generat Compu Syst

    (2014)
  • L.K. Luo et al.

    Integrating piecewise linear representation and weighted support vector machine for stock trading signal prediction

    Appl Soft Comput

    (2013)
  • L.K. Luo et al.

    Improving the integration of piece wise linear representation and weighted support vector machine for stock trading signal prediction

    Appl Soft Comput

    (2017)
  • X.D. Zhang et al.

    Stock trend prediction based on a new status box method and AdaBoost probabilistic support vector machine

    Appl Soft Comput

    (2016)
  • P.C. Chang et al.

    A Takagi–Sugeno fuzzy model combined with a support vector regression for stock trading forecasting

    Appl Soft Comput

    (2016)
  • J.L. Wu et al.

    An intelligent stock trading system using comprehensive features

    Appl Soft Comput

    (2014)
  • M. Zhu et al.

    Are candlestick trading strategies effective in certain stocks with distinct features?

    Pac Basin Financ J

    (2016)
  • T.H. Lu

    The profitability of candlestick charting in the Taiwan stock market

    Pac Basin Financ J

    (2014)
  • S. Chen et al.

    The predictive power of Japanese candlestick charting in Chinese stock market

    Phys A

    (2016)
  • R. Naranjo et al.

    Fuzzy modeling of stock trading with fuzzy candlesticks

    Expert Syst Appl

    (2018)
  • EF Fama

    Efficient capital markets: a review of theory and empirical work

    J Finance

    (1970)
  • EF Fama et al.

    Filter rules and stock-market trading

    J Bus

    (1966)
  • HJC Van et al.

    The random-walk theory: an empirical test

    Financ Anal J

    (1967)
  • B. Malkiel

    A Random Walk Down Wall Street: Including a Life-cycle Guide to Personal Investing

    (1999)
  • Cited by (31)

    • Stock index futures price prediction using feature selection and deep learning

      2023, North American Journal of Economics and Finance
    View all citing articles on Scopus
    View full text