View
3
Download
0
Category
Preview:
Citation preview
1
Financial Informatics –XII:
Financial Fuzzy Logic Based
Systems
1
Khurshid Ahmad,
Professor of Computer Science,
Department of Computer Science
Trinity College,
Dublin-2, IRELAND
November 19th, 2008.
https://www.cs.tcd.ie/Khurshid.A
hmad/T
each
ing.htm
l
2
Fuzzy Financial Systems
http://w
ww.stree
tdirec
tory.com/travel_guide/36574/investm
ent/candlestick_ch
arting___a_
pee
k_into_market_psy
chology.htm
l
The beh
aviour of th
e stakeh
older
s in a m
ark
et is an
intere
sting aven
ue of study. T
he re
action to change is one
of th
e key
are
as of intere
st here; the manner
in w
hich
change is anticipated varies fro
m per
son to per
son, but
ther
e are
some gen
eraliza
tions are
beg
inning to appea
r.
For instance, investors appea
r to have heu
ristics that
under
line their beh
aviour:
(1)IF
there
is gre
ate
r th
an a
vera
ge p
rice
movem
ent on the (re
vers
al) d
ay
TH
EN
I look for th
e p
rice
to e
xceed its n
orm
al daily
price
range
[…].
(2)IF
a S
tock p
rice that is h
eavily o
verb
ought or overs
old
TH
EN
I look for th
e p
rice
to a
ccele
rate
away[..]
3
Fuzzy Financial Systems
http://w
ww.stree
tdirec
tory.com/travel_guide/36574/investm
ent/candlestick_ch
arting___a_
pee
k_into_market_psy
chology.htm
l
Now, when
we wish to know how a stock, co
mmodity, cu
rrency
, or an entire
market is
beh
aving, we tend to find the ‘price’
of the instru
ment. Usu
ally w
e get a single number
for an entire
period. trading per
iod. Typically, th
e price quoted for th
e instru
men
t at th
e
end of a tra
ding (fractional) hour, day, week and so on
4
Fuzzy Financial Systems
http://w
ww.stree
tdirec
tory.com/travel_guide/36574/investm
ent/candlestick_ch
arting___a_
pee
k_into_market_psy
chology.htm
l
But, in rea
lity,
the price
s are
changing
during a
trading period,
going thro
ugh
highs and lows
–re
versal are
quite co
mmon
within a
per
iod
5
Fuzzy Financial Systems
http://finan
ce.google.com/finan
ce?client=ob&q=IN
DEXDJX
:DJI
But, in rea
lity,
the price
s are
changing
during a
trading period,
going thro
ugh
highs and lows
–re
versal are
quite co
mmon
within a
per
iod.
6
Fuzzy Financial Systems:
Observing change through candlesticks
Chiung-H
on Leo
n Lee, Alan Liu, and W
en-S
ung C
hen
(2006). ‘Pattern D
isco
very of Fuzz
y Tim
e Series for Finan
cial Prediction’. IE
EE Transa
ction on D
ata and K
nowledge
Engineering. V
ol18 (No. 5), pp 613-625.
The behaviour of financial
instruments over a period of time
shows that there is an inherent
fuzziness in this behaviour. T
he
behaviour shows characteristic
patterns –captured by the so-called
candle
stic
k p
attern
s used to display
the full range of behaviour during
the period of time. T
he range
includes the value of the instrument
at the beginning and end of the
trading period (called o
pen and
clo
se), and the highest and the lowest
values during trading (called h
igh
and low).
Usu
ally, only the closing value of the
instrument is cited.
Closing
Value
Bar
Chart
Can
dlestick
If
open
value is greater than closing value
then
paint the body w
hite
If
open
value is smaller than closing value
then
paint the body black
Ifopen
value is appro
x. eq
ual to closing
then
put hatched
lines in the body
7
Fuzzy Financial Systems:
Observing change through line breaks
Three line break
The three line break
chart is
similar in concept to point
and figure charts. The
decision criteria for
determining "reversals" are
somew
hat different. The
three-line break
chart looks
like a series of rising and
falling lines of varying
heights. Using closing price
s
(or highs an
d lows), a new
rising line is drawn if the
previous high is ex
ceed
ed. A
new
falling line is drawn if
the price
hits a new
low.
http://w
ww.linnsoft.com/tour/threeL
ineB
reak
Chart.htm
Daily FOREX EUR=,22
30
/11
/20
07
- 3
0/1
0/2
00
8 (
GM
T)
3L
nB
rk,
FO
RE
X E
UR
=,2
2
27
/10
/20
08
, 1
.26
22
, 1
.24
66
Pri
ce
US
D
.12
34
1.2
6
1.2
7
1.2
8
1.2
9
1.3
1.3
1
1.3
2
1.3
3
1.3
4
1.3
5
1.3
6
1.3
7
1.3
8
1.3
9
1.4
1.4
1
1.4
2
1.4
3
1.4
4
1.4
5
1.4
6
1.4
7
1.4
8
1.4
9
1.5
1.5
1
1.5
2
1.5
3
1.5
4
1.5
5
1.5
6
1.5
7
1.5
8
1.3
19
1
30
/11
/20
07
19
/12
/20
07
28
/12
/20
07
14
/01
/20
08
30
/01
/20
08
05
/03
/20
08
14
/03
/20
08
26
/03
/20
08
07
/05
/20
08
11
/08
/20
08
01
/09
/20
08
08
/09
/20
08
03
/10
/20
08
20
/10
/20
08
27
/10
/20
08
27
/10
/20
08
‘Three line break charts and T
echnical Analysis
8
Fuzzy Financial Systems
EykeHüllermeier
(2008). Fuzz
y sets in m
achine learning and data mining. Journ
al of Applied
Soft C
omputing (forthco
ming).
doi:10.1016/j.aso
c.2008.01.004
Data m
ining per
haps is one of th
e most important are
a
wher
e fu
zzy logic based system
s will see co
nsider
able
usa
ge.
Tra
ditionally, business analysts have per
form
ed the task
of ex
tracting usefu
l inform
ationfrom record
ed data, but
the increa
sing volume of data in m
oder
n business and
science
calls for co
mputer-based appro
ach
es.
Data m
ining involves the applica
tion of intelligen
t
pro
gra
ms for ex
tracting inform
ation fro
m record
ed data.
9
Fuzzy Financial Systems:
Recognizing patterns of change
Daily FOREX EUR=,22
02
/09
/20
08
- 2
4/1
1/2
00
8 (
GM
T)
Up
tre
nd
Do
wn
tre
nd
Cn
dl,
FO
RE
X E
UR
=,2
2,
Bid
15
/10
/20
08
, 1
.36
2,
1.3
68
5,
1.3
45
3,
1.3
46
Pri
ce
US
D
.12
34
1.2
6
1.2
9
1.3
2
1.3
5
1.3
8
1.4
1
1.4
4
1.4
85
5
08
15
22
29
06
13
20
27
03
10
17
24
September 2008
October 2008
November 2008
We
d 1
5/1
0/2
00
8
Candlesticks and T
echnical Analysis (C
ompressed over a day)
We ca
n use the
candlestick
patterns –a
collection of
candle stick
s-
to speculate
about th
e
reversals (or
otherwise) of
the instru
men
t
over a given
period of time.
10
Fuzzy Financial Systems:
Recognizing patterns of change
10 Minutes FOREX EUR=,22
01
:00
19
/11
/20
08
- 1
0:3
0 1
9/1
1/2
00
8 (
GM
T)
Cn
dl,
FO
RE
X E
UR
=,2
2,
Bid
10
:00
19
/11
/20
08
, 1
.26
06
, 1
.26
1,
1.2
59
8,
1.2
60
6
Pri
ce
US
D
.12
34
1.2
59
1
1.2
59
4
1.2
59
7
1.26
1.2
60
3
1.2
60
6
1.2
60
9
1.2
61
2
1.2
61
5
1.2
61
8
1.2
62
1
1.2
62
4
1.2
62
7
1.263
1.2
63
3
1.2
63
6
1.2
63
9
1.2
64
2
1.2
64
5
1.2
59
8
01
:10
01
:40
02
:10
02
:40
03
:10
03
:40
04
:10
04
:40
05
:10
05
:40
06
:10
06
:40
07
:10
07
:40
08
:10
08
:40
09
:10
09
:40
10
:10
19 November 2008
10
:00
We
d 1
9/1
1/2
00
8
Candlesticks and T
echnical Analysis (10 m
inute compression)
We can use the
candlestick
patterns –a
collection of
candle sticks-
to
speculate about
the reversals (or
otherw
ise) of the
instrument over
a given period of
time:will our
stra
tegy m
ay
change
dep
ending our
time horizo
ns?
11
Fuzzy Financial Systems:
On candlesticks
http://stock
charts.com/sch
ool/doku.php?id=ch
art_school:ch
art_an
alysis:introduction_to_ca
ndlesticks
Short body can
dlesticks indicate
little or no chan
ge in price and
perhap
s co
nso
lidation.
Long body can
dlesticks indicate
intense buying and selling
pressure
Patterns
Description
12
Fuzzy Financial Systems:
More on candlestick patterns
http://stock
charts.com/sch
ool/doku.php?id=ch
art_school:ch
art_an
alysis:introduction_to_ca
ndlesticks
Rising Three Methods: A
bullish
continuation pattern in w
hich a long w
hite
body is followed
by three sm
all body day
s,
each
fully contained
within the range of the
high and low of the first day
. The fifth day
closes at a new
high.
Aban
doned
Bab
y: A rare reversal pattern
characterized by a gap
followed
by a D
oji,
which is then
followed
by another gap
in the
opposite direction.
Patterns
Description
13
Fuzzy Financial Systems:
More on candlestick patterns
http://stock
charts.com/sch
ool/doku.php?id=ch
art_school:ch
art_an
alysis:introduction_to_ca
ndlesticks
Prior Trend R
eversal
Bullish rev
ersals req
uire a preceding downtren
d and bearish rev
ersals
require a prior uptren
d. The direction of the tren
d can
be determined
using
tren
d lines, moving averag
es, peak/trough analysis or other asp
ects of
tech
nical analysis. A
downtren
d m
ight ex
ist as long as the secu
rity w
as
trad
ing below its down trend line, below its previous reaction highor
below a specific m
oving averag
e. The length and duration w
ill dep
end on
individual preferences.
14
Fuzzy Financial Systems:
More on candlestick patterns
http://stock
charts.com/sch
ool/doku.php?id=ch
art_school:ch
art_an
alysis:introduction_to_ca
ndlesticks
Long Shadow R
eversal
There are tw
o pairs of single can
dlestick rev
ersal patterns mad
eup of a
small real body, one long shad
ow and one short or non-existent shad
ow.
15
Fuzzy Financial Systems:
More on candlestick patterns
Chiung-H
on Leo
n Lee
, Alan Liu, and W
en-S
ung C
hen (2006). ‘Pattern D
isco
very of Fuzzy Tim
e Series for Finan
cial Prediction’. IE
EE Tra
nsa
ction on D
ata
and K
nowledge Enginee
ring. V
ol18 (No. 5), pp 613-625.
We see a variety of patterns in the beh
aviour of prices
(open
/high/low/close) over a period of time. The pattternshav
e a
characteristic shap
e: Bullish engulfing, shooting star
16
Fuzzy Financial Systems:
Systems for recognizing patterns?
•There is a belief that the study of patterns for
iden
tifying reversa
ls and turning points can be
conducted
using candlestick patterns, line breaks and
so on.
•These methods are em
pirical and perhap
s throw
some light on investor psy
chology.
•The em
phasis here is on w
hat the
investors/traders/brokers do and need, rather than
what the modelers an
d sch
olars think how the markets
and peo
ple beh
ave.
17
Fuzzy Financial Systems:
Systems for recognizing patterns?
•There is a belief that the study of patterns for
iden
tifying reversa
ls and turning points can be
conducted
using candlestick patterns, line breaks and
so on.
•These methods are em
pirical and perhap
s throw
some light on investor psy
chology.
•The em
phasis here is on w
hat the
investors/traders/brokers do and need, rather than
what the modelers an
d sch
olars think how the markets
and peo
ple beh
ave.
18
Fuzzy Financial Systems
Chiung-H
on Leo
n Lee
, Alan Liu, and W
en-S
ung C
hen
(2006). ‘Pattern D
isco
very of Fuzz
y Tim
e Series for Finan
cial Prediction’. IE
EE
Tra
nsa
ction on D
ata and K
nowledge Enginee
ring. V
ol18 (No. 5), pp 613-625.
What is required
is a good knowledge representation
method for representing the knowledge of how to
relate a can
dlestick pattern to the movem
ent of the
instrumen
t/market.
Fuzzy logic based system
s have bee
n recen
tly dev
eloped
for
using candlestick data for acq
uiring and dep
loying
knowledge of financial pre
diction (Lee
, Liu and C
hen
2006).
The ru
les acq
uired
make th
e sy
stem
tra
nsp
arent and the
outp
ut highly visualisa
ble. This is usu
ally not th
e ca
se of
oth
er m
ethods like neu
ral nets, stoch
astic m
odeling.
19
Fuzzy Financial Systems
Chiung-H
on Leo
n Lee
, Alan Liu, and W
en-S
ung C
hen
(2006). ‘Pattern D
isco
very of Fuzz
y Tim
e Series for Finan
cial Prediction’. IE
EE
Tra
nsa
ction on D
ata and K
nowledge Enginee
ring. V
ol18 (No. 5), pp 613-625.
The key
notion here is that of a fuzzy tim
e series:
Imprecise data at equally spaced
discrete time points
are modeled
as fuzzy variables.
For individual ca
ndlesticks, T
he ra
ther
imprecise notions of
‘len
gth
’of th
e body
part, le
ngth
of th
e sh
adows (u
pper
and
lower
)are
form
alisedthro
ugh the use of fu
zzy sets and
spec
ifically thro
ugh m
ember
ship functions.
The linguistic variables for length are short, middle,
and long.
20
Fuzzy Financial Systems
Chiung-H
on Leo
n Lee
, Alan Liu, and W
en-S
ung C
hen
(2006). ‘Pattern D
isco
very of Fuzz
y Tim
e Series for Finan
cial Prediction’. IE
EE
Tra
nsa
ction on D
ata and K
nowledge Enginee
ring. V
ol18 (No. 5), pp 613-625.
For individual ca
ndlesticks, T
he ra
ther
impre
cise notions of ‘len
gth
’of th
e body
part
,
length
of th
e sh
adow
s (u
pper
and low
er)are formalisedth
rough the use of fu
zzy sets and
specifically thro
ugh m
embersh
ip functions.
Heu
ristic N
ote: These functions are described
for the Taiw
anese stock
market in one im
portant sense:
‘the vary
ing percentages of the stock
prices are lim
ited
to 14 percent in the Taiw
anese stock
market’
(Lee, Liu and C
hen
2006:616).
21
Fuzzy Financial Systems
Chiung-H
on Leo
n Lee
, Alan Liu, and W
en-S
ung C
hen
(2006). ‘Pattern D
isco
very of Fuzz
y Tim
e Series for Finan
cial Prediction’. IE
EE
Tra
nsa
ction on D
ata and K
nowledge Enginee
ring. V
ol18 (No. 5), pp 613-625.
For individual ca
ndlesticks, T
he ra
ther imprecise notions of ‘len
gth
’of th
e body
part
, le
ngth
of th
e
shadows (u
pper
and lower
)are form
alisedthro
ugh the use of fuzzy sets and specifically thro
ugh
membersh
ip functions.
Heuristic Note: These functions are described for the T
aiw
anese stock m
arket
in one important sense: ‘the varying percentages of the stock prices are lim
ited
to 14 percent in the T
aiw
anese stock m
arket’
(Lee, Liu and C
hen 2006:616). So
a a candlestick has definitely has SHORT
length
or bodyif the percentage
change in the instrument was betw
een 0.5 and 1.5; the evidence that the length
was SHORT
when the change w
as 2%
is 0.5, and any change above 2.5%
cannot be regard
ed as SHORT. Sim
ilarly, any change changein the length or
body above 5%
is definitely L
ONG.
22
Fuzzy Financial Systems
Chiung-H
on Leo
n Lee
, Alan Liu, and W
en-S
ung C
hen
(2006). ‘Pattern D
isco
very of Fuzz
y Tim
e Series for Finan
cial Prediction’. IE
EE
Tra
nsa
ction on D
ata and K
nowledge Enginee
ring. V
ol18 (No. 5), pp 613-625.
The key
notion here is that of a fuzzy tim
e
series: Im
precise data at equally spac
ed discrete
time points are m
odeled
as fuzzy variables.
Can
dlestick patterns involve more than
two
patterns. It is the relative lengths of these
patterns that result in idiosyncratic patterns.
Linguistic variables are defined
to cap
ture the
essence of the co
mparative nature of the
patterns at the open
ingan
d closing.
23
Fuzzy Financial Systems
Chiung-H
on Leo
n Lee
, Alan Liu, and W
en-S
ung C
hen
(2006). ‘Pattern D
isco
very of Fuzz
y Tim
e Series for Finan
cial Prediction’. IE
EE
Tra
nsa
ction on D
ata and K
nowledge Enginee
ring. V
ol18 (No. 5), pp 613-625.
For ca
ndlestick patterns that involve more than
two patterns. It is the relative lengths
of these patterns that result in idiosy
ncratic patterns. Linguistic variables are defined
to cap
ture the essence
of the co
mparative nature of the patternsat the open
ingan
d
closing. There are five linguistic variables for open
and close respec
tively: low,
equal_low, eq
ual, equal_highan
d high
‘The related positions of
the open
and close price to
the previous candlestick
line are used to m
odel the
open
style and the close
style.’(ibid:617)
24
Fuzzy Financial Systems
Chiung-H
on Leo
n Lee
, Alan Liu, and W
en-S
ung C
hen
(2006). ‘Pattern D
isco
very of Fuzz
y Tim
e Series for Finan
cial Prediction’. IE
EE
Tra
nsa
ction on D
ata and K
nowledge Enginee
ring. V
ol18 (No. 5), pp 613-625.
For ca
ndlestick patterns that involve more than
two patterns. It is the relative lengths
of these patterns that result in idiosy
ncratic patterns. Linguistic variables are defined
to cap
ture the essence
of the co
mparative nature of the patternsat the open
ingan
d
closing. There are five linguistic variables for open
and close respec
tively: low,
equal_low, eq
ual, equal_highan
d high
‘The related positions of
the open
and close price to
the previous candlestick
line are used to m
odel the
open
style and the close
style.’(ibid:617)
25
Fuzzy Financial Systems:
Observing change through candlesticks
Chiung-H
on Leo
n Lee, Alan Liu, and W
en-S
ung C
hen
(2006). ‘Pattern D
isco
very of Fuzz
y Tim
e Series for Finan
cial Prediction’. IE
EE Transa
ction on D
ata and K
nowledge
Engineering. V
ol18 (No. 5), pp 613-625.
The co
lourof th
e body can be
assigned
in relation to their
aggressive beh
aviour (b
ullish)
or
pass
ive beh
aviour
(bea
rish
).
The ca
ndlesticks ca
n be
assigned
the label b
ullish and
bea
rish
. A
nd, hed
ged
in
relation to the quality of
beh
aviour:
NO
RM
AL_BU
LLIS
H,
WEAK_BU
LLIS
H,
STRO
NG
_BU
LLIS
H, or
EXTR
EM
E B
ULLIS
H.
Sim
ilarly for
BEA
RIS
H.
Closing
Value
Bar
Chart
Can
dlestick
If
open
value is greater than closing value
then
the body colouris B
EARIS
H
If
open
value is smaller than closing value
then
the body colouris B
ULLIS
H
Ifopen
value is appro
x. eq
ual to closing
then
then
the variable is CROSS
26
Fuzzy Financial Systems
Chiung-H
on Leo
n Lee
, Alan Liu, and W
en-S
ung C
hen
(2006). ‘Pattern D
isco
very of Fuzz
y Tim
e Series for Finan
cial Prediction’. IE
EE
Tra
nsa
ction on D
ata and K
nowledge Enginee
ring. V
ol18 (No. 5), pp 613-625.
For candlestick patterns that involve more than
two patterns. W
e also
hav
e to define the deg
ree
of variation betwee
n two can
dlesticks: w
hether the variation showed
increa
se or dec
rease in the
lengths or the body, an
d w
hether or not the increa
se or decrease w
as larg
e, small, norm
al or
extrem
e.
Lee et al’s
prototype used a trading variation divided
into 7 or 8 intervals ranging from the
minim
um chan
ge Im
into a m
aximum chan
ge Im
ax an
d then
creating m
intervals.
u1=[-6,-4]…
……………….
u7=[6,8];
So the set A1 is a set of the
largest decremen
ts together w
ith
some elem
ents of norm
al
decremen
t. Conversely, A7 has
the largest increm
ents and some
elem
ents of norm
alincrem
ents.
27
Fuzzy Financial Systems
Chiung-H
on Leo
n Lee
, Alan Liu, and W
en-S
ung C
hen
(2006). ‘Pattern D
isco
very of Fuzz
y Tim
e Series for Finan
cial Prediction’. IE
EE
Tra
nsa
ction on D
ata and K
nowledge Enginee
ring. V
ol18 (No. 5), pp 613-625.
For candlestick patterns that involve more than
two patterns. W
e also
hav
e to define the deg
ree
of variation betwee
n two can
dlesticks: w
hether the variation showed
increa
se or dec
rease in the
lengths or the body, an
d w
hether or not the increa
se or decrease w
as larg
e, small, norm
al or
extrem
e.
Lee et al’s
prototype used a trading variation divided
into 7 or 8 intervals ranging from the
minim
um chan
ge Im
into a m
aximum chan
ge Im
ax an
d then
creating m
intervals.
u1=[-6,-4]…
……………….
u7=[6,8];
So the set A1 is a set of the
largest decremen
ts together w
ith
some elem
ents of norm
al
decremen
t. Conversely, A7 has
the largest increm
ents and some
elem
ents of norm
alincrem
ents.
28
Fuzzy Financial Systems
Chiung-H
on Leo
n Lee
and Alan Liu (2006). ‘A Finan
cial D
ecision Supporting System
Based
on Fuzz
y C
andlestick Patterns’. Pro
c. of the
9th Joint Conf.onInform
ation Scien
ces. Paris: Atlan
tis Press. (http://w
ww.atlan
tis-press.com/publica
tions/aisr/jcis-
06/index
_jcis.htm
l?http%3A//www.atlan
tis-press.com/php/pap
er-details.php%3Fid%3D58).
A
candlestick
patter
n for a
fuzzy tim
e
series:
29
Fuzzy Financial Systems
Chiung-H
on Leo
n Lee
, Alan Liu, and W
en-S
ung C
hen
(2006). ‘Pattern D
isco
very of Fuzz
y Tim
e Series for Finan
cial Prediction’. IE
EE
Tra
nsa
ction on D
ata and K
nowledge Enginee
ring. V
ol18 (No. 5), pp 613-625.
Lee et al’s
system
computes which of the variation sets
a candlestick pattern belongs to:
30
Fuzzy Financial Systems
Chiung-H
on Leo
n Lee
, Alan Liu, and W
en-S
ung C
hen
(2006). ‘Pattern D
isco
very of Fuzz
y Tim
e Series for Finan
cial Prediction’. IE
EE
Tra
nsa
ction on D
ata and K
nowledge Enginee
ring. V
ol18 (No. 5), pp 613-625.
Some of the heu
ristics iden
tified
by Lee et al include:
31
Fuzzy Financial Systems
Chiung-H
on Leo
n Lee
, Alan Liu, and W
en-S
ung C
hen
(2006). ‘Pattern D
isco
very of Fuzz
y Tim
e Series for Finan
cial Prediction’. IE
EE
Tra
nsa
ction on D
ata and K
nowledge Enginee
ring. V
ol18 (No. 5), pp 613-625.
An initial ev
aluation of Taiwan
ese Stock
Market data,
used both for training and testing shows en
couraging
resu
lts.
The sy
stem
is reporteely
being used for teaching and
learning.
Recommended