You are on page 1of 110

FORECASTING AND TRADING STOCK USING TECHNICAL ANALYSIS AND

NEURAL FUZZY NETWORK















MISS NAM DINH THI














A THESIS SUBMITTED IN PARTIAL FULFILLMENT OF THE REQUIREMENTS
FOR THE DEGREE OF MASTER OF SCIENCE IN INFORMATION TECHNOLOGY
GRADUATE COLLEGE
KING MONGKUT'S INSTITUTE OF TECHNOLOGY NORTH BANGKOK
ACADEMIC YEAR 2006
COPYRIGHT OF KING MONGKUT'S INSTITUTE OF TECHNOLOGY NORTH BANGKOK
Name : Miss Nam Dinh Thi
Thesis Title : Forecasting and Trading Stock Using Technical Analysis and
Neural Fuzzy Network
Major Field : Information Technology
King Mongkuts Institute of Technology North Bangkok
Thesis Advisor : Assistant Professor Dr. Phayung Meesad
Academic Year : 2006

Abstract
This research proposes an innovative method for forecasting stock. The proposed
stock forecasting method is a combination of Technical Analysis, Fuzzy logic, and
Neural Network to predict and trade stocks. The proposed stock prediction method
comprises of 7 steps: 1) preparing historical data and calculate the variation percentage
between two Close prices at time t and time t +n; 2) partitioning the universe of
discourse into several even and equal length intervals; 3) defining fuzzy sets on the
universe of discourse; 4) fuzzifying the values of variation derived from the variation
percentage of two close prices on time line derived from Step 1; 5) calculating the
candlestick patterns; 6) training with neural network; and 7) interpreting forecasted
outputs.
The empirical results from experiments with historical data of one of the stock
exchanges in the United State show a promise from the combination between technical
analysis and neural-fuzzy. The MSE of the predicted results were small.

(Total 103 pages)

Keywords: Forecasting, Trading, Stock, Technical Analysis, Neural Fuzzy Network





Advisor


ii
:
:

:

: .
: 2549



7 1)
t
t + n 2) 3)
4) 5) 6)
7)


( 103 )

:












iii
ACKNOWLEDGEMENTS

I am greatly pleased to express my sincere thanks to many people who made
this thesis possible.
It is difficult to express my gratitude to my advisor, Dr. Phayung Meesad. With
his enthusiasm, his inspiration, his great efforts to explain things clearly and simply
and his smiles, he helped me believe in myself. Throughout my thesis-doing period,
he provided encouragement, sound advice, good teaching, and lots of good ideas. I
would have been failed without him.
I also would like to express my sincere thanks to Dr. Utomporn Phalavonk, my
first year advisor, for her advice and support throughout I-MIT course. I would like to
say a big thank you to my teachers who have taught me during all master courses. I
am indebted to their knowledge, helpful suggestions and valuable assistances
throughout my studying in Thailand. I also would like to thank Andrea J ersabek,
International Coordinator, for her help in checking grammar errors in my thesis.
I would like to thank the Thailand International Cooperation Department
(TICA) for the scholarship which has supported me during my two years of master
degree in Thailand. Without their support, it is impossible for me to have a chance to
visit and study in Thailand.
I am indebted to King Mongkuts Institute of Technology North Bangkoks
Leaders, Teachers and Staff and the Staff of the Faculty of Information Technology
for providing a stimulating and fun environment in which I can learn and enjoy my
time in Thailand and providing a lot of support for me.
I wish to thank all my best friends in Faculty of Information Technology, in
KMITNB, and in Thailand for helping me get through the difficult times, and for all
the emotional support, entertainment, and care they provided. I also would like to
thank all my closest friends in Vietnam for their love and patiently waiting for me.
Last but certainly not least, I would love to thank my parents, my sisters and
brother and my relatives for their love, care and encouragement. I would love to thank
Prof. Cecil and Geneva Dugger for their love and kindness.
Nam Dinh Thi


iv
TABLE OF CONTENTS
Page
Abstract (in English) ii
Abstract (in Thai) iii
Acknowledgements iv
List of Tables vii
List of Figures viii
Chapter 1 Introduction 1
1.1 Problem Statement and Background 1
1.2 The Objectives of the Study 2
1.3 The Scope of the Study 3
1.4 The Utilizations of the Study 3
Chapter 2 Literature Review 5
2.1 Introduction to Technical Analysis 5
2.2 Technical Analysis with Candlestick 8
2.3 Introduction to Artificial Neural Network 23
2.4 Fundamentals of Fuzzy Logic 28
2.5 Neural Fuzzy Systems 35
2.6 Stock Forecasting Problem and Related Works 36
2.7 Summary 39
Chapter 3 Methodology 41
3.1 The Proposed Forecasting Model 41
3.2 Fuzzifying Candlestick Patterns 43
3.3 Forecasting Steps 48
3.4 Evaluating the Experimental Results 50
3.5 GUI Design for Forecasting System 50
Chapter 4 Results of the Study 57
4.1 The Data for the Experiments 57
4.2 The Experiments 57



v

TABLE OF CONTENTS (CONTINUED)
Page
4.3 The Sample Results 62
Chapter 5 Conclusion 67
5.1 Conclusions 67
5.2 Future Works 68
References 69
Appendix A 71
Appendix B 87
Biography 103



vi

LIST OF TABLES

Table Page
3-1 The historical data from April 4, 2007 to April 16, 2007 of MSFT 53
4-1 Training data, one day variations and fuzzy sets 58
4-2 Candlestick patterns derived from training data 61
4-3 A comparison of the forecasted results with different tests 65
B-1 Historical prices of DIS as a training data 88
B-2 Historical prices of DIS as a testing data 98


vii

LIST OF FIGURES

Figure Page
2-1 Candlestick Lines 9
2-2 Candlestick Lines with Long Body 10
2-3 A candlestick line with Short Body 10
2-4 White Marubozu 11
2-5 Black Marubozu 11
2-6 Closing Marubozu 12
2-7 Opening Marubozu 12
2-8 Spinning Top 13
2-9 Doji 13
2-10 Bullish Piercing Line 14
2-11 Bullish Kicking Pattern 15
2-12 Bullish Abandoned Baby 16
2-13 Morning Star 17
2-14 Morning Doji Star 18
2-15 Bullish Engulfing Pattern 19
2-16 Dark-Cloud Cover 20
2-17 Evening Star 21
2-18 Long Legged Doji 21
2-19 Umbrella 22
2-20 The biological neuron 24
2-21 The artificial neuron with a threshold function 24
2-22(a) A feed-forward network with a single output layer of neurons 26
2-22(b) A fully connected feed-forward network with one hidden layer
and one output layer 26
2-23 A recurrent network with hidden neurons 27
2-24(a) Membership functions: Triangle 31
2-24(b) Membership functions: Trapezoid 31



viii
LIST OF FIGURES (CONTINUED)
Figure Page
2-25 Bell membership function 32
2-26 Fuzzy Inference System 34
3-1 Forecasting framework using candlestick fuzzy neural networks 41
3-2 The membership function of the length of the body and shadow 43
3-3 The membership function of the open and close styles 46
3-4 GUI Design of stock forecasting application 50
3-5 The Open Train/Test Data Interface 51
3-6 The Analysis Tool Interface 52
3-7 Plotting data in bar chart 53
3-8 Bar chart plotted by the system 54
3-9 Plotting data in candlestick chart 55
3-10 Candlestick chart plotted by the system 56
4-1 Previous CLOSE price vs. Predicted Price using Fuzzy Neural 62
4-2 Training performance of fuzzy neural method 63
4-3 Previous CLOSE price vs. Predicted Price using neural method 64
4-4 Training performance of neural method 65
A-1 Bullish three inside up 72
A-2 Bullish three outside up 73
A-3 Bullish three white soldiers 74
A-4 Bullish concealing baby swallow 75
A-5 Bullish Harami cross 76
A-6 Bearish kicking 77
A-7 Bearish abandoned baby 78
A-8 Bearish evening Doji star 79
A-9 Bearish three black crows 80
A-10 Bearish three inside down 81
A-11 Bearish three outside down 82
A-12 Bearish upside gap two crows 83
A-13 Bearish engulfing 84



ix

CHAPTER 1
INTRODUCTION

1.1 Background and Statement of the Problem
Few human activities have been so exhaustively studied during the past fifty
years, from so many angles and by so many different sorts of people, as has the
buying and selling corporation securities. The rewards which the stock market holds
out to those who read it right are enormous; the penalties it exacts from careless,
dozing or unlucky investors are calamitous - no wonder it has attracted some of the
worlds most astute accountants, analysts and researchers [1]. Forecasting the stock
price and determining the market timing, when to buy and sell stocks, are the two
main problems which most researchers and practitioners face in order to get high
financial gain.
There are two main approaches to predict stock prices, namely fundamental
analysis and technical analysis. Fundamental analysis is a method of forecasting the
future price movement of a financial instrument which is based on examining the
company's financials and operations such as sales, earnings, growth potential, assets,
debt, management, products, and competition, macroeconomic data, politics,
environment and other relevant factors. Technical analysis involves using past stock
prices, volume, and other related data to forecast the future price movements [2].
Several techniques have been researched to predict the stock price and produce
trading signals in order to determine when to buy and sell stocks. Regression models,
AutoRegressive Integrated Moving Average (ARIMA) models and Seasonal ARIMA
models have been used to predict stock prices in the past [3]. However, these models
have not succeeded to accurately forecast some financial series because of their linear
structures and other inherent limitations. The introduction of Autoregressive
Conditional Heteroskedasticity (ARCH) and Generalized Autoregressive Conditional
Heteroskedasticity (GARCH) models were enormous theoretical and practical
developments in financial econometrics in the eighties. It became clear that ARCH
models could efficiently and quite easily represent the typical empirical findings in

2
financial time series. These models can deal with the non-constant variance, but some
series can not predict accurately [4].
Neural networks, recently, have been used in forecasting and trading stocks. In
[5], the authors attempt to model and predict the direction of return on market index
of the Taiwan Stock Exchange, one of the fastest growing financial exchanges in
developing Asian countries. The probabilistic neural network (PNN) is used to
forecast the direction of index return after it is trained by historical data. The good
performance of the PNN suggests that the neural network models are useful in
predicting the direction of index returns. In [6], a back propagation neural network is
used to capture the relationship between the technical indicators and the levels of the
index in the market under study over time. Using different trading strategies, a
significant paper profit can be achieved by buying the indexed stocks in the respective
proportions. Other research shows the ability of neural networks to predict the price or
the price movements of a stock [7, 8, 9]. However, common neural networks suffer
from a black box syndrome and involve difficulties in dealing with qualitative
information. On the other hand, fuzzy logic may be used for stock market forecasting
either independently or hybridized with other methods [10]. However, the limitation
reported with fuzzy logic method still remains. This is the requirement of expert
knowledge prior to designing fuzzy methods for forecasting.
This research attempts to combine technical analysis and neural fuzzy network
to predict and trade stocks. The empirical results from experiments with historical
data of two companies listed on the New York Stock Exchange (NYSE) in the United
State were used to evaluate the performance of this combination.

1.2 Objectives
1.2.1 To develop an algorithm based on technical analysis and neural fuzzy
network to apply to forecasting and trading stock.
1.2.2 To evaluate the efficiency of the developed algorithm.

3
1.3 Scope
1.3.1 Historical stock data of several companies listed on the New York
Stock Exchange (NYSE) is used in experiments in forecasting and trading.
1.3.2 Presumptions of Technical Analysis are relied on making investment
and trading decisions.
1.3.3 Technical analysis techniques using candlestick theory are applied in
the research.
1.3.4 Neural network and fuzzy logic are applied for the forecasting process.
1.3.5 MATLAB is used to implement the proposed methodology.
1.3.6 The efficiency of the proposed methodology is evaluated and discussed
through the experimental results and performance comparison between using neural-
fuzzy and neural network.

1.4 Utilization of the Study
The research has benefits as follow:
1.4.1 To help traders and investors in forecasting the stock price and
determining the market timing.
1.4.2 To investigate the effect of using technical analysis and neural fuzzy
network to forecasting and trading stocks.







CHAPTER 2
LITERATURE REVIEW

In this chapter, stock forecasting problem and related works, technical analysis,
technical analysis with candlestick, neural network, fuzzy logic, and fuzzy-neural
systems are reviewed. Section 2.1 and 2.2 present a basic knowledge about technical
analysis and technical analysis with candlestick in the stock market. Section 2.3 gives
a brief introduction to artificial neural networks. Section 2.4 and Section 2.5 present
fundamentals of fuzzy logic and fuzzy neural systems. Section 2.6 describes the stock
forecasting problem and related works of other researchers. Section 2.7 presents the
chapter summary.

2.1 Introduction to Technical Analysis
2.1.1 Technical Analysis
Technical analysis is perhaps the oldest method designed to beat the market. Its
history can be traced to the seminal articles published by Charles H. Dow in the Wall
Street Journal between 1900 and 1902, and its basic concepts became popular after
contributions by Hamilton (1922) and Rhea (1932). Technical Analysis has been
further developed since then and nowadays, many traders, investors and other
practitioners take their buying and selling decisions on the basis of technical analysis
results.
The term technical, in its application in the stock market, has a very special
meaning, quite different from its ordinary dictionary meaning. It refers to the study of
the action of the market itself rather than the study of the goods in which the market
deals.
Technical Analysis is a method for evaluating and forecasting future price
movements based on an examination of past price movements.
Technical analysis is applicable to stocks, indices, commodities, futures or any
tradable instrument where the price is influenced by the forces of supply and demand.



6
2.1.2 The Basis of Technical Analysis
At the turn of the century, the Dow Theory laid the foundations for what was
later to become modern technical analysis. Dow Theory was not presented as one
complete amalgamation, but rather pieced together from the writings of Charles Dow
over several years [15]. Of the many theorems put forth by Dow, three stand out:
- Price Discounts Everything
- Price Movements Are Not Totally Random
- What Is More Important than Why
2.1.2.1 Price Discounts Everything
Market prices reflect everything that can be known about a stock and its future
prospects. The market as a mechanism is very efficient at discounting whatever can
affect prices. Even unforeseen events, such as new competition, legal or financial
problems, a company takeover, the death of a founder, and so on are quickly priced
into the stock. Even unknown (not yet publicized) fundamental factors, such as a
sharp earnings drop, are seldom unknown or unanticipated by everyone; those who
know often act on the information, and selling volume starts to pick up on rallies.
There are traders, investors, and analysts outside a company or an industry who see
changes coming, through smart observation and sharp analysis. Technical analysis
utilizes the information captured by the price to interpret what the market is saying
with the purpose of forming a view on the future.
2.1.2.2 Price Movements are not Totally Random
The information about a companys stock and its future earning prospects that
are reflected in the stock price will also be reflected in a price trend or tendency to go
up or down. Price trends occur and reoccur in patterns that are largely predictable.
The idea of trends reoccurring is that history repeats itself. If there previously was
abundant stock for sale (supply) at $50, and sales caused a decrease in prices, it may
well be the case again when the stock approaches this level again. If it does not, this
also tells you something, as demand was this time strong enough to overcome selling.
If prices were always random, it would be extremely difficult to make money using
technical analysis.
A technician believes that it is possible to identify a trend, invest or trade based
on this trend, and to make money as the trend unfolds. Because technical analysis can



7
be applied to many different time frames, it is possible to spot both short-term and
long-term trends.
2.1.2.3 "What" is more important than "Why?"
Technicians, as technical analysts are called, are only concerned with two things:
1. What is the current price?
2. What is the history of the price movement?
The price is the current state of the battle between the forces of supply and
demand for the company's stocks. The objective of the analysis is to forecast the
direction of the future price. By focusing on price and price only, technical analysis
represents a direct approach. Fundamentalists are concerned with why the price is
what it is. For technicians, the why portion of the equation is too broad and many
times the fundamental reasons given are highly suspect. Technicians believe it is best
to concentrate on what and never mind why. The question why did the price go
up? is simply answered by the law of supply and demand.
2.1.3 Price Fields
Technical analysis is based almost entirely on the analysis of price and volume.
The fields which define a stock's price and volume are explained below [16].
- Open - This is the price of the first trade for the period (e.g., the first trade of
the day). When analyzing daily data, the Open is especially important as it is the
consensus price after all interested parties were able to "sleep on it."
- High - This is the highest price at which the stock is traded during the period.
It is the point at which there were more sellers than buyers (i.e., there are always
sellers willing to sell at higher prices, but the High represents the highest price buyers
were willing to pay).
- Low - This is the lowest price that the stock traded during the period. It is the
point at which there were more buyers than sellers (i.e., there are always buyers
willing to buy at lower prices, but the Low represents the lowest price sellers were
willing to accept).
- Close - This is the last price that the stock traded during the period. Due to its
availability, the Close is the most often used price for analysis. The relationship
between the Open (the first price) and the Close (the last price) is considered
significant by most technicians. This relationship is emphasized in candlestick charts.



8
- Volume - This is the number of shares (or contracts) that were traded during
the period. The relationship between prices and volume (e.g., increasing prices
accompanied with increasing volume) is important.
- Open Interest - This is the total number of outstanding contracts (i.e., those
that have not been exercised, closed, or expired) of a future or option. Open interest is
often used as an indicator.
- Bid - This is the price a market maker is willing to pay for a stock (i.e., the
price you will receive if you sell).
- Ask - This is the price a market maker is willing to accept (i.e., the price you
will pay to buy the security).
These simple fields are used to create literally hundreds of technical tools that
study price relationships, trends, patterns, etc.

2.2 Technical Analysis with Candlestick
2.2.1 History
In the 1600s, the legendary Japanese rice trader Munehisa Honma developed a
method of technical analysis to analyze the price of rice contracts [16]. This technique
is called candlestick charting.
Candlestick charts display the open, high, low, and closing prices in a format
similar to modern-day bar-charts, but in a manner that extenuates the relationship
between the opening and closing prices. Candlestick charts are simply a new way of
looking at prices. They do not involve any calculations.
2.2.2 Formation
In order to create a candlestick chart, you must have a data set that contains
open, high, low and close values for each time period you want to display.



