US Stock Market

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 4

Evaluating the Effectiveness of Candlestick Analysis in

Forecasting U.S. Stock Market


Mengjiao Wang Yujing Wang
University of Oxford, University of Central Lancashire
Wellington Square, Oxford, OX1 2JD, UK, FYLDE RD, Preston, PR1 2HE,UK
+44 07592363548 +86-18985650050
mengjiao.wang97@gmail.com 909768590@qq.com

ABSTRACT Fortunately, all these factors will be ultimately reflected on the K-


Predicting the stock market trend has drawn wide attention from line chart [2]. Stock price forecasting based on K-line charts
the public, industry, and academia. There are various strategies for allows investors to have a low-cost view of the market.
investment, ranging from the buy-and-hold strategy that let time Multiple methods were previously used for the stock price
makes money to high-frequency trading based on complicated prediction. Among them, large-scale data mining and machine
models of machine learning. For the general public, the learning, which has been widely applied in various fields
candlestick analysis is a simple and straightforward way to predict including engineering [3, 4] and bioscience [5, 6], is the hottest
the market trend and help make decisions on buy and sell. area of research for stock price prediction. Almost three decades
However, the general effectiveness and validity of such ago, Schöneburg et al. assessed the possibility of predicting stock
methodology are understudied, and many previous guidebooks on price over a short-term period with neural networks [7]. Their
candlestick analysis were based on specific cases and the results were quite encouraging. Within 10 days, they achieved a
summary of prior experiences, but lack unbiased and rigorous high accuracy of up to 90%. More recently, Adebiyi A.Ariyo et al.
confirmation. Here, we aim at evaluating the effectiveness of presents the extensive process of building a stock price predictive
multiple famous candlestick patterns based on recent data of 20 model using the ARIMA model. Results revealed that the ARIMA
U.S. stocks. By estimating the fraction of correct guesses and model has a strong potential for short-term prediction and can
expected return, we were able to show that three of the four compete favorably with existing techniques for stock price
patterns under scrutiny were not effective in generating profitable prediction [8].
outcomes, but one of them do provide valuable information on
market trend reversal. Although testing more candlestick patterns However, for individual investors that do not have access to high-
and using more test data may lead to the discoveries of more performance computing facilities and lack in-depth knowledge of
patterns being significantly profitable, our results call for scrutiny machine learning, they are more concerned with simpler methods.
and scientific guidance for the general public when applying the One of such methods was the candlestick analysis [9]. In such an
candlestick analysis, and questions the general validity and analysis, if the stock closes lower than the opening, a filled
applicability of such analyses. candlestick is drawn. The top and bottom of the body represent
the opening and closing prices, respectively. The high and low
CCS Concepts whisks represent the high and low price, respectively. Candlestick
• Applied computing → Computers in other domains analysis is a short-term technique to predict stock price changes
based on the relationship between open, high, low and close prices.
Keywords As a visually appealing way to display the data, candlestick
Candlestick; Trading strategy; Stock price; Technical analysis analysis was very widely used by almost all analysis software and
major websites [10].
1. INTRODUCTION
There are many published works on candlestick analysis.
The financial market has drawn international attention from
However, many of the previous books and papers on candlestick
investment companies, individual investors, and academic
models are subject to publication bias [11] and data snooping bias
institutions [1]. The main focus is to predict stock prices at a high
[12]. For instance, many books are based on listing individual
accuracy. Many factors can affect stock prices, including
examples where the candlestick analyses were highly effective,
economic, political and psychological factors. It is not an easy job
while cases that are less typical or ineffective were not listed. To
for individual investors to grasp all these factors on a daily basis.
avoid such biases of cherry picking, we test the effectiveness of
candlestick analysis using multiple US stock data in an unbiased
Permission to make digital or hard copies of all or part of this work for
personal or classroom use is granted without fee provided that copies are manner. By scanning through these stocks in recent years and
not made or distributed for profit or commercial advantage and that evaluating the effectiveness of multiple popular candlestick
copies bear this notice and the full citation on the first page. Copyrights patterns, we report the validity of this technique in general. In the
for components of this work owned by others than ACM must be discussion, possible further research is proposed, and suggestions
honored. Abstracting with credit is permitted. To copy otherwise, or for investors were provided.
republish, to post on servers or to redistribute to lists, requires prior
specific permission and/or a fee. Request permissions from 2. METHODS
Permissions@acm.org.
ICCDA 2019, March 14–17, 2019, Kahului, HI, USA 2.1 Acquiring Stock Price Data
© 2019 Association for Computing Machinery.
To provide unbiased and updated estimation of effectiveness of
ACM ISBN 978-1-4503-6634-2/19/03...$15.00
the candlestick analysis, we retrieved a diverse group of 20 stocks
https://doi.org/10.1145/3314545.3314555