9













HIGH Upper Shadow
LOW Lower Shadow
OPEN
CLOSE
REAL BODY - The color of
real body is WHITE if
CLOSE is higher than
OPEN. The color of real
body is BLACK if CLOSE
is lower than OPEN
HIGH Upper Shadow
LOW Lower Shadow
OPEN
CLOSE
REAL BODY - The color of
real body is WHITE if
CLOSE is higher than
OPEN. The color of real
body is BLACK if CLOSE
is lower than OPEN
BLACK Candlestick WHITE Candlestick

FIGURE 2-1 Candlestick Lines

In Figure 2-1, the thick part of the candlestick line is called the REAL BODY. It
represents the range between that session's opening and closing. When the real body
is black, it means the close of the session was lower than the open. If the real body is
white, it means the close was higher than the open.
The thin lines above and below the real body are the SHADOWs. These
shadows represent the session's price extremes. The shadow above the real body is
called the UPPER SHADOW and the shadow under the real body is known as the
LOWER SHADOW. Accordingly, the peak of the upper shadow is the high of the
session and the bottom of the lower shadow is the low of the session. It is easy to see
why these are named candlestick charts since the individual lines often look like
candles and their wicks. To the Japanese, the real body is the essential price
movement. The shadows are usually considered as extraneous price fluctuations.
Below is a summary of the major candlestick formations and their definitions:




10
2.2.2.1 Long days







FIGURE 2-2 Candlestick Lines with Long Body

A long day represents a large price move from open to close. Long represents
the length of the real body. What qualifies a candle body to be considered long? That
is a question that has to be answered relative to the chart being analyzed. The recent
price action of a stock will determine whether a "long" candle has been formed.
Analysis of the previous two or three weeks of trading should be a current
representative sample of the price action. Figure 2-2 shows candlestick lines with long
body.
2.2.2.2 Short Days





FIGURE 2-3 A Candlestick line with Short Body

In Figure 2-3, short days can be interpreted by the same analytical process as for
the long candles. There are a large percentage of the trading days that do not fall into
either of these two categories.




11
2.2.2.3 White Marubozu






FIGURE 2-4 White Marubozu

In Figure 2-4, the White Marubozu is a long white body with no shadows on
either end. This is an extremely strong pattern. Consider how it is formed. It opens on
the low and immediately heads up. It continues upward until it closes, on its high.
Counter to the Black Marubozu, it is often the first part of a bullish continuation
pattern or bearish reversal pattern. It is called a Major Yang or Marubozu of Yang.
2.2.2.4 Black Marubozu






FIGURE 2-5 Black Marubozu

In Figure 2-5, a long black body with no shadows at either end is known as a
Black Marubozu. It is considered a weak indicator. It is often identified in a bearish
continuation or bullish reversal pattern, especially if it occurs during a downtrend. A
long black candle could represent the final sell off, making it an "alert" to a bullish
reversal setting up. The Japanese often call it the Major Yin or Marubozu of Yin.




12
2.2.2.5 Closing Marubozu






FIGURE 2-6 Closing Marubozu

A Closing Marubozu (shown in Figure 2-6) has no shadow at its closing end. A
white body will not have a shadow at the top. A black body will have no shadow at
the bottom. In both cases, these are strong signals corresponding to the direction that
they each represent.
2.2.2.6 Opening Marubozu







FIGURE 2-7 Opening Marubozu

The Opening Marubozu (shown in Figure 2-7) has no shadows extending from
the open price end of the body. A white body would not have a shadow at the bottom
end; the black candle would not have a shadow at its top end. Though these are strong
signals, they are not as strong as the Closing Marubozu.




13
2.2.2.7 Spinning Top







FIGURE 2-8 Spinning Top

Spinning Tops, as shown in Figure 2-8, are depicted with small bodies relative
to the shadows. This demonstrates some indecision on the part of the bulls and the
bears. They are considered neutral when trading in a sideways market. However, in a
trending or oscillating market, a relatively good rule of thumb is that the next days
trading will probably move in the direction of the opening price. The size of the
shadow is not as important as the size of the body for forming a Spinning Top.
2.2.2.8 Doji






FIGURE 2-9 Doji

The Doji is one of the most important signals in candlestick analysis. It is
formed when the open and the close are the same or very near the same. The lengths
of the shadows can vary. The longer the shadows are, the more significant the Doji
becomes. Figure 2-9 illustrates a Doji pattern.




14
2.2.3 Candlestick Patterns
The interpretation of candlestick charts is based primarily on patterns. The
patterns are examined in three main groups as Bullish, Bearish, and Neutral.
2.2.3.1. Bullish Reversal Patterns
2.2.3.1.1 Bullish Piercing Line








FIGURE 2-10 Bullish Piercing Line

Definition:
A Bullish Piercing Line Pattern, as shown in Figure 2-10, is a bottom reversal
pattern. A long black candlestick is followed by a gap lower during the next day while
the market is in downtrend. The day ends up as a strong white candlestick, which
closes more than halfway into the prior black candlesticks real body.
Recognition Criteria:
- The market is characterized by downtrend.
- A long black candlestick can be seen.
- We see a long white candlestick whose opening price is below the previous
days low on the second day.
- The second days close is contained within the first day body and it is also
above the midpoint of the first days body.
- The second day, however, fails to close above the body of the first day.
Explanation:
The market moves down in a downtrend. The first black real body reinforces
this view. The next day the market opens lower via a gap. Everything now goes, as
the bears want it. However suddenly the market surges toward the close, leading the



15
prices to a close sharply above the previous days close. Now the bears are losing
their confidence and reevaluate their short positions. The potential buyers start
thinking that new lows may not hold and perhaps it is time to take long positions.
Important Factors:
- In the Bullish Piercing Pattern, the greater the degree of penetration into the
black real body, the more likely it will be a bottom reversal. An ideal piercing pattern
will have a real white body that pushes more than half way into the prior sessions
black real body.
- A confirmation of the trend reversal by a white candlestick, a large gap up or
by a higher close on the next trading day is suggested.
2.2.3.1.2 Bullish kicking pattern







FIGURE 2-11 Bullish Kicking Pattern

Definition:
The Bullish Kicking Pattern, as shown in Figure 2-11, is a White Marubozu
following a Black Marubozu. After the Black Marubozu, the market gaps sharply
higher on the opening and opens with a gap above the prior sessions opening thus,
forming a White Marubozu.
Recognition Criteria:
- The market direction is not important.
- A Black Marubozu pattern can be seen.
- Then we see a White Marubozu that gaps upward on the second day.
Explanation:
This Bullish Kicking Pattern is a strong sign showing that the market is headed
upward. The previous market direction is not important for this pattern unlike most



16
other candle patterns. The market is headed up with the Bullish Kicking Pattern as the
prices gap up the next day. The prices never enter into the previous day's range.
Instead they close with another gap.
Important Factors:
- We should be careful that both of the patterns do not have any shadows or they
have only very small shadows (they both are Marubozu).
- The Bullish Kicking Pattern is somewhat similar to the Bullish Separating
Lines Pattern. The opening prices are equal in Bullish Separating Lines Pattern while
in the Bullish Kicking Pattern a gap occurs.
- The Bullish Kicking Pattern is highly reliable, but still, a confirmation of the
reversal on the third day should be sought. This confirmation may be in the form of a
white candlestick, a large gap up or a higher close on the third day.
2.2.3.1.3 Bullish abandoned baby








FIGURE 2-12 Bullish Abandoned Baby

Definition:
The Bullish Abandoned Baby Pattern, as shown in Figure 2-12, is a very rare
bottom reversal signal. It is composed of a Doji Star, which gaps away (including
shadows) from the prior and following days candlesticks.
Recognition Criteria:
- The market is characterized by downtrend.
- A long black candlestick in the first day can be seen.
- A Doji appears on the second day whose shadows gap below the previous
day's lower shadow and gaps in the direction of the previous downtrend.



17
- We see a white candlestick on the third day with a gap in the opposite
direction with no overlapping shadows.
Explanation:
We have a similar scenario that is valid for most of the three-day star patterns.
In a falling market, the market shows bearish strength first with a long black
candlestick, and opens with a gap on the second day. The second day trading is within
a small range and the second day closes at or very near its open. This now suggests
the potential for a rally showing that positions are changed. The signal of trend
reversal is given by the white third day and by a well-defined upward gap.
Important Factors:
- The Bullish Abandoned Baby Pattern is quite rare.
- The reliability of this pattern is very high, but still a confirmation in the form
of a white candlestick with a higher close or a gap-up is suggested.
2.2.3.1.4 Morning Star







FIGURE 2-13 Morning Star

Rules of Recognition (as shown in Figure 2-13):
- It is comprised of a tall, black real body followed by a small white real body
which gaps lower (these two lines comprise a basic star pattern).
- The third day is a white real body that moves well within the first period's
black real body.



18
2.2.3.1.5 Morning Doji Star






FIGURE 2-14 Morning Doji Star

Definition:
The Morning Doji Star, as shown in the Figure 2-14, is also a three-candlestick
formation signaling a major bottom reversal. It is composed of a long black
candlestick followed by a Doji, which characteristically gaps down to form a Doji star.
Then we have a third white candlestick whose closing is well into the first sessions
black real body. This is a meaningful bottom pattern.
Recognition Criteria:
- The market is characterized by downtrend.
- A long black candlestick in the first day can be seen.
- Then we see a Doji on the second day that gaps in the direction of the previous
downtrend.
- The white candlestick on the third day confirms the reversal.
Explanation:
A black real body while the market is falling down may suggest that the bears
are in command. Then a Doji appears showing the diminishing capacity of sellers to
drive the market lower. Confirmation of bull ascendancy is marked by the third days
strong white real body. An ideal Bullish Morning Doji Star Pattern must have a gap
before and after the middle lines real body. The second gap is rare, but lack of it does
not affect the power of this formation.
Important Factors:
- The Doji may be more than one, two or even three.
- Dojis gaps are not important.



19
- The reliability of this pattern is very high, but still a confirmation in the form of
a white candlestick with a higher close or a gap-up is suggested.
2.2.3.1.6 Bullish Engulfing Pattern






FIGURE 2-15 Bullish Engulfing Pattern

Definition:
The Engulfing pattern, as shown in the Figure 2-15, is a major reversal pattern
comprised of two opposite colored bodies. The Bullish Engulfing Pattern is formed
after a downtrend. It opens lower that the previous days close and closes higher than
the previous days open. Thus, the white candle completely engulfs the previous days
black candle.
Recognition Criteria:
- The body of the second day completely engulfs the body of the first day.
Shadows are not a consideration.
- Prices have been in a definable downtrend, even if it has been a short term.
- The body of the second candle is of the opposite color of the first candle, the first
candle being the color of the previous trend. The exception to this rule is when the
engulfed body is a Doji or an extremely small body.
Important Factors:
- A large body engulfing a small body. The previous day shows the trend was
running out of steam. The large body shows that the new direction has started with
good force.
- When the engulfing pattern occurs after a fast move down, there will be less
supply of stock to slow down the reversal move. A fast move makes a stock price
over extended and increases the potential for profit taking.



20
- A large volume on the engulfing day increases the chances that a blowoff day
has occurred.
- The engulfing body engulfs the body and the shadows of the previous day; the
reversal has a greater probability of working.
- The greater the open gaps down from the previous close, the greater the
probability of a strong reversal.
2.2.3.2 Bearish Reversal Patterns
2.2.3.2.1 Dark-Cloud Cover







FIGURE 2-16 Dark-Cloud Cover

Rules of Recognition (as shown in the Figure 2-16):
- Two candlesticks are a top reversal after an uptrend or, at times, at the top of a
congestion band.
- The first candlestick is a strong white real body.
- The second day's price opens above the top of the upper shadow.
- At the end of the second day's session, the market closes near the low of the
day and well within the prior day's white body. The greater the degree of penetration
into the white real body the more likely a top will occur. Some Japanese technicians
require more than a 50% penetration of the black session's close into the white real
body.



21
2.2.3.2.2 Evening Star







FIGURE 2-17 Evening Star

Rules of Recognition (as shown in the Figure 2-17):
- Three lines compose the evening star
- The first two lines are a long, white real body followed by a star. The star is
the first hint of a top.
- The third line corroborates a top and completes the three-line pattern of the
evening star. The third line is a black real body that moves sharply into the first
periods of white real body.
2.2.3.3. Neutral Patterns
2.2.3.3.1 Long Legged Doji


FIGURE 2-18 Long Legged Doji

Definition:
The Long Legged Doji, as shown in the Figure 2-18, is characterized by very long
shadows. It is an important reversal signal.



22
Recognition Criteria:
- The real body of the Long Legged Doji is either a horizontal line or it is
significantly small (its length is not more than a few ticks).
- Both of the upper and lower shadows are long and they are almost equal in
length.
Explanation:
Long Legged Doji shows that there is a great amount of indecision in the market.
This pattern is formed when prices trade well above and below the day's opening
price, but then close almost at the same level as the opening price. It means that the
end result is not different from the initial open despite the whole excitement and high
volatility during the day. This implies a loss of sense of direction and that there is a
great amount of indecision in the market.
Important Factors:
- Long Legged Doji is especially important at tops.
- Long Legged Doji is a single candlestick pattern. Hence, a confirmation is
definitely required in the form of an opposite move to the prior trade on the next
trading day in order to judge that a reversal may be starting.
2.2.3.3.2 Umbrella




FIGURE 2-19 Umbrella

Definition:
An Umbrella, as shown in the Figure 2-19, is a type of a Doji characterized with
no upper shadow but a long lower shadow. The long lower shadow shows the
evidence for buying pressure, but the position of low price indicates that plenty of
sellers are still around. Umbrella is interpreted as a reversal pattern.
Recognition Criteria:
- The real body is either a horizontal line or it is significantly small (its length is
not more than few ticks).



23
- There is no upper shadow.
- However the lower shadow is long.
Explanation:
Umbrella indicates that sellers mostly dominated trading during the day and that
they were able to drive the prices lower during the day. However; buyers resurfaced at
the end of the day and they successfully pushed prices back to the opening level and
to the day high.
Important Factors:
- Umbrella has the potential to signal a bullish reversal at the bottom if it
appears after a long downtrend, a long black candlestick, or if it is seen at a visible
support level. Likewise; umbrella may signal a bearish reversal at the top if it appears
after a long uptrend, a long white candlestick, or if it is seen at a visible resistance
level. Bearish or bullish confirmation is required in both situations.

2.3 Introduction to Artificial Neural Network
The foundation of neural networks in a scientific sense begins with biology. The
human brain consists of an estimated 10 billion neurons (nerve cells) and 6000 times
as many synapses (connections) between them. All information taken in by a human
is processed and assessed in this particular part of the body. A neuron in itself is
relatively slow compared to a silicon logic gate.
2.3.1 The Single Neuron
Let us begin with a fundamental description of the human brain. A process
begins when stimulus is received from the environment. The receptors transform this
information to electrical impulses and transmit them to the neural network (neurons
and synapses in Figure 2-20). After evaluation inside the network, actions are decided
and impulses are being sent out to the effectors.
Both biological and artificial neurons are elementary information processing
units. Therefore they are also fundamental building blocks of a neural network. The
artificial neuron is best illustrated by an analogy with the biological neuron.




24
Nucleus
Soma
Axon hillock
Axon
Dendrite
Synapses


FIGURE 2-20 The biological neuron

Figure 2-21 depicts the artificial neuron. We see that the connections (synapses)
w
i
transfer the signals (stimuli) u
i
into the neuron. w
i
can be interpreted as a weight
representing the importance of that specific input u
i
. Inside the neuron the sum of
the weighted inputs w
i
u
i
is taken. Given that this sum u is greater than an externally
applied threshold, the neuron emits an output z. z is either continuous or binary
valued, depending on the activation function (or squashing function). In most cases
one chooses an activation function that limits the range of the neurons output to the
interval [0, 1] or [1, 1].





i
i
i
u w


z
w
1
w
n




u
1
u
n


FIGURE 2-21 The artificial neuron with a threshold function.




25
In mathematical terms the following equation gives a dense description of the
neuron:

=
=
n
i
i i
u w y
1

Eq. 2-1

where y is the net input and ) ( y z = the activation function.
2.3.2 Activation Functions
In neural computing three different types of activation functions are being used
almost exclusively:
(i) The threshold function

<

=
0 0
0 1
) (
x
x
x
Eq. 2-2

(ii) The piecewise linear function


< <

=
2
1
0
2
1
2
1
2
1
1
) (
x
x x
x
x
Eq. 2-3

and
(iii) sigmoid functions.
An example of a sigmoid is the logistic function

) (
1
1
) (
x a
e
x

+
= Eq. 2-4

where a controls the slope.




26
2.3.3 Network Structures
The importance of the network design (arrangement between neurons and
synapses) is not to be underestimated. There is a tight relationship between the
learning algorithm and the network structure.
Two different types of neural networks can be distinguished, feed-forward and
recurrent networks.
2.3.3.1 Feed-forward Networks
A typical neural network consists of multiple layers. In a single layered network
there is an input layer of source nodes and an output layer of neurons. In addition to, a
multi-layer network has one or more hidden layers of hidden neurons. Both types of
networks are displayed in Figure 2-22. Extra hidden neurons raise the networks
ability to extract higher-order statistics from (input) data. This is a crucial quality,
especially if there is a large input layer. Furthermore a network is said to be fully
connected if every node in each layer of the network is connected to every other node
in the adjacent forward layer. In a partially connected structure at least one synaptic
connection is missing.










Output layer
Hidden layer
Input layer
(a) (b)

FIGURE 2-22 A feed-forward network with a single output layer of neurons (a)
and a fully connected feed-forward network with one hidden layer and one output
layer (b).




27
2.3.3.2 Recurrent Networks
As the name suggests, a recurrent network supplies feedback to the network, i.e.
at least one feedback loop exists. Figure 2-23 offers visualization.


















Z
-1
Z
-1
Z
-1
Z
-1
Unit-
delay
operators

FIGURE 2-23 A recurrent network with hidden neurons

2.3.4 Benefits with Neural Networks
Neural networks have several advantages. Most important is the ability to learn
from data and thus potential to generalize, i.e. produce an acceptable output for
previously unseen input data (important in prediction tasks). This even holds true (to a
certain extent) when input series contain low-quality or missing data. Another
valuable quality is the non-linear nature of a neural network. Furthermore, no expert
system (typically a programmer coding rules in a computer program) is needed which
makes the network extremely flexible to changes in the environment. One only has to
retrain the system. Regarding downsides, the black-box-property first springs to mind.
It is very difficult to relate one single outcome of a network to a specific internal
decision. Noisy data also reinforce the negative implications of establishing incorrect
causalities, overtraining (or overfitting), which will harm generalization. Finally, a



28
certain degree of knowledge in the current subject is required as it is not trivial to
asses the relevance of the chosen input series.

2.4 Fundamentals of Fuzzy Logic
2.4.1 Fuzzy logic
A classical crisp set is a collection of distinct object. The concept of a set has
become one of the most fundamental notions of mathematics. It is defined in such a
way as to dichotomize the elements of a given universe of discourse into two groups:
members and nonmembers. Finally, a crisp set can be defined by the so-called
characteristic function. Let U be a universe of discourse. The characteristic function
) (x
A
of a crisp set A in U takes its values in {0, 1} and is defined such that
1 ) ( = x
A
if x is a member of A (i.e., A x ) and 0 otherwise. That is

=
A x
A x
x
A
, 0
, 1
) (
Eq. 2-5

Note that:
(i) the boundary of set A is rigid and sharp and performs a two-class
dichotomization (i.e., or ), and A x A x
(ii) the universe of discourse U is a crisp set.
A fuzzy set, on the other hand, introduces vagueness by eliminating the sharp
boundary that divides members from nonmembers in the group. Thus, the transition
between full membership and nonmembership is gradual rather than abrupt. Hence,
fuzzy sets may be viewed as an extension and generalization of the basic concepts of
crisp sets; however, some theories are unique to the fuzzy framework.
A fuzzy set A
~
in the universe of discourse U can be defined as a set of ordered
pairs,

} { ) ) ( , (
~
U x x x A
A
= Eq. 2-6




29
Where ) (
A
~ is called the membership function of A
~
and ) (x
A
is the grade
(or degree) of membership of x in A
~
, which indicates the degree that x belongs to A
~
.
The membership function ) (x
A
maps U to the membership space M, that is
M U
A
: . When , set A is nonfuzzy and } { 1 , 0 = M ) (
A
is the characteristic
function of the crisp set A. For a fuzzy set, the range of the membership function is a
subset of the nonnegative real numbers whose suprenum is finite. In most general
cases, M is set to the unit interval [0, 1].
With this basic notation and definition for fuzzy set, we are ready to introduce
some basic set-theoretic definitions and operations for fuzzy sets. Let A and B be
fuzzy sets in the universe of discourse U.
Complement: When [ ] 1 , 0 ) ( x
A
, the complement of A, denoted as A , is
defined by its membership function as

U x x x
A
= ) ( 1 ) (
A

Eq. 2-7

Intersection: The intersection of fuzzy sets A and B, denoted as B A , is
defined by

[ ] , ) ( ) ( ) ( ), ( min ) ( U x x x x x x
B A B A B A
= =

Eq. 2-8

Where indicates the min operation. It is clear that

B B A and A B A
Union: The union of fuzzy sets A and B, denoted as B A , is defined by

[ ] , ) ( ) ( ) ( ), ( max ) ( U x x x x x x
B A B A B A
= =

Eq. 2-9

Where indicates the min operation. It is clear that

. B A B and B A A
Equality: A and B are equal if and only if U x x x
B A
= ) ( ) (



30
Subset: A is a subset of B, that is, if and only if B A U x x x
B A
) ( ) (
Based on t-norms and t-conorms, we can further introduce some operation of
fuzzy sets that are central to fuzzy logic and fuzzy reasoning. Let A and B be fuzzy
sets in universal sets U and V, respectively.
Fuzzy conjunction: The fuzzy conjunction of A and B is denoted as B A and
defined by

norm t a is t where y x t y x
B A B A
=

)), ( ), ( ( ) , ( Eq. 2-10



Fuzzy disjunction: The fuzzy disjunction of A and B is denoted as B A and
defined by

conorm t a is s where y x s y x
B A B A
=

)), ( ), ( ( ) , (

Eq. 2-11

If we consider that t is an algebraic product, s is an algebraic sum we can define
a special case of the above operations:
), ( ) ( ) , ( y x y x
B A B A
=


). ( ) ( ) ( ) ( ) , ( y x y x y x
B A B A B A
+ =


and if t is min operator, s is max operator, than we have
)), ( ), ( min( ) , ( y x y x
B A B A
=


)). ( ), ( max( ) , ( y x y x
B A B A
=


For representation of the membership functions we can use the following
parametric functions.
Triangle membership function: Triangle membership function is a function with
tree parameters defined by

) 0 ), , max(min( ) , , ; (
b c
x c
a b
a x
c b a x triangle

=

Eq. 2-12




31
In the Figure 2-24(a) shows the triangle membership function with parameters
( ) 80 , 60 , 20 , x

x ) (x

( )








FIGURE 2-24 Membership functions: (a) Triangle (b) Trapezoid

Trapezoid membership function Trapezoid membership function is a function
with four parameters defined by

) 0 ), , 1 , max(min( ) , , , ; (
c d
x d
a b
a x
d c b a x trapezoid

=
Eq. 2-13

In the Figure 2-24(b) shows the trapezoid membership function with parameters
( ) 95 , 60 , 20 , 13 , x
1.0
0 20 50 80
x
(a)
1.0
0 10 50 95
x
(b)



32
MF
0
c-a
1.0
0.5
x
c c+a
2a
Slope =-b/2a


FIGURE 2-25 Bell membership function

According to this picture is clear that the triangle membership function is a
special form of the trapezoid membership function. Both these forms are often used in
real time implementation.
Gauss membership function: Gauss's membership function is a function with
two parameters defined by
2
) (
) , ; (

c x
e c x gaussian

=

Eq. 2-14

Where c is the center and is the weight of membership function.
Bell membership function: Bell membership function is a function with two
parameters defined by

b
a
c x
c b a x bell
2
1
1
) , , ; (

+
=
Eq. 2-15




33
Where parameter b is usually positive. The values of all parameters are described in
Figure 2-25. This function has about one parameter more than Gaussian membership
function. If fuzzy set is changed to classical set. a
Sigmoid membership function: Sigmoid membership function is a function with
two parameters defined by

) (
1
1
) , ; (
c x a
e
c a x sigmoid

+
= Eq. 2-16

Where parameter a influences the sharpness of function at the point where a=c. If
a>0, the function is open on the right site, on the other hand, if a<0 the function is
open on left site and therefore this function can be use for describing conceptions like
"very big" or "very small''. Sigmoid function is very often used in Neural Network
like update functions.
2.4.2 Fuzzy If-Then Rules
Fuzzy sets and fuzzy operators are the subjects and verbs of fuzzy logic. These
if-then rule statements are used to formulate the conditional statements that comprise
fuzzy logic.
A single fuzzy if-then rule assumes the form
If x is A then y is B
where A and B are linguistic values defined by fuzzy sets on the ranges
(universes of discourse) X and Y, respectively. The if-part of the rule "x is A" is called
the antecedent or premise, while the then-part of the rule "y is B" is called the
consequent or conclusion.
An example of such a rule might be

If service is good then tip is average

Note that good is represented as a number between 0 and 1, and so the
antecedent is an interpretation that returns a single number between 0 and 1. On the
other hand, average is represented as a fuzzy set, and so the consequent is an
assignment that assigns the entire fuzzy set B to the output variable y. In the if-then



34
rule, the word "is" is used in two entirely different ways, depending on whether it
appears in the antecedent or the consequent.
If-then rules have been used extensively in both modeling and control through
the use of linguistic labels in membership functions. A fuzzy if-then rule can easily
capture the spirit of a "rule of thumb" used by humans. From another angle, due to the
qualifiers on the premise parts, each fuzzy if-then rule can be viewed as a local
description of the system under consideration. Fuzzy if-then rule forms a core part of
the fuzzy inference system which is going to be introduced below.
2.4.3 Fuzzy Inference Systems











Decision making Unit
(fuzzy) (fuzzy)
Knowledge base
Database Rule base
Defuzzification
Interface
Fuzzification
Interface
(crisp)
(crisp)
Input
Output

FIGURE 2-26 Fuzzy Inference System

Fuzzy Inference Systems are, also called as fuzzy-rule-based systems, fuzzy
models. Basically a fuzzy inference system is composed of five functional block
described in Figure 2-26.
- A rule base containing a number of fuzzy if-then rules;
- A database which defines the membership functions of the fuzzy sets used in
the fuzzy rules;
- A decision-making unit which performs the inference operations on the rules;
- A fuzzification interface which transforms the crisp inputs into degrees of
match with linguistic values;



35
- A defuzzification interface which transforms the fuzzy results of the inference
into a crisp output.
Usually, the rule base and the database are jointly referred to as the knowledge
base.
The steps of fuzzy reasoning (inference operations upon fuzzy if-then rules)
performed by fuzzy inference systems are:
- Compare the input variables with the membership functions on the antecedent
part to obtain the membership values of each linguistic label. (This step is often called
fuzzification).
- Combine (through a specific t-norm operator, usually multiplication or min)
the membership values on the premise part to get firing strength (weight) of each rule.
- Generate the qualified consequents (either fuzzy or crisp) or each rule
depending on the firing strength.
- Aggregate the qualified consequents to produce a crisp output. (This step is
called defuzzification.)

2.5 Neural Fuzzy Systems
The happy marriage of the techniques of fuzzy logic system and neural
networks suggest the novel idea of transforming the burden of designing fuzzy logic
control and decision systems to the training and learning of connectionist neural
networks.
Fuzzy systems and neural networks are both numerical model-free estimators
and dynamical systems. They both time the ability to improve the intelligence of
systems working in uncertain, imprecise, and noisy environments.
Although fuzzy system and neural networks are formally similar, there are also
significant differences between them.
Neural networks have a large number of highly interconnected processing
elements which demonstrate the ability to learn and generalize from training patterns
or data. Fuzzy systems, on the other hand, base their decisions on inputs in the form
of linguistic variables derived from membership functions which are formulae used to
determine the fuzzy set to which a value belongs and the degree of membership in
that set.



36
Basically, fuzzy systems estimate functions with fuzzy set samples, while neural
networks use numerical-point samples.
Neural networks are trainable dynamical systems whose learning, noise-
tolerance, and generalization abilities grow organically out of their connectionist
structure, their dynamics, and their distributed data representation.
Fuzzy systems are structured numerical estimators. They start from highly
formalized insights about the psychology of categorization and the structure of
categories found in the real world and then articulate fuzzy IF-THEN rules as a kind
of expert knowledge.

2.6 Stock Forecasting Problem and Related Works
Stock is ownership in a company, with each share of stock representing a piece
of ownership. The more shares you own, the more of the company you own, and the
more dividends you earn when the company makes a profit. In the financial world,
ownership is called equity. Businesses issue stocks to raise money. They use this
money to finance expansions, pay for equipment and fund projects, etc. Corporations
issue stocks when they may need additional capital to operate successfully.
A stock market is a market for buying and selling stocks. Stock exchanges are
the physical locations where stocks are bought and sold. The Over-The-Counter
(OTC) market refers to a market in which transactions are conducted through a
telephone and computer network connecting dealers in stocks and bonds, rather than
on the floor of an exchange. Exchanges are located all over the world, with the most
famous one being the New York Stock Exchange.
Most investors have to cope from time to time with the most common questions:
Should I buy this stock? Is it time to sell my position in a stock? What will prices be
tomorrow, next month or next year? In fact, forecasting the future price of a given
stock and know when to enter and exit from a particular position in a given stock are
the most difficult problems that most investor, trader, or other practitioners face when
they get involved in the stock market.
Many researchers have been seeking, and continue constantly to seek, for
methods to forecast the future stock price and determine the market timing.



37
A problem of forecasting future price of a given stock is the problem of time
series forecasting. A time series is a sequence of data points, measured typically at
successive times, spaced apart at uniform time intervals. Time series forecasting is a
forecasting method that uses a set of historical values to predict an outcome in the
future. These historic values, often referred to as a time series, are spaced equally over
time and can represent anything from stock price data or daily electricity consumption
to hourly call volumes.
Time series forecasting assumes that a time series is a combination of a pattern
and some random error. The goal is to separate the pattern from the error by
understanding the pattern's trend, its long-term increase or decrease, and its
seasonality, the change caused by seasonal factors such as fluctuations in use and
demand.
Traditionally, statistical models were used to solve the problem of time series
forecasting. Some of these statistical models are given below:
- Moving Average Models: The future value to be forecasted is based on the
average of N previous periods. It is a moving average because the oldest data points
are dropped off as new ones are added. It is applied in finance and especially in
technical analysis. It can also be used as a generic smoothing operation, in which case
the raw data need not be a time series. A moving average series can be calculated for
any time series. In finance it is most often applied to stock prices, returns or trading
volumes. Moving averages are used to smooth out short-term fluctuations, thus
highlighting longer-term trends or cycles. The threshold between short-term and long-
term depends on the application, and the parameters of the moving average will be set
accordingly.
- AutoRegressive Integrated Moving Average (ARIMA) models: ARIMA
modeling has three components [Frank, 1993]. In the model identification stage, the
forecaster must decide whether the time series is autoregressive, moving average, or
both. This is usually done by visually inspecting diagrams of the data or employing
various statistical techniques. In the second stage, using model estimation and
diagnostic checks, the forecaster will verify whether the original model identification
is correct. This requires subjecting the model to a variety of diagnostics. If the model
checks out, the forecaster then proceeds to the third stage, forecasting. The principle



38
advantage of using the ARIMA approach is that the method can generate confidence
intervals around the forecasts. This actually serves as another check of validity of the
model. If it predicts a high degree of confidence about a dubious forecast, the modeler
may have to respect the form of the model. A number of variations on the ARIMA
model are commonly used. Sometimes a seasonal effect is suspected in the model. In
this case it is often considered better to use a Seasonal ARIMA (SARIMA) model
than to increase the order of the autoregressive or moving average parts of the model.
However, these models have not succeeded to accurately forecast financial series
because of their linear structures and other inherent limitations [3].
- Autoregressive Conditional Heteroskedasticity/Generalized Autoregressive
Conditional Heteroskedasticity (ARCH/GARCH) models: ARCH models, [Engle,
1982] model considers the variance of the current error term to be a function of the
variances of the previous time period's error terms. ARCH relates the error variance to
the square of a previous period's error. It is employed commonly in modeling
financial time series that exhibit time-varying volatility. ARCH models could
efficiently and quite easily represent the typical empirical findings in financial time
series. These models can deal with the non-constant variance, but some series can not
predict accurately [4].
During the last few years, neural network and fuzzy logic methods have been
proposed for obtaining accurate prediction results.
In [5], the authors attempt to model and predict the direction of return on market
index of the Taiwan Stock Exchange, one of the fastest growing financial exchanges
in Asian developing countries. The probabilistic neural network (PNN) is used to
forecast the direction of the index return after it is trained by historical data. Empirical
results show that the PNN-based investment strategies obtain higher returns than other
investment strategies examined in this study.
The ability of neural networks to integrate fundamental and technical analysis
for financial performance prediction, specifically, the backpropagation algorithm, also
investigated in [6,11]. There has been many other researches show the ability of
neural networks to predict the price or the price movements of stock [6,7,14].
However, common neural networks suffer from a black box syndrome and involve
difficulties to deal with qualitative information.



39
Fuzzy logic may be used for stock market forecasting either independently or
hybridized with other methods [8,9,10]. In [12], the authors applied fuzzy
technologies to investments through technical analysis. The authors used three
technical indicators, cumulative volume, relative strength, and moving average to
build their trading model. According to their analysis, the decision to choose the
trigger levels for sell and buy depends on the investor and the stocks long-term trend.
Because of this, different strategies can be implemented using the fuzzy indicator to
match the investor preferences and the industry conditions. The results were excellent
as shown.
However, limitations with the fuzzy logic method still remain. They are the
requirements of expert knowledge prior to designing fuzzy methods for forecasting.
Fuzzy neural networks have recently been an active area of research. In [13], a case
study describes a comparison of fuzzy neural networks and the classical approach
during the stock market crashes of 1987 and 1998. It can be found that rules generate
a more stable prediction quality, while the performance is not as good as when using
classical neural networks. The case study lead to the result that fuzzy neural networks
can outperform classical approaches in extreme situations, while in standard situations
the latter models have higher prediction quality. In [14], fuzzy time series models
have been applied to handle nonlinear problems. To forecast fuzzy time series, the
study applies a backpropagation neural network because of its nonlinear structures.
The authors propose two models: a basic model using a neural network approach to
forecast all of the observations, and a hybrid model consisting of a neural network
approach to forecast the known patterns as well as a simple method to forecast the
unknown patterns. The stock index in Taiwan for the years 19912003 is chosen as
the forecasting target. The empirical results show that the hybrid model outperforms
both the basic and a conventional fuzzy time series models.

2.7 Summary
The candlestick theory provides a useful way to make investment decisions
based on identified candlestick patterns. By trading experiences, the investor tries to
identify the candlestick patterns to make the investment decisions such as to buy, sell,
or hold the stock. Identifying the patterns from a large amount of trading data,



40
however, is time consuming. Moreover, the investors might have different
interpretations of the candlestick patterns.
In order to reduce the vagueness and impreciseness in identifying and
interpreting candlestick patterns, we proposed a combined approach using fuzzy and
neural network to automatically find candlestick patterns from trading data.
In fact, fuzzy logic and neural networks are effective complementary
technologies. Neural networks extract information from system to be learned or
controlled, while fuzzy logic techniques most often use verbal and linguistic
information from experts. This is a promising approach to obtain the benefits of both
fuzzy system and neural networks.
CHAPTER 3
METHODOLOGY

In this chapter, the proposed forecasting model, the way to fuzzify candlestick
patterns, forecasting steps, and the graphical user interface (GUI) design are
explained. Section 3.1 presents the proposed forecasting model. Section 3.2 describes
the way to model fuzzy candlestick patterns. The steps to forecast and the evaluating
method of the experimental results will be respectively presented in Section 3.3 and
Section 3.4. Finally, Section 3.5, will show the applications interface.

3.1 The Proposed Forecasting Model



(O













FIGURE 3-1 Forecasting framework using candlestick fuzzy neural networks
Historical Data
pen, High, Low,
Close)

(Open, High,
Low, Close)

Neural
Network

Candlestick
Formulation

Fuzzy
Logic
Predicted Output
(Close)
(b) Operating

Neural
Network

Candlestick
Formulation

Fuzzy
Logic
Output

(a) Learning

+
-
Adjust Measure
error
Target

42
Figure 3-1 shows the proposed forecasting model. The model consists of two
processes: learning and operating process. Both processes will be presented in the
following.
3.1.1 Candlestick Formulation
In both learning and operating processes, as shown in Figure 3-1(a) and in
Figure 3-1(b), the historical data of stock prices such as HIGH, OPEN, CLOSE, LOW
is fed into Candlestick Formulation Box as input.
A candlestick pattern is composed of one or more candlestick lines and the trend
before the pattern. Each candlestick line has the parameters: length of upper shadow,
length of lower shadow, length of body, color, open style and close style. The length
of upper shadow, length of lower shadow, length of body and color are directly
calculated from HIGH, OPEN, CLOSE, LOW prices. The open style and close style
are formed by the relationship between a candlestick line and its previous candlestick
line.
3.1.2 Fuzzy Logic
Because the parameters of candlestick lines created from Candlestick
Formulation Box are numerical data, they need to be fuzzified first in order to transfer
the time series date into fuzzy linguistic variables.
3.1.3 Neural Network
The fuzzified parameters of candlestick lines from Fuzzy Logic Box are used as
inputs to let the neural network learn candlestick patterns. The learning process is
shown in Figure 3-1(a). The learning algorithm may vary depending on the network
architecture. In our study, the most common learning algorithm, back propagation
algorithm, is used. The backpropagation is the process of backpropagating errors from
the output towards the input during learning. The learning process occurs until the
errors are sufficiently small to be accepted. Once the neural network has been learnt,
it has the ability to recall patterns if the testing inputs are fed into. The operating
process, as shown in Figure 3-2(b) is used to test the performance of the network. The
testing inputs created by Candlestick Formulation Box and Fuzzy Logic Box are fed
into the network. The predicted output will be the stock price of next day.


43
3.2 Fuzzifying Candlestick Patterns
According to the proposed forecasting model in the Section 3.1, to create fuzzy
candlestick patterns, we need to model the following parts: 1) Candlestick lines; 2)
The relationship between two candlesticks; and 3) Variation percentage between two
CLOSEs.
3.2.1 Candlestick Lines
In a candlestick chart, the lengths of the shadow and the body play an important
role to identify a candlestick pattern and to determine the efficiency of the candlestick
pattern. The description of a candlestick line is imprecise and vague like long, middle,
or short. There is no crisp value to define the length of body and shadow.
Four fuzzy linguistic variables, EQUAL, SHORT, MIDDLE, and LONG, are
defined to indicate fuzzy sets of the shadows and the body length. Figure 3-2 shows
the membership function ) (x of the linguistic variables.










5.5 6

14
x
Real length of
body or shadow
(percentage)
1
) (x
EQUAL SHORT MIDDLE
LONG


FIGURE 3-2 The membership function of the length of the body and shadow

The ranges of body and shadow length are set to (0, p) to represent the
percentage of the fluctuation of stock price. In Figure 3-2, we set the varying
percentages of the stock prices up to 14 percent.
In Figure 3-2, the x axis indicates the real length of body or shadow, and the unit
of x axis is percentage. The crisp input value of membership function can be
calculated by the following equations:
1 2 3 4 5 0 0.5 1.5 2.5 3.5 4.5

44
L
body
= {[max (OPEN, CLOSE) min (OPEN, CLOSE)]/OPEN} x 100
L
upper shadow
= {[HIGH max (OPEN, CLOSE)]/OPEN} x 100
L
lower shadow
= {[min (OPEN, CLOSE) - LOW]/OPEN} x 100
The character L of the equation indicates the length of the upper shadow,
lower shadow, or body. The terms like OPEN, CLOSE, HIGH, and LOW are
the prices in an interesting time period.
The LONG fuzzy set is defined by the following left linear membership
function. The parameters (a, b) are equal to (3.5, 5).

>

<
=
b x
b x a
a b
a x
a x
b a x linear left
1
0
) , : ( _

Eq. 3-1


The membership function of SHORT and MIDDLE is a trapezoid function and
the following equation (Eq. 3-2) is used. Four parameters (a, b, c, d) of this function
to describe the linguistic variables SHORT and MIDDLE are (0, 0.5, 1.5, 2.5) and
(1.5, 2.5, 3.5, 5).

<

<
<

<
=
d x
d x c
c d
x d
c x b
b x a
a b
a x
a x
d c b a x trapezoid
0
1
0
) , , , : (


Eq. 3-2


A right linear membership function is used to model the EQUAL fuzzy set and
is defined by the following formula (Eq. 3-3). The parameters (a, b) are equal to (0,
0.5).


45

>

<
=
b x
b x a
a b
x b
a x
b a x linear right
0
1
) , : ( _

Eq. 3-3


The body color is also an import feature of a candlestick line and can be simply
defined by three terms BLACK, WHITE, and DOJI. A DOJI term is defined to
describe the situation where open price equals close price. In this case, the height of
the body is 0, and the shape is represented with a horizontal bar. The definition of
body color is defined as follows:
If OPEN - CLOSE >0 then BODY_COLOR = BLACK
If OPEN - CLOSE < 0 then BODY_COLOR = WHITE
If OPEN - CLOSE = 0 then BODY_COLOR = DOJI
3.2.2 Fuzzifying the Candlestick Lines Relationships
Defining the length of body and shadow of a candlestick line is not enough to
model the candlestick line. Modeling the length of the body and shadow only
determines the shape of a candlestick line. The relationship between a candlestick line
and its previous candlestick line should be defined to place a candlestick line in a
correct position. Two features are defined to model the candlestick line relationships:
the open style and the close style. The related positions of the open and close price to
the previous candlestick line are used to model the open style and the close style.
Figure 3-3 shows the membership function of the linguistic variables of the open style
and close style. The candlestick line at the bottom of Figure 3-3 is the candlestick line
of previous trading day. The unit of x axis is the trading prices of the previous day and
the unit of y axis is the possibility value of the membership function.

46












Previous
candlestick line
LOW HIGH Max (OPEN,
CLOSE)
Min (OPEN,
CLOSE)
Lower Shadow Upper Shadow
Real Body
1
EQUAL_LOW EQUAL_HIGH
EQUAL
x
) (x
HIGH LOW
Prices of
previous
day

FIGURE 3-3 The membership function of the open and close styles

Five linguistic variables are defined to represent open style relationships: OPEN
LOW, OPEN EQUAL_LOW, OPEN EQUAL, OPEN EQUAL_HIGH, and OPEN
HIGH, and five linguistic variables are defined to represent close style relationships:
CLOSE LOW, CLOSE EQUAL_LOW, CLOSE EQUAL, CLOSE EQUAL_HIGH,
and CLOSE HIGH.
The function used to represent OPEN LOW and CLOSE LOW is the right linear
function.

>

<
=
b x
b x a
a b
x b
a x
b a x linear right
0
1
) , : ( _

Eq. 3-4



The left linear function is used to represent the fuzzy sets of OPEN HIGH and
CLOSE HIGH.


47

>

<
=
b x
b x a
a b
a x
a x
b a x linear left
1
0
) , : ( _

Eq. 3-5



The other fuzzy sets are described by the triangle function.

>
<

<
=
c x
c x b
b c
x c
b x a
a b
a x
a x
c b a x triangle
0
0
) , , : (

Eq. 3-6



The parameters for the linguistic variables of open and close style are
determined by the prices of the previous candlestick line. For example, if the open
price in an interesting time period is equal to the price of min(open, close), then the
open style is OPEN EQUAL_ LOW, and if the close price is equal to the price
max(open, close), then the close style is CLOSE EQUAL_HIGH.
Combining the description of the candlestick line and the relationship between
candlestick lines, a candlestick line can be defined completely. The length of body
and shadow model the shape of a candlestick line, and the open style and close style
model the related position and causal relationship between the continual candlestick
lines. Candlestick lines are the basic elements of a candlestick pattern.
3.2.3 Fuzzifying the Variation Percentage between Two CLOSEs
The variation percentage between two CLOSE prices on time t and time t + n is
divided into the following fuzzy sets:
A
1
= (EXTREME DECREASE),
A
2
= (LARGE DECREASE),
A
3
= (NORMAL DECREASE),
A
4
= (SMALL DECREASE),
A
5
= (NO_CHANGE),
A
6
= (SMALL INCREASE),
A
7
= (NORMAL INCREASE),

48
A
8
= (LARGE INCREASE), and
A
9
= (EXTREME INCREASE)

3.3 Forecasting Steps
Using the candlestick pattern approach for stock forecasting and trading consists
of the following steps:
Step 1: Prepare historical data and define the range of the universe of discourse
(denoted as U) on which the historical data are and upon which the fuzzy sets will be
defined.
In this step, open, close, high, and low prices should be prepared. The variation
percentage between two close prices on time t and time t + n should be calculated by
using the following formula Eq.3-7 to derive the following trend.

100

+
t
t n t
Close
Close Close

Eq. 3-7


The terms Close
t + n
and Close
t
mean the close price on day t and n trading days
after day t. The unit of the following trend is percentage.
Step 2: Partition the universe of discourse U into several even and equal length
intervals.
Based on the variation calculated from the above formula, we find the minimum
variation D
min
and the maximum variation D
max
. Based on D
min
and D
max
define U as
U = [D
min
D
1
, D
max
+ D
2
] where D
1
and D
2
are suitable positive numbers.
For example: If D
min
= - 1.15 and D
max
= 1.83. We set D
1
= 0.85 and D
2
= 0.17,
so the U can be represented as U = [- 2, 2]. We partition the U into eight intervals,
where U
1
= [-2, -1.5]; U
2
= [-1.5, -1]; U
3
= [-1, 0.5]; U
4
= [-0.5, 0]; U
5
= [0, 0.5]; U
6
=
[0.5, 1]; U
7
= [1, 1.5]; U
8
= [1.5, 2];
Step 3: Define fuzzy sets on the U.
This step determines the linguistic variables represented by fuzzy sets to
describe the degree of variation between data of time t and time t + n. For example, if
we set the number of fuzzy sets to 9, the nine fuzzy sets considered could be:

49
A
1
= (EXTREME DECREASE),
A
2
= (LARGE DECREASE),
A
3
= (NORMAL DECREASE),
A
4
= (SMALL DECREASE),
A
5
= (NO_CHANGE),
A
6
= (SMALL INCREASE),
A
7
= (NORMAL INCREASE),
A
8
= (LARGE INCREASE), and
A
9
= (EXTREME INCREASE)
Step 4: Fuzzify the values of variation derived in Step 1. The values of variation
will be fuzzified in this step. If the number of variation on time is v, where v belongs
to U
x
, and if there is a value represented by fuzzy set A
y
in which the maximum
membership value occurs at u
x
, then v is translated to A
y
.
Step 5: Calculate the candlestick patterns. In this step, we will use the
definitions of the candlestick pattern proposed in Section 3.2 to calculate the
parameters of candlestick patterns. The data of open, close, high, and low prices will
be transformed into candlestick lines.
Step 6: Train with neural network
In this step, we create a two-layer feed-forward backpropagation network. The
first layer has 30 tansig neurons; the second layer has one purelin neuron. The
network is trained for 100 epochs. We train a neural network with the following
inputs and outputs:
- Network Inputs: Color; L
Upper
; L
Lower
; L
Body
; S
Open
; S
Close
- Network Targets: Fuzzy outputs of degrees of variation between data of time t
and time t + n
Step 7: Interpret forecasted outputs
In this step, we translate fuzzy outputs into numbers in order to get the price of
the next day. The next day price is calculated based on the fuzzy outputs and the
average of midpoints of each interval according to the following formula:

50

1
100
i i i
c
Forecast Close Close
+

= +



Eq. 3-8


where c = the average of midpoints of each interval

3.4 Evaluating the Experimental Results
In order to evaluate the forecasting results and compare them using neural
networks, the forecasting results are evaluated by the mean square error (MSE)
defined as follows:

2
1
1
( )
n
i i
i
MSE y y
n
=
=

)