98
in SP500 since 2010/1/1 to date, and the list of stocks was (5) today has a small body
provided in Table 1.
Bearish Decrease (1) Appears after increasing trend
Table 1. List of companies and stock names Engulfing (2) Yesterday close > open, or is a
Company Name Stock Symbol small body

MMM (3) Today open > close


3M Company
Aetna AET (4) Today open > yesterday
max(close, open)
Apple AAPL
(5) today close < yesterday
eBay EBAY min(open, close)
Facebook FB Bullish Increase (1) Appears after decreasing trend
Johnson & Johnson JNJ Engulfing (2) Yesterday close < open, or is a
JPMorgan Chase & Co. JPM small body
(3) Today open < close
Merck & Co. MRK
(4) Today open < yesterday
Macy's, Inc. M
min(open, close)
Nasdaq, Inc. NDAQ
(5) today close > yesterday
Nike NKE max(open, close)
Nvidia Corporation NVDA
PayPal PYPL Here, since we retrieved a series of 20 stocks over 8 years as a
comparatively large dataset, we used a set of comparatively
ResMed RMD
stringent rules. For instance, we define a large body to be in the
Starbucks Corp. SBUX top 30% of body size compared with the last 30 days, while a
Texas Instruments TXN small body is defined to be in the bottom 30% among that of the
last 30 days. For increasing and decreasing trend, we require a
Thermo Fisher Scientific TMO consecutive of 5 days of increasing or decreasing. Although make
Union Pacific UNP the requirement less stringent would certainly increase the number
of viable cases, there is no reason to suspect that using a set of
Visa Inc V stringent requirements will change the general validity of our
Walmart WMT conclusions.

2.3 Evaluating the Accuracy of Each


2.2 Defining Candlestick Patterns Candlestick Pattern
Candlestick patterns allows plenty of room for personal judgment We used the price after 5 days compared with the next day price
and there lacks a stringent definition for each pattern. To enable to determine whether the price was moving up or down. For a
unbiased comparison and scanning through the large dataset, pattern that predicts an increase in stock price, if the price after 5
based on the general definition of candlestick patterns on the days is higher than the price of the next day, it is assigned as a
guidebook, we used a group of rules to define multiple candlestick correct prediction. Otherwise, it is assigned as an incorrect
patterns (listed in Table 2). prediction. Vice versa for patterns that predicts an decrease in the
stock price.
Table 2. Candlestick patterns
The most straightforward way of evaluating the accuracy of each
Pattern Prediction Rules pattern is by calculating the percentage of correct prediction and
Hanging Decrease (1) Appears after increasing trend then use a binomial test to see if the trend is significant or not. In
man (2) length > 2 x abs(body) this case, we are comparing the candlestick analysis with a
random guess of 50-50 (i.e. throw a coin to determine the short-
(3) high - max(open, close) < 0.1 x term market trend)
length
(4) next day open < min(open, 2.4 Measuring the Profitability of Each
close) - 0.1 x length Pattern
(5) Today has a small body Apart from the percentage of correct predictions, the most
Hammer Increase (1) Appears after decreasing trend important question for candlestick analysis is whether
identification using this pattern can bring about a profitable return.
(2) length > 2 x abs(body) For instance, even if a pattern only works 1/2 of the time, but if
(3) min(open, close) - low < 0.1 x once it correctly predicts the trend, there is a higher return than
length the lost when the pattern does not work, then the pattern is still
(4) next day open < min(open, valuable and generates a considerable return of profit.
close) - 0.3 x length

99
3. RESULTS correct guesses were shown in Table 3. A binomial test was used
Candlestick stock analysis focuses on the open, high, low and to calculate the P-values. Many of the patterns were close to a
close prices over a period. The list of patterns and a typical case random guess of 50%, with non-significant p-values. One
from the guidebook were shown in Figure 1. To read the K-line exception was the “Hammer,” with 65% of correct prediction and
chart, when the close price is lower than the open price, the body a p-value of 0.005. Therefore, we think of this pattern being useful
of the candle is black, while if the close is higher than the open, in guiding an investor’s decisions.
the body of the candle is white. Table 3. Candlestick analysis models
Total Correct Binomial
Pattern
number Perc (%) test (P)
Hanging man 33 48% 0.636
Hammer 82 65% 0.005
Bearish
Engulfing
231 45% 0.943
Bullish
Engulfing
142 54% 0.225