Eq. 3-9

where
i
y
)
is the forecasting close value and
i
y is the actual close value.

3.5 GUI Design for Forecasting System
The GUI of the stock forecasting application using candlestick analysis and
fuzzy neural network is shown below in Figure 3-4.

Application Application
File Data View Analysis
Traning Data DI S 1996-1998 Plot Data Plot Candlestick Data

FIGURE 3-4 GUI Design of stock forecasting application

51
3.5.1 Data Tools
The system allows users import data from Matlab data files. The data tools
consist of Open Train Data and Open Test Data.
From the main interface, we can access to these tools by clicking Data > Open
Test Data or Data > Open Train Data. The Open Train/Test Data interface is shown in
Figure 3-5.

Load a MAT-file or an ASCII data file Load a MAT-file or an ASCII data file
Open
Cancel
MAT-files (*.mat)
Code
File name:
Files of Type:
Look in:


FIGURE 3-5 The Open Train/Test Data Interface

3.5.2 Analysis Tools
The main functions are Analysis with neural network and Analysis with fuzzy
neural network. From the main interface, we can access to these functions by clicking
Analysis > Neural Network or Analysis > Fuzzy and Neural Network (as shown in
Figure 3.6).





52
Application Application
File Data View Analysis
Traning Data DIS 1996-1998
Plot Data Plot Candlestick Data
Neural Network
Fuzzy and Neural Network


FIGURE 3-6 The Analysis Tool Interface

3.5.2 View Tools
In addition, the system also has plotting functions in order to plot bar chart and
candlestick chart from the given data.
The historical data from April 4, 2007 to April 16, 2007 of the Microsoft Corp.
company (MSFT) is used to illustrate the plotting functions of the system. The data is
shown in Table 3-1.


53
TABLE 3-1: The historical data from April 4, 2007 to April 16, 2007 of MSFT
Date Open (O) High (H) Low (L) Close (C)
4/4/2007 28.01 28.78 27.9 28.5
4/5/2007 28.32 28.65 28.3 28.55
4/9/2007 28.58 28.72 28.39 28.57
4/10/2007 28.5 28.64 28.22 28.4
4/11/2007 28.3 28.57 27.99 28.11
4/12/2007 28.06 28.62 28.04 28.54
4/13/2007 28.43 28.7 28.1 28.61
4/16/2007 28.6 28.75 28.21 28.73

The example figure of the bar chart is manually created from the historical of
data of MSFT shown in Figure 3-7.













27.6
27.8
28.0
28.2
28.4
28.6
28.8
29.0
Price
s
Apr 4
th
,
2007
Apr 5
th
,
2007
Apr 9
th
,
2007
Apr 10
th
,
2007
Apr 11
th
,
2007
Apr 12
th
,
2007
Apr 13
th
,
2007
Apr 16
th
,
2007
Date
O
H
L
C
The Highest price
The Lowest price
Open price
(on the left side)
Close price
(on the right side)

FIGURE 3-7 Plotting data in bar chart


54
The example figure of the bar chart is created from the historical of data of
MSFT by using the system shown in Figure 3-8.



FIGURE 3-8 Bar chart plotted by the system


55
The example figure of the candlestick chart is manually created from the
historical of data of MSFT shown in Figure 3-9.













27.6
27.8
28.0
28.2
28.4
28.6
28.8
29.0

Prices


Apr 4
th
,
2007
Apr 5
th
,
2007
Apr 9
th
,
2007
Apr 10
th
,
2007
Apr 11
th
,
2007
Apr 12
th
,
2007
Apr 13
th
,
2007
Apr 16
th
,
2007
Date
H
L
C
O
Open price
The Highest price
Close price
The Lowest price
Real body
Upper shadow
Lower shadow

FIGURE 3-9 Plotting data in candlestick chart


56
The example figure of the candlestick chart is created from the historical of data
of MSFT by using the system shown in Figure 3-10.



FIGURE 3-10 Candlestick chart plotted by the system

CHAPTER 4
RESULTS OF THE STUDY

This chapter discusses some of the results of the experimental simulations.
Section 4.1 presents the data used for the experiments. Section 4.2 presents the
experimental process. Section 4.3 presents sample results. Section 4.4 is the summary
of this chapter.