(a)
We further evaluated whether the expected return was
significantly different from 0 (Table 4). Using a two-tailed t-test,
we were able to show that none of the expected revenue was
significantly different from 0.
Table 4. The expected return of the candlestick analysis
Pattern Mean return T-test (P value)
Hanging man 0.0023 0.686
Hammer 0.0079 0.117
Bearish
-0.0037 0.135
Engulfing
(b) Bullish
-0.0005 0.897
Engulfing

In summary, using stringent criteria for candlestick analysis, we


were able to show that the use of the oldest known form of the
technical analysis, candlestick trading strategies, is not profitable
on 20 stocks over the 2010-2018 period overall, although one of
the patterns, which is the Hammer, showed a significantly higher
percentage of correct prediction than random guesses.

4. DISCUSSION
(c) Through rigorous hypothesis testing, we tested the oldest
technical analysis of candlestick model in model times. Given the
unbiased and updated dataset used, it is less susceptible to cherry
picking problem than many other guidebooks and previous studies.
Only one of the four candlestick rules are found to have
significant forecasting power, while the other three were not
significantly different from random guesses. Therefore, strictly
following the candlestick model probably won’t generate
considerate returns.

(d) However, it is worth noting that the candlestick analyses were, in


many cases, indicating a trend reversal. That means, the future
Figure 1. Examples of common candlestick models used in this trend would be different from the previous market trend, and the
study. (a) Hanging man. (b) Hammer. (c) Bearish engulfing. (d) probability of trend reversal is probably not 50% as we assumed
Bullish Engulfing. for random guesses. Therefore, instead of using the candlestick
Scanning through the 20 stocks over the past 8 years since model as the guideline for investment, we may still use it as a
2010/1/1, we summarized the number of cases satisfying the warning signal for market trend reversal to some extent. It would
candlestick pattern criteria listed in Table 2, and the number of potentially be interesting to study whether candlestick models

100
were effective in predicting market trend reversal compared with [6] Wang, Xiaoyu, and Amir Mortazawi. "Medium wave energy
the baseline of market trend reversal without such reversal signals. scavenging for wireless structural health monitoring
sensors." IEEE Trans. Microw. Theory Tech 62, no. 4/2
For future research, it would be very fruitful to go through more (2014): 1067-1073.
candlestick patterns and evaluate its effectiveness in various
sectors to provide individual investors with the up-to-date [7] Schöneburg, Eberhard. "Stock price prediction using neural
guidance for market trend prediction. networks: A project report." Neurocomputing 2, no. 1 (1990):
17-27.
5. REFERENCES [8] Ariyo, Adebiyi A., Adewumi O. Adewumi, and Charles K.
[1] Gay, Robert D. "Effect of macroeconomic variables on stock Ayo. "Stock price prediction using the ARIMA model." In
market returns for four emerging economies: Brazil, Russia, Computer Modelling and Simulation (UKSim), 2014
India, and China." The International Business & Economics UKSim-AMSS 16th International Conference on, pp. 106-
Research Journal (Online) 15, no. 3 (2016): 119. 112. IEEE, 2014.
[2] Elgammal, Mohammed, Fatma Ehab Zaki Ebrahim Ahmed, [9] MUTHUKUMAR, Sivaraam, and David Rossiter.
David G. McMillan, and Ali Masaad AA Al-Amari. "The "DEVELOPMENT AND ANALYSIS OF A TRADING
Information Content of Stock Market Factors." (2017). ALGORITHM USING CANDLESTICK PATTERNS."
[3] Angermueller, Christof, Tanel Pärnamaa, Leopold Parts, and (2016).
Oliver Stegle. "Deep learning for computational biology." [10] Nison, Steve. The Candlestick Course. Vol. 163. John Wiley
Molecular systems biology 12, no. 7 (2016): 878. & Sons, 2004.
[4] Li, Chuan, Wenfeng Qian, Calum J. Maclean, and Jianzhi [11] Lo, Andrew W., and A. Craig MacKinlay. "When are
Zhang. "The fitness landscape of a tRNA gene." Science 352, contrarian profits due to stock market overreaction?." The
no. 6287 (2016): 837-840. review of financial studies 3, no. 2 (1990): 175-205.
[5] Cao, Song, and Ram Nevatia. "Forecasting human pose and [12] Sullivan, Ryan, Allan Timmermann, and Halbert White.
motion with multibody dynamic model." In Applications of "Data snooping, technical trading rule performance, and the
Computer Vision (WACV), 2015 IEEE Winter Conference bootstrap." The journal of Finance 54, no. 5 (1999): 1647-
on, pp. 191-198. IEEE, 2015. 1691.

101

You might also like