4.1 The Data for the Experiments
We use the historical data of the Walt Disney-Disney C. (DIS) company listed
on the New York Stock Exchange (NYSE) in the United State for the experiments.
The data are downloaded from the Yahoo financial data server
(http://finance.yahoo.com/). We use daily prices, OPEN, HIGH, LOW, and CLOSE,
of DIS with a set date range starting from March 29, 1996 to March 23, 1998 as a
training data. We also use daily prices, OPEN, HIGH, LOW, and CLOSE of DIS,
with a set date range starting from December 24, 2003 to October 12, 2004 as a
testing data. The training data and testing data are shown in Table B-1 and Table B-2
in the Appendix.

4.2 The Experiments
The aims of the experiments are to evaluate the effectiveness of the forecasting
method using candlestick technical analysis and fuzzy neural network.
In order to demonstrate the forecasting method proposed in the Chapter 3 of the
thesis, we take the training data of DIS from March 29, 1996 to March 23, 1998 as
examples to explain the forecasting method. The process is described as follows:
After performing Step 1 to Step 4, results are showed in Table 4-1 below.

58
TABLE 4-1 Training data, one day variations and fuzzy sets
Date Open High Low Close One day
variations
Fuzzy Sets
3/29/1996 64.5 64.87 63.88 63.88 1.5498
A
6
4/1/1996 64.25 64.87 64.25 64.87 0.97117
A
6
4/2/1996 65 65.62 65 65.5 0.18321
A
5
4/3/1996 65.5 65.62 65.25 65.62 -0.94483
A
4
4/4/1996 65.62 65.62 64.5 65 -0.96923
A
4
4/8/1996 65 65 63.63 64.37 -1.1496
A
4
4/9/1996 64.37 64.62 63.63 63.63 -4.3219
A
2
4/10/1996 63.5 63.5 60.75 60.88 -0.82129
A
4
4/11/1996 60.88 61.5 60.13 60.38 1.6562
A
6
4/12/1996 60.38 61.75 60.25 61.38 0.8146
A
6
4/15/1996 61.38 62.38 61.13 61.88 0.59793
A
5
4/16/1996 61.88 62.75 60.5 62.25 0.20884
A
5
4/17/1996 62.25 62.75 62.13 62.38 0.80154
A
6
4/18/1996 62.38 63.13 62.38 62.88 0.39758
A
5
4/19/1996 62.88 63.5 62.75 63.13 -0.79202
A
4
. .. .
3/9/1998 105.62 106.44 105.25 105.81 0.056705
A
5
3/10/1998 105.81 106.19 105.5 105.87 -1.0012
A
4
3/11/1998 105.56 105.56 104.37 104.81 1.0781
A
6
3/12/1998 104.81 106.31 104.56 105.94 0.056636
A
5
3/13/1998 105.94 107.87 105.06 106 3.4151
A
8
3/16/1998 106.19 110 106.19 109.62 -1.7606
A
4
3/17/1998 108.75 108.75 106.69 107.69 -0.35286
A
5
3/18/1998 107.5 107.5 106 107.31 -0.93188
A
4
3/19/1998 107.31 107.69 105.75 106.31 0.64905
A
5
3/20/1998 106.31 107 105.37 107 -3.7383
A
2
3/23/1998 105.75 105.75 102.75 103


The percentage variation between two close prices on time t and timet + n is
calculated using the following formula:
100

+
t
t n t
Close
Close Close


59
For example, with the close price of 3/29/1996 and the close price of 4/1/1996,
we can calculate an one day percentage variation between those consecutive days as
follows:
1.5498 100
63.88
63.88 - 64.87
100
1996 / 29 / 3
1996 / 29 / 3 1996 / 1 / 4
= =

Close
Close Close

After calculating the one day percentage variations from the training data, we
can find that U
min
=-6 and U
max
=6. We divide the universe of discourse into 9
intervals:
A
1
=(EXTREME DECREASE) =[-6, -4.6667]
A
2
=(LARGE DECREASE) =[-4.6667, -3.3333]
A
3
=(NORMAL DECREASE) =[-3.3333, -2]
A
4
=(SMALL DECREASE) =[-2, -0.66667]
A
5
=(NO_CHANGE) =[-0.66667, 0.66667]
A
6
=(SMALL INCREASE) =[0.66667, 2]
A
7
=(NORMAL INCREASE) =[2, 3.3333]
A
8
=(LARGE INCREASE) =[3.3333, 4.6667]
A
9
=(EXTREME INCREASE) =[4.6667, 6]
In next step, the candlestick patterns can be derived from the training data by
performing Step 5 of the proposed forecasting method. We take the candlestick
pattern on 4/1/1996 as an example to explain the process of creation candlestick
pattern.
- Color: We can see that the open price on 4/1/1996 is 64.25 which is lower than
the close price, 64.87, on that day. So the color of candlestick on 4/1/1996 is WHITE
- Open Style: The open price of 4/1/1996 is 64.25, which is within the low price
and the middle of body on 3/29/1996, according to the definition of the open style, the
fuzzy set EQUAL_LOW has the maximum membership value, and then the open
style of 4/1/1996 is translated to EQUAL_LOW.
- Close Style: The close price of 4/1/1996 is 64.87, which is similar to the high
of body on 3/29/1996, consequently, the close style of 4/1/1996 will be interpreted as
EQUAL_HIGH.
The length of the upper shadow of the candlestick line on 4/1/1996 can be
calculated as follows:

61
TABLE 4-2 Candlestick patterns derived from training data
Date Color Open Style Close Style L
Upper
L
Lower
L
Body
3/29/1996 BLACK EQUAL_HIGH EQUAL_LOW SHORT VERY_SHORT SHORT
4/1/1996 WHITE EQUAL_LOW EQUAL_HIGH VERY_SHORT VERY_SHORT SHORT
4/2/1996 WHITE EQUAL_LOW EQUAL_HIGH VERY_SHORT VERY_SHORT SHORT
4/3/1996 WHITE EQUAL_LOW EQUAL_HIGH VERY_SHORT VERY_SHORT VERY_SHORT
4/4/1996 BLACK EQUAL_HIGH EQUAL_HIGH VERY_SHORT SHORT SHORT
4/8/1996 BLACK EQUAL_HIGH EQUAL_LOW VERY_SHORT SHORT SHORT
4/9/1996 BLACK EQUAL_HIGH EQUAL_LOW VERY_SHORT VERY_SHORT SHORT
4/10/1996 BLACK EQUAL_HIGH EQUAL_LOW VERY_SHORT VERY_SHORT ABOVE_MIDDLE
4/11/1996 BLACK EQUAL_HIGH EQUAL_LOW SHORT VERY_SHORT SHORT
4/12/1996 WHITE EQUAL_LOW EQUAL_LOW SHORT VERY_SHORT ABOVE_SHORT
4/15/1996 WHITE EQUAL_LOW EQUAL_HIGH SHORT VERY_SHORT SHORT
4/16/1996 WHITE EQUAL_LOW EQUAL_HIGH SHORT ABOVE_SHORT SHORT
4/17/1996 WHITE EQUAL_LOW EQUAL_HIGH SHORT VERY_SHORT VERY_SHORT
4/18/1996 WHITE EQUAL_LOW EQUAL_HIGH VERY_SHORT VERY_SHORT SHORT
4/19/1996 WHITE EQUAL_LOW EQUAL_HIGH SHORT VERY_SHORT VERY_SHORT
. . ... ..
3/9/1998 WHITE EQUAL_LOW EQUAL_HIGH SHORT ABOVE_SHORT VERY_SHORT
3/10/1998 WHITE EQUAL_LOW EQUAL_HIGH SHORT VERY_SHORT VERY_SHORT
3/11/1998 WHITE EQUAL_LOW EQUAL_HIGH VERY_SHORT VERY_SHORT VERY_SHORT
3/12/1998 BLACK EQUAL_HIGH EQUAL_LOW VERY_SHORT VERY_SHORT SHORT
3/13/1998 WHITE EQUAL_LOW EQUAL_HIGH VERY_SHORT VERY_SHORT SHORT
3/16/1998 WHITE EQUAL_LOW EQUAL_HIGH ABOVE_SHORT SHORT VERY_SHORT
3/17/1998 WHITE EQUAL_LOW EQUAL_HIGH VERY_SHORT VERY_SHORT MIDDLE
3/18/1998 BLACK EQUAL_HIGH EQUAL_LOW VERY_SHORT SHORT SHORT
3/19/1998 BLACK EQUAL_HIGH EQUAL_LOW VERY_SHORT SHORT VERY_SHORT
3/20/1998 BLACK EQUAL_HIGH EQUAL_LOW VERY_SHORT SHORT SHORT
3/23/1998 WHITE EQUAL_LOW EQUAL_HIGH VERY_SHORT SHORT SHORT

In the next step, we will use neural network to train with inputs and targets as
follows:
- Network Inputs: Color; L
Upper
; L
Lower
; L
Body
; SOpen (Open Style); SClose
(Close Style).
- Network Targets: Fuzzy outputs of degrees of variation between data of timet
and time t + n.

62
4.3 The sample results
This section presents the results that are obtained by running the forecasting
algorithm presented in the previous section.
4.3.1 Results obtained from fuzzy neural method
In order to evaluate the forecasting results and compare them using neural
networks, the forecasting results are evaluated by the mean square error (MSE)
defined in the formula Eq.3-8 in the chapter 3.
The fuzzy neural methods MSE =2.8941



FIGURE 4-1 Previous CLOSE price vs. Predicted Price using Fuzzy Neural method

63


FIGURE 4-2 Training Performance of Fuzzy Neural method


64
4.3.2 Results obtained from neural network method
The neural methods MSE =98.5712



FIGURE 4-3 Previous CLOSE price vs. Predicted Price using Neural Network
method

65


FIGURE 4-4 Training Performance of Neural Network method

4.3.3 Comparisons
In Table 4-3, we compare the forecasting results of the proposed method (FNN)
with that of the feed-forward backpropagation neural network (NN) method through
different training data and testing data.

TABLE 4-3 A comparison of the forecasted results with different tests
Tests FNN NN
Training Data: Wal Disney (DIS) from 1996 to 1998 1.2319 1.3988
Testing Data: Wal Disney (DIS) from 2003 to 2004 2.8941 98.5712
Training Data: AT&T Inc. (T) from 2001 to 2004 0.0727 0.8903
Testing Data: AT&T Inc. (T) from 2006 to 2007 0.5229 1.8773
Training Data: EBAY Inc. (EBAY) from 2000 to 2002 0.0227 9.7621
Testing Data: EBAY Inc. (EBAY) from 2004 to 2006 0.2211 57.4787
Training Data: DELL Inc. (DELL) from 2000 to 2004 0.0563 2.9058
Testing Data: DELL Inc. (DELL) from 2006 to 2007 0.2269 6.9058
Training Data: Motorola Inc. (MOT) from 2000 to 2002 0.1390 5.2999

66
TABLE 4-3 (CONTINUED)
Tests FNN NN
Testing Data: Motorola Inc. (MOT) from 2006 to 2007 0.3373 15.4256
Training Data: SUN MICROSYS Inc. (SUNW) from 1998 to 2001 0.0131 15.9388
Testing Data: SUN MICROSYS Inc. (SUNW) from 2003 to 2005 0.0263 340.6893
Training Data: S&P DEP RECEIPTS (SPY) from 2000 to 2002 0.1793 1.0156
Testing Data: S&P DEP RECEIPTS (SPY) from 2005 to 2007 1.1291 3.0534
Training Data: Dendreon Corp. (DNDN) from 2003 to 2004 0.1219 0.1293
Testing Data: Dendreon Corp. (DNDN) from 2006 to 2007 0.7087 13.5410
Training Data: Apple, Inc. (AAPL) from 1999 to 2002 0.4522 10.9231
Testing Data: Apple, Inc. (AAPL) from 2006 to 2007 2.8737 12.9557
Training Data: Applied Materials Inc. (AMAT) from 2000 to 2002 0.3028 6.0176
Testing Data: Applied Materials Inc. (AMAT) from 2006 to 2007 5.1501 13.8126
Average MSE (for tests) 14.0902 564.3106

From Table 4-3, we can see that the MSE of the forecasting results of the
proposed method is smaller than that of the neural network method. That is, the
proposed method can get a higher forecasting accuracy rate for forecasting stock
prices than the neural network method.

4.4 Summary
According to experimental results, we see that the MSE of the forecasting
results of the proposed method is smaller than that of the neural network method. That
is, the proposed method can get a higher forecasting accuracy rate for forecasting
stock future prices than the neural network method. The average forecasting error of
this method is smaller and more acceptable than using neural network. Moreover,
candlestick interpretation can be utilized from the beginning to the end of the
forecasting process.





CHAPTER 5
CONCLUSION

In this chapter, the experiment results and a proposal for further research are
presented. Section 5.1 concludes the gained results and the effect of the proposed
methodology. Section 5.2 suggests further works in order to improve the accuracy of
the proposed predicting method.

5.1 Conclusions
In this study, we proposed an algorithm based on technical analysis and neural
fuzzy network for stock forecasting and trading.
Our experimental results suggested that the proposed model has been successful
in satisfying the objectives in our proposal.
Technical analysis with candlestick is one of the most widely used techniques
and definitely viable and effective for stock and commodity market timing and
analysis. Like bar charts patterns in Western techniques, candlestick patterns can be
used to forecast the market. Because of their colored bodies, candlesticks provide
greater visual detail in their chart patterns than bar charts. The investors can make
investment decisions identifying and interpreting candlestick patterns in candlestick
charts.
There are two main disadvantages when applying the candlestick theory. The
first, the identification and interpretation of candlestick patterns from a large amount
of trading data is time consuming. Second, there are no crisp and standard definitions
to the candlestick patterns. Most candlestick patterns have been defined by
experienced investors from one generation to another. Therefore, selecting an
effective pattern from a number of imprecise and vague candlestick patterns requires
many years of experience to a human. The imprecise and vague definitions of the
candlestick patterns also make the automated searching, mining, and processing of
candlestick patterns using computer software difficult.

68
In our proposed method, the imprecise and vague candlestick patterns are
represented by fuzzy linguistic variables. The fuzzy candlestick patterns are combined
fuzzy neural networks in order to improve the accuracy of the forecasted results.

5.2 Future Works
There are several ways to continue this research.
5.2.1 The system should be able to connect to online data feed servers to get
online prices for forecasting and trading stock.
5.2.2 The system should allow users to define the number of days in the step of
calculating the percentage variations between two CLOSE prices.
5.2.3 The system should provide more chart tools for displaying candlestick
charts to help experienced investors compare their own forecasting results with the
results predicted by the computer.



REFERENCES

1. Robert D. Edwards and J ohn Magee. Technical Analysis and Stock Trends.
American Management Association, Seventh Edition, 1997.
2. www.wiley-rtf.reuters.com and other websites from the Internet.
3. Box and J enkins. Time Series Analysis: Forecasting and Control. Holden-Day.
San Francisco, CA, 1970.
4. Robert F. Engle. Autoregressive Conditional Heteroscedasticity with Estimates of
Variance of United Kingdom Inflation. Econometrica 50. (1982): 987-1008.
5. An-Sing Chena, Mark T. Leungb, and Hazem Daoukc. Application of neural
networks to an emerging financial market: forecasting and trading the
Taiwan Stock Index. Computers & Operations Research 30. (2003): 901-
923.
6. J ingtao Yao, Chew Lim Tan, and Hean-Lee Poh. Neural network for technical
analysis: A study on KLCI, International J ournal of Theoretical and Applied
Finance. School of Computing, National University of Singapore, Lower
Kent Rigde Road, Singapore 119260.
7. Clarence N. W. Tan. Trading a NYSE-Stock with a Simple Artificial Neural
Network-based Financial Trading System. Artificial Neural Networks and
Expert Systems. (1993).
8. G. Armano, M. Marchesi, and A. Murru. A hybrid genetic-neural architecture for
stock indexes forecasting. Information Sciences 170. (2005): 3-33.
9. Ray Tsaih, Yenshan Hsu and Charles C. Lai. Forecasting S&P 500 stock index
futures with a hybrid AI system. Decision Support Systems 23. (1998): 161-
174.
10. Abraham, A. Nath and Mohanthi. Hybrid intelligent systems for stock market
analysis. Computational Science - ICCS 2001: International Conference.
San Francisco, CA, USA, May 28-30, 2001, Proceedings, Part II: 337-345.

70
11. Monica Lam. Neural network techniques for financial performance prediction:
integrating fundamental and technical analysis. Decision Support Systems
37. (2004): 567 581.
12. Hussein Dourra and Pepe Siy. Investment using technical analysis and fuzzy
logic. Fuzzy Sets and Systems. (2002): 127.
13. Martin Rast. Forecasting with Fuzzy Neural Networks: A Case Study in Stock
Market Crash Situations. Fuzzy Information Processing Society. (1999).
14. Kunhuang Huarng and Tiffany Hui-Kuang Yu. The application of neural
networks to forecast fuzzy time series. Physic A 363. (2006): 481- 491.
15. StockCharts.com's Chart School. Dow Theory.
http://stockcharts.com/education/MarketAnalysis/dowtheory1.html, March
2007.
16. http://en.wikipedia.org/wiki/Munehisa_Homma, March 2007.



















APPENDIX A

CANDLESTICK PATTERNS















72
1. Bullish Reversal Patterns
1.1 Bullish three inside up



FIGURE A-1 Bullish three inside up

Definition:
The Bullish Three Inside Up Pattern is another name for the Confirmed Bullish
Harami Pattern. The third day is the confirmation of the bullish trend reversal.
Recognition Criteria:
- The market is characterized by downtrend.
- A Bullish Harami Pattern can be seen in the first two days.
- Then we see a white candlestick on the third day with a higher close than the
second day.
Explanation:
The first two days of this pattern is simply the Bullish Harami Pattern, the third
day confirms the reversal suggested by the Bullish Harami Pattern, since it is a white
candlestick closing with a new high for the last three days.
Important Factors:
The reliability of this pattern is very high, but still a confirmation in the form of
a white candlestick with a higher close or a gap-up is suggested.







73
1.2 Bullish three outside up



FIGURE A-2 Bullish three outside up

Definition:
The Bullish Three Outside Up Pattern is simply another name for the Confirmed
Bullish Engulfing Pattern. The third day is confirmation of the bullish trend reversal.
Recognition Criteria:
- The market is characterized by downtrend.
- A Bullish Engulfing Pattern can be seen in the first two days.
- The third day is a white candlestick with a higher close than the second day.
Explanation:
The first two days of this three-day pattern is simply a Bullish Engulfing
Pattern, and the third day confirms the reversal suggested by the Bullish Engulfing
Pattern since it is a white candlestick closing with a new high for the last three days.
Important Factors:
The reliability of this pattern is very high, but still a confirmation in the form of
a white candlestick with a higher close or a gap-up is suggested.

60
0 100
64.25
64.87 - 64.87
100
) , max(
1996 / 1 / 4
1996 / 1 / 4 1996 / 1 / 4 1996 / 1 / 4
) 1996 / 1 / 4 (
= =

=
open
close open high
L
Upper


Because L
Upper
on 4/1/1996 equals 0 by the definition of the upper shadow, the
fuzzy set VERY_SHORT has the maximum membership value, consequently, the
upper shadow of 4/1/1996 is translated to VERY_SHORT.
The length of the lower shadow of the candlestick line on 4/1/1996 can be
calculated as follows:
0 100
64.25
64.25 - 64.25
100
) , min(
1996 / 1 / 4
1996 / 1 / 4 1996 / 1 / 4 1996 / 1 / 4
) 1996 / 1 / 4 (
= =

=
open
low close open
L
Lower

Because L
Lower
on 4/1/1996 equals 0 by the definition of the lower shadow, the
fuzzy set VERY_SHORT has the maximum membership value, consequently, the
upper shadow of 4/1/1996 is translated to VERY_SHORT.
The length of the body of the candlestick line on 4/1/1996 can be calculated as
follows:

964 . 0 100
64.25
64.25 - 64.87
100
) , min( ) , max(
1996 / 1 / 4
1996 / 1 / 4 1996 / 1 / 4 1996 / 1 / 4 1996 / 1 / 4
) 1996 / 1 / 4 (
= =

=
open
close open close open
L
Body


Because L
Body
on 4/1/1996 equals 0.964 according to the definition of the body
shadow, the fuzzy set SHORT has the maximum membership value, consequently, the
upper shadow of 4/1/1996 is translated to SHORT.
The results of the calculated candlestick patterns from the training data can be
shown in the following table.







74
1.3 Bullish three white soldiers



FIGURE A-3 Bullish three white soldiers

Definition:
The Bullish Three White Soldiers Pattern is indicative of a strong reversal in the
market. It is characterized by three long candlesticks stepping upward like a staircase.
The opening of each day is slightly lower than the previous close rallying to a short
term high.
Recognition Criteria:
- The market is characterized by downtrend.
- Three consecutive long white candlesticks can be seen.
- Each candlestick closes at a new high.
- The opening of each candlestick is within the body of the previous day.
- Each consecutive day closes near or at its highs.
Explanation:
The Bullish Three White Soldiers Pattern appears in a context where the market
stayed at a low price for too long. The market is still falling down and it is now
approaching a bottom or is already at the bottom. Then we see a decisive attempt
upward shown by the long white candlestick. Rally continues in the next two days
characterized by higher closes. Bears are now forced to cover short positions.
Important Factors:
- The opening prices of the second and third day can be anywhere within the
previous day's body. However, it is better to see the opening prices above the middle
of the previous day's body.
- If the white candlesticks are much extended, one should be cautious about an
overbought market.






75
- The reliability of this pattern is very high, but still a confirmation in the form
of a white candlestick with a higher close or a gap-up is suggested.
1.4 Bullish concealing baby swallow



FIGURE A-4 Bullish concealing baby swallow

Definition:
This pattern is highlighted by two consecutive Black Marubozu. They are
characterized by the fact that a gapping black candlestick trades into the body of the
previous day and it is seen during a downtrend. Then there is another Black Marubozu
on the third day showing sale of positions since it closes at a new low. However, this
may give incentive to the shorts to cover their positions implying that a bullish
reversal is now possible.
Recognition Criteria:
- The market is characterized by downtrend.
- Two consecutive Black Marubozus in the first and second day can be seen.
- Then we see a black candlestick on the third day opening with a downward gap
but trading into the body of the second day and it is characterized by a long upper
shadow.
- Finally we see another Black Marubozu on the fourth day that completely
engulfs the candlestick of the third day including the shadow.
Explanation:
- Two black Marubozu show that the downtrend is continuing to the satisfaction
of the bears. On the third day, we see a downward gap further confirming the
downtrend. However, prices on the third day start going above the close of the
previous day, causing some doubts about the bearish direction even though the day






76
closes at or near its low. The next day shows a significantly higher gap in the opening.
After the opening, however, prices again go down closing at a new low. This last day
may be interpreted as a good chance for the short-sellers to cover their short positions.
Important Factors:
- The reliability of this pattern is very high, but still a confirmation in the form
of a white candlestick with a higher close or a gap-up is suggested.
1.5 Bullish Harami cross



FIGURE A-5 Bullish Harami cross

Definition:
The Bullish Harami Cross Pattern is a Doji preceded by a long black real body.
The Bullish Harami Cross Pattern is a major bullish reversal pattern. It is more
significant than a regular Bullish Harami Pattern.
Recognition Criteria:
- The market is characterized by downtrend.
- A long black candlestick can be seen.
- A long black candlestick is followed by a Doji completely engulfed by the real
body of the first day. The shadows (high/low) of the Doji may not be necessarily
contained within the first black body, though it's preferable if they are.
Explanation:
- The Bullish Harami Cross Pattern is a strong signal of disparity about the
markets health. During a downtrend, the heavy selling reflected by a long, black real
body is followed by a Doji next day. This shows that the market is starting to repeat
itself from the prior downtrend.
Important Factors:






77
- The Bullish Harami Pattern is not a major reversal pattern; however the Bullish
Harami Cross Pattern is a major upside reversal pattern. Short traders are not wise to
ignore the significance of a Harami cross just after a long black candlestick. Harami
crosses point out to the bottoms.
- A third day confirmation of the reversal is recommended (though not required)
to judge that the downtrend has reversed. The confirmation may be in the form of a
white candlestick, a large gap up, or a higher close on the next trading day.

2. Bearish Reversal Patterns
2.1 Bearish kicking



FIGURE A-6 Bearish kicking

Definition:
A White Marubozu is followed by a sharp lower gap when it opens during the
second day. The second day opening is even below the prior sessions opening
(forming a Black Marubozu). Such a pattern is called a Bearish Kicking Pattern.
Recognition Criteria:
- The market direction is not important.
- A White Marubozu in the first day can be seen.
- A Black Marubozu day that gaps downward on the second day can be seen.
Explanation:
- Bearish Kicking Pattern sends a strong signal suggesting that the market is
now heading downward. The previous market direction is not important in this pattern
unlike is most other candlestick patterns. The market has been in a trend when prices






78
gap down the next day in case of Bearish Kicking Pattern. The prices on the second
day never enter into the previous day's range and we have a close with another gap.
Important Factors:
- Both of the candlesticks do not have shadows (or very small shadows if any).
In other words, both are Marubozu.
- The Bearish Kicking Pattern is similar to the Bearish Separating Lines Pattern,
except that instead of the open prices being equal, in the Bearish Kicking Pattern a
gap occurs.
- The Bearish Kicking Pattern is highly reliable but still a confirmation may be
necessary, and this confirmation may be in the form of a black candlestick, a large
gap down or a lower close on the next trading day.
2.2 Bearish abandoned baby



FIGURE A-7 Bearish abandoned baby

Definition:
The Bearish Abandoned Baby Pattern is a very rare top reversal signal. It is
basically composed of a Doji Star, which shows gaps (including shadows) from the
prior and following sessions candlesticks.
Recognition Criteria:
- The market is characterized by an uptrend.
- A long white candlestick in the first day can be seen.
- Then we see a Doji on the second day whose shadows characteristically gap
above the previous day's upper shadow and also gaps in the direction of the previous
uptrend.
- Finally we see a black candlestick characterized with a gap in the opposite
direction, with no overlapping shadows.






79
Explanation:
- Most of the three-day star patterns have similar scenarios. In an uptrend, the
market seems still strong, displaying a long white candlestick and opening with a gap
on the second day. The trading in second day is within a small range and its closing
price is equal or very near to its opening price. Now there is a sign of sale-off
potential with reversal of positions. The trend reversal is confirmed by the black
candlestick on the third day. A downward gap also supports the reversal.
Important Factors:
- The Bearish Abandoned Baby Pattern is quite rare.
- The reliability of this pattern is very high, but still a confirmation in the form
of a black candlestick with a lower close or a gap-down is suggested.
2.3 Bearish evening Doji star



FIGURE A-8 Bearish evening Doji star

Definition:
This is a major top reversal pattern formed by three candlesticks. The first
candlestick is a long white body; the second is a Doji characterized by a higher gap
thus forming a Doji star. The third one is a black candlestick with a closing price,
which is within the first days white real body. It is a meaningful top pattern.
Recognition Criteria:
- The market is characterized by uptrend.
- A white candlestick in the first day can be seen.
- Then we see a Doji that gaps in the direction of the previous uptrend on the
second day.
- Finally the third day is a black candlestick.
Explanation:






80
- The first white body, while the market is in an uptrend, shows the continuing
bullish nature of the market. Then a Doji appears showing the diminishing power of
the longs. The strong black real body on the third day proves that bears have taken
over. An ideal Bearish Evening Doji Star Pattern has a gap before and after the middle
real body. The second gap is rare, but lack of it does not take away from the power of
this formation.
Important Factors:
- The Doji may be more than one, two or even three.
- Dojis gaps are not important.
- The reliability of this pattern is very high, but still a confirmation in the form
of a black candlestick with a lower close or a gap-down is suggested.
2.4 Bearish three black crows



FIGURE A-9 Bearish three black crows

Definition:
The Bearish Three Black Crows Pattern is indicative of a strong reversal during
an uptrend. It consists of three long black candlesticks, which look like a stair
downward. The opening price of each day is higher than the previous day's closing
price suggesting a move to a new short term low.
Recognition Criteria:
- The market is characterized by uptrend.
- Three consecutive long black candlesticks appear.
- Each day closes at a new low.
- Each day opens within the body of the previous day.
- Each day closes near or at its lows.
Explanation:






81
- The Bearish Three Black Crows Pattern is indicative of the fact that the market
has been at a high price for too long and the market may be approaching a top or is
already at the top. A decisive downward move is reflected by the first black
candlestick. The next two days show a further decline in prices due to profit making.
The Bullish mood of the market cannot be sustained anymore.
Important Factors:
- The opening prices of the second and third day can be anywhere within the
previous day's body. However, it is better to see the opening prices below the middle
of the previous day's body.
- If the black candlesticks are much extended, one should be cautious about an
oversold market.
- The reliability of this pattern is very high, but still a confirmation in the form
of a black candlestick with a lower close or a gap-down is suggested.
2.5 Bearish three inside down



FIGURE A-10 Bearish three inside down

Definition:
The Bearish Three Inside Down Pattern is another name for the Confirmed
Bearish Harami Pattern. The third day confirms the bearish trend reversal.
Recognition Criteria:
- The market is characterized by uptrend.
- A Bearish Harami Pattern in the first two days can be seen.
- We then see a black candlestick on the third day with a lower close than the
second day.
Explanation:






82
- The first two days of this three-day pattern is a Bearish Harami Pattern, and the
third day confirms the reversal suggested by Bearish Harami Pattern since it is a black
candlestick closing with a new low for the three days.
Important Factors:
- The reliability of this pattern is very high, but still a confirmation in the form
of a black candlestick with a lower close or a gap-down is suggested.
2.6 Bearish three outside down



FIGURE A-11 Bearish three outside down

Definition:
The Bearish Three Outside Down Pattern is another name for the Confirmed
Bearish Engulfing Pattern. The third day confirms the bearish trend reversal.
Recognition Criteria:
- The market is characterized by uptrend.
- A Bearish Engulfing Pattern in the first two days can be seen.
- Then we see a black candlestick on the third day with a lower close than the
second day.
Explanation:
- The first two days forms a Bearish Engulfing Pattern, and the third day
confirms the reversal suggested by the Bearish Engulfing Pattern since it is a black
candlestick closing with a new low for the last three days.
Important Factors:
- The reliability of this pattern is very high, but still a confirmation in the form
of a black candlestick with a lower close or a gap-down is suggested.







83
2.7. Bearish upside gap two crows



FIGURE A-12 Bearish upside gap two crows

Definition:
The Bearish Upside Gap Two Crows Pattern is a three-candlestick pattern and it
signals a top reversal. The first candlestick is a long white candlestick followed by a
real body that gaps higher. Then another black real body appears, which opens above
the second days open and closes under the second days close, completing the pattern
Recognition Criteria:
- The market is characterized by uptrend.
- A long white candlestick in the first day that signals the continuation of
uptrend can be seen.
- A black body with a gap up on second day can be seen.
- The third day is characterized by another black candlestick having an opening
above the first black day and also closing below the body of the first black day. The
body of third day engulfs the body of the first day.
- The close of the second black candlestick is still above the close of the first
long white candlestick.
Explanation:
- The market is in an uptrend and it displays a higher opening with a gap.
However, the new highs of the day cannot hold and the market forms a black
candlestick. Nevertheless, the bulls still comfort themselves by the fact that the close
on this black candlestick day is still above the prior days close. The third day,
however, increases the bearish sentiment displaying another new high but failing to
hold these highs until the close. Also, the day closes below the prior days close,






84
which is another bearish sign. So the following question becomes relevant. If the
market is so strong, why the new highs fail to hold and why market closes lower? The
answer is clear. The market is not now as strong as the bulls would like to believe.
Important Factors:
- The two black candlesticks of the pattern are the crows reminding of ominous
looking black crows atop a tree branch.
- Confirmation for the Bearish Upside Gap Two Crows Pattern may be mildly
suggested. If in the fourth session prices fail to regain high ground, lower prices
should be expected.
2.8 Bearish engulfing



FIGURE A-13 Bearish engulfing

Definition:
Bearish Engulfing Pattern is a large black real body, which engulfs a small
white real body in an uptrend (it does not need to engulf the shadows). The Bearish
Engulfing Pattern is an important top reversal signal.
Recognition Criteria:
- The market is characterized by uptrend.
- A white candlestick in the first day can be seen.
- A black candlestick that completely engulfs the real body of the first day can
be seen.
Explanation:
- The market is in a bull mood. Then we see diminished buying reflected by the
short, white real body. This then is followed by a strong sell-off, which lead to a close
at or below the previous days open. Apparently the uptrend has lost momentum and
the bears may be gaining strength.






85
Important Factors:
- Relative sizes of the first and second day are important. If the first day of the
Bearish Engulfing Pattern shows a very small real body (it may even be almost a Doji
or is a Doji) but the second day has a very long real body, this shows the dissipation
of the prior uptrends force and an increase in bearish force.
- A protracted or very fast move increases the chance that potential buyers are
already long and that there may be less of a supply of new longs in order to keeps the
market moving up. A fast move makes the market overextended and vulnerable to
profit making. A Bearish Engulfing Pattern appearing after such a move is more likely
to be an important bearish reversal indicator.
- A bearish reversal is more possible if there is heavy volume on the second real
body or if the second day of the Bearish Engulfing Pattern engulfs more than one real
body.
- A confirmation on the third day is required to be sure that the uptrend has
reversed. The confirmation may be in the form of a black candlestick, a large gap
down or a lower close on the third day.



















APPENDIX B

DATA USED IN THE EXPERIMENTS






88
TABLE B-1 Historical prices of DIS as a training data
Date Open High Low Close
3/29/1996 64.5 64.87 63.88 63.88
4/1/1996 64.25 64.87 64.25 64.87
4/2/1996 65 65.62 65 65.5
4/3/1996 65.5 65.62 65.25 65.62
4/4/1996 65.62 65.62 64.5 65
4/8/1996 65 65 63.63 64.37
4/9/1996 64.37 64.62 63.63 63.63
4/10/1996 63.5 63.5 60.75 60.88
4/11/1996 60.88 61.5 60.13 60.38
4/12/1996 60.38 61.75 60.25 61.38
4/15/1996 61.38 62.38 61.13 61.88
4/16/1996 61.88 62.75 60.5 62.25
4/17/1996 62.25 62.75 62.13 62.38
4/18/1996 62.38 63.13 62.38 62.88
4/19/1996 62.88 63.5 62.75 63.13
4/22/1996 63.13 63.63 62.13 62.63
4/23/1996 62.63 62.63 61.25 61.75
4/24/1996 61.63 61.63 59.75 60.63
4/25/1996 60.63 61.75 60.63 61.25
4/26/1996 61.5 62.75 61.5 61.88
4/29/1996 61.88 62.13 61.63 61.88
4/30/1996 61.88 62.13 61.63 62
5/1/1996 61.75 61.75 60.5 60.5
5/2/1996 60.5 60.75 59.63 60
5/3/1996 60 60.75 58.5 59
5/6/1996 59 60.25 58.63 60.13
5/7/1996 60 60 59.25 59.38
5/8/1996 59.13 59.13 57.88 59
5/9/1996 59 59.5 57.88 58.25
5/10/1996 58.38 59.63 58.38 59.25
5/13/1996 59.5 60.88 59.5 60.75
5/14/1996 60.75 61.25 60.63 60.88
5/15/1996 60.88 61.38 60 60.38
5/16/1996 60.38 61.13 59.88 60.75
5/17/1996 61 61.63 61 61.25
5/20/1996 61.25 62 61.13 61.88
5/21/1996 61.88 62.5 61.13 62.38
5/22/1996 62.38 62.88 62.38 62.75
5/23/1996 62.75 63.25 61.88 62
5/24/1996 62.13 62.88 62.13 62.5
5/28/1996 62.5 63 61.63 62.13
5/29/1996 62.13 62.13 60.5 60.5
5/30/1996 60.5 61.38 60.25 61.25
5/31/1996 61.25 61.75 60.63 60.75
6/3/1996 60.75 60.75 60.25 60.38
6/4/1996 60.38 60.5 59.63 60.13
6/5/1996 60.13 60.63 59.5 60.5
6/6/1996 61.75 63.75 61.75 62.5






89
TABLE B-1 (CONTINUED)
Date Open High Low Close
6/7/1996 62.5 63.25 61.25 63.25
6/10/1996 63.25 63.38 62.38 62.38
6/11/1996 62.38 62.88 62.13 62.38
6/12/1996 62.38 62.88 62.13 62.38
6/13/1996 62.38 62.5 61.75 61.75
6/14/1996 61.75 61.75 60.88 61.5
6/17/1996 61.5 62.13 61.38 62
6/18/1996 62 62.13 60.88 61
6/19/1996 61 61.38 60.88 61.13
6/20/1996 61.13 61.88 60.88 61.75
6/21/1996 61.75 63.13 61.5 63
6/24/1996 62.88 62.88 62.13 62.25
6/25/1996 62.5 63.38 62.5 63.25
6/26/1996 62.88 62.88 61.88 62.38
6/27/1996 62.38 63.25 62.38 63.13
6/28/1996 63.13 63.75 62.63 62.88
7/1/1996 62.75 62.75 61.88 62.25
7/2/1996 62.25 62.38 61.13 61.25
7/3/1996 61.25 61.38 60 61
7/5/1996 60.38 60.38 59.38 59.38
7/8/1996 59.38 60.13 58.75 59
7/9/1996 59 59.25 57.5 57.5
7/10/1996 57.5 58.25 57.25 58.13
7/11/1996 58 58 56 56.13
7/12/1996 56.13 57.5 56.13 56.88
7/15/1996 56.88 58.13 54.63 54.88
7/16/1996 54.88 56.38 53.88 56
7/17/1996 56 57.38 55.88 56
7/18/1996 56.25 57.38 56.25 57.25
7/19/1996 57.25 57.75 56.63 57.38
7/22/1996 57.13 57.13 56 56
7/23/1996 56 56.38 55.38 55.5
7/24/1996 55.38 55.38 54.13 54.38
7/25/1996 54.38 55.13 54.13 54.38
7/26/1996 54.38 54.75 53.5 54.13
7/29/1996 54.13 54.75 53.25 53.38
7/30/1996 53.38 55.38 53.38 55.25
7/31/1996 55.25 55.88 54.75 55.63
8/1/1996 56 57.63 56 57.38
8/2/1996 57.88 58.75 57.88 58
8/5/1996 58.13 58.75 58.13 58.38
8/6/1996 58.38 59.13 58.38 59
8/7/1996 59 59 58 58.38
8/8/1996 58.38 58.38 57.38 57.5
8/9/1996 57.5 57.5 56.88 57.13
8/12/1996 57.13 58.5 56.5 58.5
8/13/1996 58.5 58.5 57.63 58







90
TABLE B-1 (CONTINUED)
Date Open High Low Close
8/14/1996 58 58.13 57.75 58.13
8/15/1996 58.13 58.88 57.5 57.88
8/16/1996 57.88 58.13 57.75 58.13
8/19/1996 58.13 58.63 57.75 58
8/20/1996 58 58 57.25 57.25
8/21/1996 57.25 58 56.88 57.88
8/22/1996 57.88 58.75 57.75 58.13
8/23/1996 58.13 58.5 57.38 58.38
8/26/1996 58.38 59.38 58.25 59.38
8/27/1996 59.38 59.75 58.75 59
8/28/1996 59 59 58 58.25
8/29/1996 58.25 58.38 56.75 57.75
8/30/1996 57.63 57.63 56.38 57
9/3/1996 57 57 56.38 57
9/4/1996 57 57 56.38 56.75
9/5/1996 56.75 56.88 55.63 55.63
9/6/1996 55.63 57.25 55.63 57
9/9/1996 57.13 58.25 57.13 58.25
9/10/1996 58.25 58.25 57.38 57.88
9/11/1996 57.88 58.63 57.63 58.63
9/12/1996 58.88 60.63 58.88 60.5
9/13/1996 60.5 61.13 60.38 60.75
9/16/1996 60.75 61.75 60.25 60.25
9/17/1996 60.25 61.5 59.88 61.13
9/18/1996 61.13 61.5 60.75 61.25
9/19/1996 61.25 63.5 60.88 63.5
9/20/1996 63.38 63.38 62.38 63.13
9/23/1996 63.13 63.63 62.88 63.63
9/24/1996 63.63 63.75 62.63 62.75
9/25/1996 62.75 63.13 62.63 62.63
9/26/1996 62.63 63.63 61.88 62
9/27/1996 62 63 61.63 63
9/30/1996 63 63.88 62.75 63.25
10/1/1996 63.25 63.63 62.5 62.5
10/2/1996 62.5 63.5 62.5 62.88
10/3/1996 62.88 63.38 62.75 63.13
10/4/1996 63.38 64.75 63.38 64.12
10/7/1996 64.12 64.37 63.88 64.12
10/8/1996 64.12 64.37 63.5 63.63
10/9/1996 63.63 63.75 62.75 63.5
10/10/1996 63.5 63.75 63 63.63
10/11/1996 63.63 64.37 63.63 64
10/14/1996 64.12 64.62 64.12 64.12
10/15/1996 64.12 64.62 63.5 64.37
10/16/1996 64.37 65.62 64 65.5
10/17/1996 65.5 65.87 64.75 64.87
10/18/1996 64.87 65 64.5 65
10/21/1996 65 65.87 64.87 65.62






91
TABLE B-1 (CONTINUED)
Date Open High Low Close
10/22/1996 65.62 66.75 65.62 66.62
10/23/1996 66.5 66.5 65.75 66.12
10/24/1996 66.12 66.37 65 65.37
10/25/1996 65.37 66.25 65.12 66.25
10/28/1996 66.25 66.94 66.12 66.37
10/29/1996 66.37 66.62 65.75 65.75
10/30/1996 65.75 66.12 65.62 65.62
10/31/1996 65.62 66 65.12 65.87
11/1/1996 65.87 66.37 65.12 65.5
11/4/1996 65.5 67 65.37 66.87
11/5/1996 66.87 67.62 66.75 67.62
11/6/1996 67.62 68 66.62 67.75
11/7/1996 67.75 69 67.62 69
11/8/1996 68.75 68.75 67.87 68.5
11/11/1996 68.5 70.37 68.5 70.37
11/12/1996 70.37 71.5 69.87 70.87
11/13/1996 70.87 71.25 70.12 70.62
11/14/1996 70.62 70.87 69.62 70.62
11/15/1996 70.75 73 70.75 72.25
11/18/1996 72 72 71 71.37
11/19/1996 71.37 72 70.62 71
11/20/1996 71 71.75 70.62 71.75
11/21/1996 71.75 72.37 71.37 72.25
11/22/1996 72.25 73.37 72 72.12
11/25/1996 72.12 73.62 71.5 73.5
11/26/1996 74.37 77.25 74.37 76
11/27/1996 75.37 75.37 73.62 73.87
11/29/1996 73.87 74 73 73.87
12/2/1996 73.87 74.5 73 73.87
12/3/1996 73.87 74 71.75 71.87
12/4/1996 71.87 72 70.37 72
12/5/1996 71.87 71.87 71 71.87
12/6/1996 71.62 71.62 69.5 71.5
12/9/1996 71.5 73.37 71 73.12
12/10/1996 73.12 73.75 72.75 73.25
12/11/1996 73 73 71.37 72.12
12/12/1996 72.12 72.25 70.12 70.25
12/13/1996 70.25 70.75 69.37 70.25
12/16/1996 70.25 71 68.87 69.37
12/17/1996 69.37 71.25 69.25 70.87
12/18/1996 70.87 72 70.87 71.5
12/19/1996 71.5 72.37 71.25 72.37
12/20/1996 72.37 73.75 72 72.37
12/23/1996 72.37 72.37 71.62 72.12
12/24/1996 72.12 72.25 71 71.5
12/26/1996 71.5 71.87 70.87 71.37
12/27/1996 71.37 72.12 71 71.25
12/30/1996 71.25 71.62 69.87 70






92
TABLE B-1 (CONTINUED)
Date Open High Low Close
12/31/1996 70 70.5 69.37 69.75
1/2/1997 69.75 69.87 66.75 67.37
1/3/1997 68.12 69.37 68.12 69.25
1/6/1997 69.25 69.75 68.62 69
1/7/1997 69 69 68.25 68.87
1/8/1997 68.87 69.37 67.5 67.87
1/9/1997 67.87 68.75 67.25 67.5
1/10/1997 67.5 67.87 66.37 67.87
1/13/1997 67.87 68.5 67.87 68
1/14/1997 68 69.5 68 69.25
1/15/1997 69.25 69.75 68.37 69.12
1/16/1997 69.12 69.37 68.5 68.87
1/17/1997 68.87 70.12 68.87 70
1/20/1997 70.25 70.87 70.25 70.5
1/21/1997 69.87 69.87 69.25 69.75
1/22/1997 69.75 70.87 69.25 70.75
1/23/1997 70.75 71.62 70.37 70.37
1/24/1997 70.37 71.5 69.5 71.25
1/27/1997 71.25 71.87 70.62 71.62
1/28/1997 72.37 74.75 72.37 72.62
1/29/1997 72.75 73.75 72.75 73.75
1/30/1997 73.75 74.12 72.12 72.37
1/31/1997 72.62 73.37 72.62 72.87
2/3/1997 72.87 72.87 72 72.87
2/4/1997 72.87 73 72.5 72.62
2/5/1997 72.62 74.25 72.12 72.75
2/6/1997 73 74.12 73 74
2/7/1997 74.25 75.37 74.25 75
2/10/1997 75.62 77 75.62 75.62
2/11/1997 75.62 76 74.62 75
2/12/1997 75.12 76.87 75.12 76.62
2/13/1997 76.62 78.87 76.5 77.37
2/14/1997 77.62 79.25 77.62 78.12
2/18/1997 78 78 76.75 77.5
2/19/1997 77.25 77.25 76 76.12
2/20/1997 76.12 76.5 74.5 74.75
2/21/1997 75 76.12 75 75.37
2/24/1997 75.37 76.12 74.5 75.62
2/25/1997 75.62 76.87 75 76.12
2/26/1997 76.12 76.37 73.5 75.5
2/27/1997 75.5 76.12 75.5 75.87
2/28/1997 75.25 75.25 74.25 74.25
3/3/1997 74.25 74.87 72.75 73.37
3/4/1997 73.37 73.5 72.5 72.75
3/5/1997 72.75 74.12 71.75 73.5
3/6/1997 73.5 75.5 73.37 75.12
3/7/1997 75.37 76.37 75.37 76
3/10/1997 76 77 75.25 76.75






93
TABLE B-1 (CONTINUED)
Date Open High Low Close
3/11/1997 76.75 77.62 76.75 77.12
3/12/1997 77 77 75.12 75.37
3/13/1997 75.25 75.25 73.25 73.25
3/14/1997 73.62 75.25 73.62 74.75
3/17/1997 74.75 76.25 74.12 76
3/18/1997 76 76.5 74.87 75.5
3/19/1997 75.25 75.25 74 75
3/20/1997 75 75.12 74.12 74.5
3/21/1997 74.5 74.62 73.75 74
3/24/1997 74 75.12 73.87 75
3/25/1997 75 75.5 74.5 74.75
3/26/1997 74.75 75.62 74.62 75.25
3/27/1997 75.25 75.62 73.25 75
3/31/1997 74 74 72.25 72.87
4/1/1997 72.87 73.5 71 72.37
4/2/1997 72.37 73.87 71.12 72.37
4/3/1997 72.37 72.75 71.25 72.62
4/4/1997 72.62 73.75 71.87 73.75
4/7/1997 73.75 74.12 73.37 73.75
4/8/1997 73.75 73.87 73 73.87
4/9/1997 73.87 74.12 73.37 73.75
4/10/1997 73.87 75.12 73.87 74
4/11/1997 74 74.62 72.37 72.37
4/14/1997 72.12 72.12 70.37 71.12
4/15/1997 71.25 74.12 71.25 73.87
4/16/1997 73.87 75.62 73.37 75.62
4/17/1997 75.62 76.37 75.25 75.75
4/18/1997 75.75 77 75.5 76.75
4/21/1997 76.75 77.87 76.25 76.87
4/22/1997 76.87 78.87 76.37 78.25
4/23/1997 78.25 79.62 78.25 79.12
4/24/1997 79.12 79.87 77.75 78.25
4/25/1997 78.25 78.25 77.12 77.37
4/28/1997 77.37 78.25 77.25 77.62
4/29/1997 78.25 80.87 78.25 80.75
4/30/1997 80.75 82.5 80 81.75
5/1/1997 81.75 82 80.25 81
5/2/1997 81 81.5 80.37 80.37
5/5/1997 80.37 82.25 79.75 82.12
5/6/1997 82.12 82.37 81.37 82.25
5/7/1997 82.25 82.25 80.25 80.5
5/8/1997 80.5 81.87 79.75 81.25
5/9/1997 81.25 82.25 81 82.25
5/12/1997 82.37 85.12 82.37 84.5
5/13/1997 84.37 84.37 82.87 83.62
5/14/1997 83.62 84.62 83.37 83.62
5/15/1997 83.37 83.37 82.62 82.87
5/16/1997 82.62 82.62 80.87 80.87






94
TABLE B-1 (CONTINUED)
Date Open High Low Close
5/19/1997 80.87 83.37 80.75 83.25
5/20/1997 83.25 83.62 81.62 83.5
5/21/1997 83.5 83.75 81.87 82.12
5/22/1997 82.12 82.75 81.75 82.12
5/23/1997 82.37 83.62 82.37 83.25
5/27/1997 83.25 83.87 82.12 83.75
5/28/1997 83.75 84.12 82.75 83.87
5/29/1997 83.87 84 82.37 82.87
5/30/1997 82.25 82.25 80.12 81.87
6/2/1997 81.87 82.37 80.75 80.87
6/3/1997 80.87 81 80.37 80.62
6/4/1997 80.62 80.62 79.87 79.87
6/5/1997 79.87 81.62 79.87 80.75
6/6/1997 80.75 81.5 80.12 81.37
6/9/1997 81.37 82 80.87 81
6/10/1997 81 82 81 81.87
6/11/1997 81.87 81.87 80.87 81.37
6/12/1997 81.37 81.87 81.25 81.62
6/13/1997 81.87 84 81.87 83.5
6/16/1997 83.5 83.87 83 83.87
6/17/1997 83.87 84.37 82.75 84
6/18/1997 83.37 83.37 82.5 82.5
6/19/1997 82.5 83.62 81.37 83.37
6/20/1997 83.37 83.37 82 82.25
6/23/1997 82.25 82.37 80.5 80.62
6/24/1997 80.62 82.5 80.5 82.5
6/25/1997 82.5 83.16 80.87 82
6/26/1997 82 82.25 81 81.56
6/27/1997 81.56 81.94 79.87 79.94
6/30/1997 79.94 80.44 78.75 80.25
7/1/1997 79.75 79.75 77.87 78.56
7/2/1997 77.75 77.75 76.44 76.87
7/3/1997 77.12 78.5 77.12 77.25
7/7/1997 77.25 78.25 75.06 76
7/8/1997 76.87 78.37 76.87 78.06
7/9/1997 78.06 78.5 76.81 77.06
7/10/1997 77.06 77.94 76.62 76.87
7/11/1997 76.87 77 75.75 76.44
7/14/1997 76.44 77.62 76.25 77.37
7/15/1997 77.37 77.94 76.56 77.94
7/16/1997 78.06 79.5 78.06 78.87
7/17/1997 78.87 78.87 76.37 77.75
7/18/1997 77 77 75.25 75.87
7/21/1997 75.87 75.94 73.81 75.19
7/22/1997 75.25 78 75.25 77.62
7/23/1997 77.75 79.62 77.75 77.94
7/24/1997 77.94 79.62 76.5 79.31
7/25/1997 79.25 79.25 78.25 79






95
TABLE B-1 (CONTINUED)
Date Open High Low Close
7/28/1997 79 79.81 79 79.62
7/29/1997 79.62 80.44 79.5 80.12
7/30/1997 80.44 81.25 80.44 80.94
7/31/1997 80.94 81.69 80.81 80.81
8/1/1997 80.81 81.31 80.25 80.56
8/4/1997 80.56 81.37 79.81 80.94
8/5/1997 80.94 81 79.81 79.94
8/6/1997 79.94 81 79.62 80.81
8/7/1997 80.81 81.25 78.94 79.12
8/8/1997 79.12 79.44 78.12 79.19
8/11/1997 79.19 80.19 77.62 79.62
8/12/1997 79.62 80.37 78.25 78.37
8/13/1997 78.37 79.94 77.37 79
8/14/1997 79 80.06 77.62 78.87
8/15/1997 78.62 78.62 76.5 76.62
8/18/1997 76.62 78.81 76 78.62
8/19/1997 78.62 79.69 78 79.69
8/20/1997 79.69 80.62 79.25 80.37
8/21/1997 80.37 80.44 78.44 78.87
8/22/1997 78.31 78.31 77.19 78.12
8/25/1997 78.12 79.06 77.87 78.31
8/26/1997 78.31 78.69 77.5 77.5
8/27/1997 77.5 79 76.87 78.5
8/28/1997 78.5 78.87 77.12 77.75
8/29/1997 77.75 78.12 76.81 76.81
9/2/1997 77 79 77 79
9/3/1997 79 80.12 79 79.56
9/4/1997 79.5 79.5 77.31 77.69
9/5/1997 77.69 78.62 77.5 78.19
9/8/1997 78.19 79.19 77.87 77.87
9/9/1997 77.87 79.12 77.44 78.5
9/10/1997 78.44 78.44 77.69 77.75
9/11/1997 76.87 76.87 74.44 75.75
9/12/1997 75.87 77.31 75.87 77.12
9/15/1997 77.12 77.56 76.75 77.19
9/16/1997 77.37 79.37 77.37 79.06
9/17/1997 79.06 80.25 78.5 78.87
9/18/1997 78.87 79.81 77.75 79.31
9/19/1997 79.31 79.94 79.25 79.94
9/22/1997 79.94 80.19 79.5 79.56
9/23/1997 79.56 79.69 78.62 79
9/24/1997 79 79.94 78.69 78.69
9/25/1997 78.69 79.62 78.25 79.62
9/26/1997 79.62 80.19 79.19 79.5
9/29/1997 79.5 81 79.12 80
9/30/1997 80 81.44 79.75 80.62
10/1/1997 80.81 82.37 80.81 82
10/2/1997 82.25 83.94 82.25 83.81






96
TABLE B-1 (CONTINUED)
Date Open High Low Close
10/3/1997 84 85.81 84 84.37
10/6/1997 84.37 84.5 82.75 83
10/7/1997 83.25 85.44 83.25 85.19
10/8/1997 84.94 84.94 83.12 84
10/9/1997 84 84.44 83.31 84.19
10/10/1997 84.06 84.06 83.25 83.69
10/13/1997 84.12 84.87 84.12 84.62
10/14/1997 84.87 86.87 84.87 86.44
10/15/1997 86.44 87.81 85.75 86.87
10/16/1997 86.75 86.75 83.56 84.94
10/17/1997 84.5 84.5 81.31 82.62
10/20/1997 82.62 83.62 82.5 83.56
10/21/1997 83.56 84.12 83.06 83.69
10/22/1997 83.69 84.37 83 83.06
10/23/1997 82.94 82.94 81.62 82.31
10/24/1997 82.31 84.87 82.12 82.37
10/27/1997 82.37 82.81 77.75 77.75
10/28/1997 77.75 82.75 75 82.31
10/29/1997 82.31 83.75 81.25 82.94
10/30/1997 82.94 83.12 80.5 80.62
10/31/1997 81.69 83.25 81.69 82.37
11/3/1997 83.19 85.5 83.19 85.5
11/4/1997 85.5 86.31 85.12 86.25
11/5/1997 86.25 86.31 84.94 85.12
11/6/1997 85.12 86.75 84.5 86.37
11/7/1997 86.37 87.5 84.5 86.31
11/10/1997 86.31 87.25 85.37 85.44
11/11/1997 85.5 86.69 85.5 86
11/12/1997 86 86.31 83.06 83.06
11/13/1997 83.81 85.31 83.81 84.69
11/14/1997 85.12 87.5 85.12 86.69
11/17/1997 87.87 89.75 87.87 89
11/18/1997 89 90.31 87.75 89.25
11/19/1997 89.37 91.37 89.37 91.37
11/20/1997 91.37 91.62 90.5 90.69
11/21/1997 91 94.75 91 94.75
11/24/1997 94.19 94.19 92.56 93.62
11/25/1997 93.62 94.25 92.87 93.62
11/26/1997 93.94 95.37 93.94 94.5
11/28/1997 94.62 95.31 94.62 94.94
12/1/1997 94.94 97.94 94.12 97.62
12/2/1997 97.62 97.75 95.69 96.56
12/3/1997 96.56 96.75 94.19 95.19
12/4/1997 93.94 93.94 93.25 93.56
12/5/1997 93.56 94.44 93 94
12/8/1997 94 94.69 93.94 94.37
12/9/1997 94.37 95.31 93.44 94.31
12/10/1997 94 94 93.25 93.81






97
TABLE B-1 (CONTINUED)
Date Open High Low Close
12/11/1997 93.25 93.25 92.06 92.81
12/12/1997 92.87 94.56 92.87 93.62
12/15/1997 94.19 97.31 94.19 97.12
12/16/1997 97.12 97.12 95.69 96
12/17/1997 96.31 96.94 96.31 96.81
12/18/1997 96.81 97.81 96.25 97.31
12/19/1997 96.37 96.37 93.25 95.81
12/22/1997 95.81 97.94 95.75 97.37
12/23/1997 97.44 98.5 97.44 97.5
12/24/1997 97.5 97.69 94.81 95
12/26/1997 95 96.19 94.87 95.06
12/29/1997 95.5 97.44 95.5 97
12/30/1997 98 100.25 98 99
12/31/1997 99 100.25 98.69 99
1/2/1998 99 99.81 98.62 99.62
1/5/1998 99.62 100.75 97.69 98.81
1/6/1998 98.69 98.69 98 98.44
1/7/1998 98.44 98.5 97.37 98.5
1/8/1998 98.44 98.44 96.94 97.69
1/9/1998 97.69 97.75 96 96
1/12/1998 96 96.12 93.56 94.44
1/13/1998 94.44 95.5 93.75 95
1/14/1998 95 97.12 94.19 96.5
1/15/1998 96.06 96.06 94.69 95.69
1/16/1998 95.69 96.56 95.25 96.12
1/20/1998 96.75 99.75 96.75 99.37
1/21/1998 99.37 99.5 98.06 98.87
1/22/1998 98.62 98.62 96.31 96.5
1/23/1998 96.81 99.19 96.81 98.62
1/26/1998 98.62 99.31 97 97.37
1/27/1998 98.87 104.12 98.87 102.75
1/28/1998 103.5 106.75 103.5 105
1/29/1998 105 108.37 104.62 106.25
1/30/1998 106.25 107.87 105.31 106.87
2/2/1998 106.87 109.25 106.81 108.81
2/3/1998 108.25 108.25 106.75 108
2/4/1998 108 108.75 107.31 108.31
2/5/1998 108.31 109.37 107.44 108.31
2/6/1998 108.31 109.12 108.06 108.56
2/9/1998 108.56 109.62 107.56 107.69
2/10/1998 107.69 109.12 106.5 108.5
2/11/1998 108.5 110.81 108.31 110.81
2/12/1998 110.44 110.44 108.87 110.12
2/13/1998 110.12 111.62 109.31 111.44
2/17/1998 111.75 113 111.75 113
2/18/1998 113 115.25 112.12 114.87
2/19/1998 114.87 115.5 113.5 114.19
2/20/1998 114.19 114.87 113.25 114.37






98
TABLE B-1 (CONTINUED)
Date Open High Low Close
2/23/1998 114.37 115.75 113.5 114.06
2/24/1998 113.94 113.94 111.56 111.94
2/25/1998 111.94 112.12 111 111.25
2/26/1998 111.12 111.12 109 110
2/27/1998 110 112.62 109 111.94
3/2/1998 111.94 111.94 109 109.37
3/3/1998 109.37 110.69 109 110
3/4/1998 106.94 106.94 104.69 106.87
3/5/1998 105.87 105.87 104.75 105.19
3/6/1998 105.19 106.44 105.12 105.62
3/9/1998 105.62 106.44 105.25 105.81
3/10/1998 105.81 106.19 105.5 105.87
3/11/1998 105.56 105.56 104.37 104.81
3/12/1998 104.81 106.31 104.56 105.94
3/13/1998 105.94 107.87 105.06 106
3/16/1998 106.19 110 106.19 109.62
3/17/1998 108.75 108.75 106.69 107.69
3/18/1998 107.5 107.5 106 107.31
3/19/1998 107.31 107.69 105.75 106.31
3/20/1998 106.31 107 105.37 107
3/23/1998 105.75 105.75 102.75 103

TABLE B-2 Historical prices of DIS as a testing data
Date Open High Low Close
12/24/2003 23.33 23.45 23.26 23.37
12/26/2003 23.37 23.46 23.15 23.21
12/29/2003 23.16 23.5 23.16 23.48
12/30/2003 23.43 23.56 23.26 23.3
12/31/2003 23.31 23.45 23.19 23.33
/2004 23.49 23.92 23.46 23.67
1/5/2004 23.67 24.2 23.61 24.14
1/6/2004 24 24.27 24 24.2
1/7/2004 24.48 24.64 24.26 24.6
1/8/2004 24.6 24.98 24.55 24.96
1/9/2004 24.75 24.99 24.71 24.87
1/12/2004 24.78 24.95 24.6 24.88
1/13/2004 24.81 24.99 24.6 24.68
1/14/2004 24.88 25.03 24.69 24.9
1/15/2004 24.93 25.08 24.71 24.82
1/16/2004 24.93 24.94 24.77 24.85
1/20/2004 24.8 24.84 24.31 24.47
1/21/2004 24.31 24.6 24.26 24.58
1/22/2004 24.58 24.79 24.48 24.7
1/23/2004 24.7 24.84 23.75 24.05
1/26/2004 23.92 24.44 23.92 24.4
1/27/2004 24.43 24.48 24.07 24.16






99
TABLE B-2 (CONTINUED)
Date Open High Low Close
1/28/2004 24.07 24.13 23.51 23.67
1/29/2004 23.8 24.65 22.98 24.45
1/30/2004 23.72 24.18 23.7 24
2/2/2004 23.8 24.03 23.6 23.8
2/3/2004 23.43 23.88 23.1 23.26
2/4/2004 23.06 23.72 23.05 23.19
2/5/2004 23.3 23.52 23.14 23.2
2/6/2004 23.1 23.53 22.9 23.35
2/9/2004 23.35 23.98 23.28 23.77
2/10/2004 23.85 24.3 23.75 24.08
2/11/2004 27.92 28 27.27 27.6
2/12/2004 27.95 28.41 27.61 28
2/13/2004 27.6 27.75 26.85 26.92
2/17/2004 27.4 27.51 26.49 26.9
2/18/2004 26.8 26.86 26.56 26.71
2/19/2004 27 27.05 26.7 27
2/20/2004 26.99 26.99 26.39 26.55
2/23/2004 26.55 26.75 26.02 26.75
2/24/2004 26.39 26.43 25.8 25.96
2/25/2004 26 26.39 25.91 26.3
2/26/2004 26.55 26.98 26.43 26.73
2/27/2004 26.88 26.88 26.52 26.53
3/1/2004 26.8 27.04 26.64 26.87
3/2/2004 26.7 27.05 26.7 26.76
3/3/2004 26.7 26.9 26.58 26.65
/2004 26.66 26.99 26.66 26.8
3/5/2004 26.76 26.85 26.41 26.48
3/8/2004 26.55 26.65 26.2 26.24
3/9/2004 26.24 26.41 25.98 26.23
3/10/2004 26.15 26.26 25.42 25.45
3/11/2004 25.45 25.52 24.75 24.95
3/12/2004 25.18 26.1 24.9 26.1
3/15/2004 25.4 25.49 25.1 25.33
3/16/2004 25.35 25.5 25.22 25.4
3/17/2004 25.46 25.95 25.36 25.8
3/18/2004 25.85 26.06 25.58 25.73
3/19/2004 25.74 25.94 25.35 25.39
3/22/2004 25.1 25.27 24.87 24.9
3/23/2004 25.1 25.35 24.91 25.1
3/24/2004 25.1 25.1 24.55 24.77
3/25/2004 24.98 25.16 24.81 25.05
3/26/2004 25 25.24 24.91 25.1
3/29/2004 25.15 25.27 25.06 25.2
3/30/2004 25.15 25.23 25.05 25.18
3/31/2004 25.23 25.26 24.9 24.99
4/1/2004 25.1 25.38 24.29 25.35
4/2/2004 25.88 25.99 25.55 25.95






100
TABLE B-2 (CONTINUED)
Date Open High Low Close
4/5/2004 25.82 26.58 25.71 26.5
4/6/2004 26.3 26.65 26.23 26.59
4/7/2004 26.34 26.47 26.01 26.01
4/8/2004 26.49 26.49 25.92 26.25
4/12/2004 25.85 25.9 25.51 25.7
4/13/2004 25.65 25.74 24.96 25
4/14/2004 24.9 25.14 24.8 25
4/15/2004 25.15 25.18 24.63 24.7
4/16/2004 24.7 24.9 24.43 24.9
4/19/2004 24.62 25.09 24.59 24.96
4/20/2004 25.06 25.29 24.74 24.8
4/21/2004 24.7 25.04 24.65 25
4/22/2004 25.1 25.25 24.88 24.88
4/23/2004 24.88 24.94 24.56 24.65
4/26/2004 24.72 24.86 24.1 24.38
4/27/2004 24.5 24.54 24.18 24.18
4/28/2004 23.75 23.95 23.6 23.95
4/29/2004 24.2 24.4 23.68 23.7
4/30/2004 23.7 23.75 22.9 23.03
5/3/2004 23.18 23.25 22.95 23.13
5/4/2004 22.95 23.26 22.86 23.02
5/5/2004 23 23.36 22.85 23
5/6/2004 22.81 22.97 22.47 22.75
5/7/2004 22.55 22.92 22.33 22.45
5/10/2004 22.11 22.6 21.39 22.1
5/11/2004 22.6 23.2 22.59 22.98
5/12/2004 22.99 23.2 22.65 23
5/13/2004 23.38 23.58 23.1 23.3
5/14/2004 23.35 23.45 23.06 23.24
5/17/2004 22.95 22.99 22.69 22.9
5/18/2004 23.09 23.3 22.84 22.84
5/19/2004 23.08 23.41 22.85 23
5/20/2004 22.91 23.18 22.86 23.05
5/21/2004 23.2 23.36 22.68 22.68
5/24/2004 22.9 23.25 22.82 23.2
5/25/2004 23.2 23.75 23.03 23.75
5/26/2004 23.66 23.85 23.53 23.66
5/27/2004 23.85 23.93 23.61 23.71
5/28/2004 23.8 23.87 23.47 23.47
6/1/2004 23.8 23.94 23.43 23.84
6/2/2004 23.95 24.45 23.38 24.42
6/3/2004 24.25 24.52 23.96 23.97
6/4/2004 24.15 24.38 24.01 24.06
6/7/2004 24.25 24.52 23.98 24.4
6/8/2004 24.45 24.61 24.33 24.6
6/9/2004 24.6 24.87 24.47 24.58
6/10/2004 24.52 24.85 24.51 24.72






101
TABLE B-2 (CONTINUED)
Date Open High Low Close
6/14/2004 24.55 24.79 24.53 24.72
6/15/2004 24.72 24.9 24.58 24.7
6/16/2004 24.65 24.94 24.56 24.87
6/17/2004 24.77 25 24.7 24.86
6/18/2004 24.87 25.02 24.73 25.02
6/21/2004 24.9 25.01 24.77 24.95
6/22/2004 24.77 24.95 24.75 24.92
6/23/2004 24.81 24.95 24.3 24.65
6/24/2004 24.7 25.43 24.56 25.34
6/25/2004 25.2 25.42 25.09 25.18
6/28/2004 25.19 25.57 25.13 25.24
6/29/2004 25.25 25.57 25.16 25.49
6/30/2004 25.5 25.6 25.34 25.49
7/1/2004 25.34 25.5 25.11 25.28
7/2/2004 25.35 25.42 25.14 25.27
7/6/2004 25.27 25.27 24.68 24.7
7/7/2004 24.75 24.87 24.7 24.73
7/8/2004 24.65 24.75 24.34 24.35
7/9/2004 24.6 24.65 24.32 24.6
7/12/2004 24.57 24.73 24.3 24.35
7/13/2004 24.15 24.46 24.15 24.23
7/14/2004 24.07 24.4 24.02 24.19
7/15/2004 24.15 24.22 23.86 23.87
7/16/2004 24.09 24.09 23.41 23.45
7/19/2004 23.4 23.57 23.1 23.49
7/20/2004 23.43 23.94 23.4 23.9
7/21/2004 23.9 23.94 23.2 23.64
7/22/2004 23.15 23.45 22.95 23.31
7/23/2004 23.28 23.43 22.88 22.96
7/26/2004 22.95 23.14 22.69 22.85
7/27/2004 22.95 23.09 22.84 22.95
7/28/2004 22.9 23.12 22.57 22.84
7/29/2004 22.9 23.22 22.9 23
7/30/2004 22.9 23.15 22.81 23.09
8/2/2004 23.1 23.18 22.9 23.1
8/3/2004 23.02 23.08 22.69 22.77
8/4/2004 22.6 22.82 22.35 22.49
8/5/2004 22.65 22.75 22.25 22.28
8/6/2004 22.03 22.25 21.85 21.99
8/9/2004 21.99 22.17 21.84 21.94
8/10/2004 21.98 22.59 21.95 22.44
8/11/2004 22.22 22.22 21.52 21.78
8/12/2004 21.5 21.59 21 21.21
8/13/2004 21.15 21.4 20.88 20.89
8/16/2004 21 21.74 20.96 21.55
8/17/2004 21.55 22.07 21.55 21.98
8/18/2004 21.95 22.33 21.75 22.26






102
TABLE B-2 (CONTINUED)
Date Open High Low Close
8/19/2004 22.2 22.42 22.12 22.4
8/20/2004 22.25 22.51 22.23 22.44
8/23/2004 22.35 22.63 22.15 22.17
8/24/2004 22.4 22.6 22.2 22.31
8/25/2004 22.21 22.69 22.21 22.5
8/26/2004 22.57 22.78 22.48 22.68
8/27/2004 22.6 22.75 22.39 22.66
8/30/2004 22.5 22.64 22.38 22.4
8/31/2004 22.53 22.59 22.33 22.45
9/1/2004 22.46 22.53 22.29 22.48
9/2/2004 22.35 22.58 22.23 22.54
9/3/2004 22.5 22.69 22.3 22.37
9/7/2004 22.36 22.79 22.36 22.69
9/8/2004 22.86 23.08 22.77 22.89
9/9/2004 22.88 23.04 22.81 22.86
9/10/2004 23.02 23.39 22.9 23.16
9/13/2004 23.21 23.48 23.2 23.32
9/14/2004 23.32 23.38 23 23.25
9/15/2004 23.25 23.3 22.93 23.01
9/16/2004 22.93 23.58 22.93 23.4
9/17/2004 23.65 23.65 23.39 23.42
9/20/2004 23.26 23.43 23 23.13
9/21/2004 23.3 23.42 23 23.41
9/22/2004 23.28 23.5 23.21 23.3
9/23/2004 23.2 23.49 23.16 23.26
9/24/2004 23.2 23.59 23.2 23.46
9/27/2004 23.26 23.35 23.11 23.17
9/28/2004 23.15 23.27 22.35 22.6
9/29/2004 22.61 22.8 22 22.8
9/30/2004 22.55 22.76 22.39 22.55
10/1/2004 22.56 23.17 22.51 23.08
10/4/2004 23.74 23.74 23.19 23.54
10/5/2004 23.58 23.99 23.52 23.88
10/6/2004 23.97 24.35 23.78 24.34
10/7/2004 24.37 24.96 24.28 24.75
10/8/2004 24.75 25.05 24.56 24.85
10/11/2004 24.85 25.01 24.78 24.9
10/12/2004 24.65 24.86 24.58 24.84


103
BIOGRAPHY

Name : Miss Nam Dinh Thi
Thesis Title : Forecasting and Trading Stock Using Technical Analysis and
Neural Fuzzy Network
Major Field : Information Technology

Biography
I graduated from Post and Telecommunication Institute of Technology, Hanoi,
Vietnam with a bachelor degree in Information Technology major in 2004.
My contact address is 175 Quynh Alley, Thanh Nhan Street, Hanoi, Vietnam.
My e-mail address is namdinhthi@yahoo.com

You might also like