Content uploaded by Uduak A. Umoh
Author content
All content in this area was uploaded by Uduak A. Umoh on Oct 05, 2015
Content may be subject to copyright.
International Journal of Computer Applications (0975 – 8887)
Volume 103 – No.3, October 2014
1
Sugeno-Type Fuzzy Inference Model for
Stock Price Prediction
Uduak A. Umoh
Department of Computer Science, University of
Uyo, Akwa Ibom State, Nigeria
Alfred A. Udosen
Department of Computer Science, University of
Uyo, Akwa Ibom State, Nigeria
ABSTRACT
The operations of the prediction of stock price are complex
and risky due to fluctuation in the stock market because of the
vagueness, incompleteness, and uncertainty of the information
used. However, it is therefore as a matter of necessity to seek
to foresee stock prices because traders need to know when to
invest in order to get the maximum return of the investment.
This paper proposes a Sugeno-type fuzzy inference system for
stock price prediction using technical indicators as its input
values. Knowledge Base, Fuzzification, Inference Engine and
Defuzzification are the essential components of our model.
We explore Sugeno-type fuzzy inference engine to optimize
the estimated result. We evaluate the degree of participation
of each input parameter with Trapezoidal membership
function. Center of Gravity technique is employed for
defuzzification. We employ object oriented design tool to
model our database. MATLAB and fuzzy relational database
are used in the implementation of our study. The development
of this system is based on the selection of stock data history
which are studied and used for training the system. This
system provides vital support to stock traders, researchers and
other financial experts in making decisions as regards stock
trading.
General Terms
Soft Computing, Artificial Intelligence, Fuzzy Logic Model,
Database management System, Stock Market.
Key Words
Fuzzy Logic, Stock Price, Technical indicators, Trapezoidal
membership function, Object Oriented Tool.
1. INTRODUCTION
The operations of the prediction of stock price are complex
and risky due to fluctuation in the stock market because of the
vagueness, incompleteness, and uncertainty of the information
used. Stock trading is the process of buying and selling of
stocks based on known signals which can be predicted based
on past stock data. Stock price prediction involves the steps
taken to determine the future value of a company’s stock
traded on a financial exchange; making business more
profitable as well as making reasonable recommendations as
regards stock trading. The accurate predictions of stock price
are important for many reasons, chief among these are the
need for the investors to hedge against potential market risk
and to make profit by trading indexes [1]. Stock is the
representation of the ownership in the share of profit, assets,
and losses of a company; it is created when a business carves
itself into pieces of units called shares and sells them to
investors in exchange for cash and stock price is the cost of
purchasing or selling a security on an exchange. Predicting
stock price has over time been a subject of interest for many
financial investors and professional analysts because finding
out the appropriate time to sell or buy stock has been a very
difficult task as there are too many unknown factors of
uncertainty and volatility that have direct influence on stock
prices [2] [3].
The prediction of stock price is a highly complicated and very
difficult task because there are too many factors such as
inflation, short term interest rate, political events, traders’
expectations, and environmental factors amongst others that
also affect stock price. In addition, stock price series are
generally quite noisy, dynamic, nonlinear, complicated,
nonparametric, and chaotic by nature [4]. However, the
introduction of technology and digital computerization in
stock price prediction has paved the way for financial support
systems to be developed to make prediction easy. The
utilization of intelligent systems such as neural networks,
fuzzy logic and genetic algorithms for the purpose of
prediction in the field of finance has extensive applications
[5]. Several technical indicators are being used in stock price
prediction with varying results, they include: Accumulation
Distribution Line, Force Index, Money Flow Index, Average
True Range, Percentage Price Oscillator, Record High
Percentage and Ease of Movement amongst others. Fuzzy
logic, artificial neural network, belief calculus, and genetic
algorithms amongst others are part of a branch of Artificial
Intelligence called soft computing that is essentially used to
exploit the tolerance for imprecision, uncertainty, and partial
truth in order to achieve tractability, robustness, and low
solution cost. [6] defines fuzzy logic as a set of mathematical
principles based on degrees of membership rather than
classical binary logic that is used for knowledge
representation.
This paper proposes Sugeno-type adaptive fuzzy inference
system that uses the results of some technical indicators as
inputs in combination with the firing strengths of fuzzy rules
to make future predictions that can generate buy (low) and sell
(high) signals in order to achieve maximum profit. We
develop our model using stock data history which is studied
and the results computed in the range of predefined limit by a
domain expert. We employ MATLAB toolbox and Java
programming language and fuzzy relational database to
implement our model. The model provides vital support to
stock traders, researchers and other financial experts in
making decisions as regards stock trading.
Section II presents literature review of the prediction system
and the inherent concepts. Section III discusses the analysis of
the proposed system IV discusses the design of the model
while section V presents the system implementation. Section
VI gives a brief conclusion.
International Journal of Computer Applications (0975 – 8887)
Volume 103 – No.3, October 2014
2
2. LITERATURE REVIEW
[7] develop a Takagi–Sugeno–Kang-type fuzzy rule-based
system for forecasting Taiwan Stock Exchange price
deviation. This model successfully forecasts stock price
variation with accuracy close to 97.6% in TSE index and
98.08% in MediaTek. [8] develop a hierarchical fuzzy logic
system using genetic algorithm to predict the interest rates in
Australia. Using a genetic algorithm as a training method for
learning the fuzzy rules, the number of rules could be reduced
significantly, resulting in more efficient systems. [9] follows a
similar approach with a fuzzy inference system, but with other
indicators to predict the stock market. The results combining
technical analysis and fuzzy logic were very promising. [10]
describes a fuzzy based trading system to predict market price
movements for investing in portfolio of European, American
and Japanese bonds and currency. The system generates a buy
or sell signal, but it can also be combined with portfolio
allocation mechanisms for automated trading. [11] investigate
the current trend of stock price of the Iran Khodro
Corporation at Tehran Stock Exchange by utilizing an
adaptive fuzzy- neural inference system.
[12] investigate performance analysis of stock price prediction
using artificial neural network. The models are used to predict
the future stock prices and their performance statistics
evaluated. This helps the investor to analyze better in business
decisions such as buy or sell a stock. [13], proposes a fuzzy
engine model that acts as an expert indicator that can generate
buy and sell signals. The fuzzy engine model combines the
most popular technical indicators with their firing strengths to
provide a new fuzzy indicator that achieves good results
compared to the other traditional indicators. Experiments are
conducted to evaluate the performance of the model and the
results prove that the fuzzy engine model gives more reliable
buy and sell positions in different time horizons compared to
other technical indicators. [14] examine type-2 fuzzy rule
based expert system for stock price analysis. The proposed
type-2 fuzzy model applies the technical and fundamental
indices as the input variables. The model is tested on stock
price prediction of an automotive manufactory in Asia with
encouraging results. [15] introduce an intelligent decision-
making model, based on the application of Fuzzy Logic and
Neurofuzzy system (NFs) technology that decide a trading
strategy for each day and produce a high profit for each stock.
The model is used to capture the knowledge in technical
indicators for making decisions such as buy, hold and sell and
the experimental results shows higher profits. [16] study
fuzzy stock prediction system that integrates the novel
computer technologies of stepwise regression analysis (SRA),
auto-clustering analysis, recursive least-squares (RLS) and
particle swarm optimization (PSO) learning schemes. [17]
investigate fuzzy wavelet neural networks for prediction of
stock prices. The paper is constructed on the base of a set of
TSK fuzzy rules that includes a wavelet function in the
consequent part of each rules and train with differential
evaluation (DE) algorithm.
[18] Study stock trend prediction system based on Artificial
Neural Network (ANN) and fuzzy logic rules using technical
indicators and Elliott’s wave theory. In this approach the
neural network functions as a classifier, where the technical
analysis indicators are its input features. The multilayer
perceptron (MLP), Support Vector Machine (SVM) and
Radial Bases Function (RBF) are tested as classification tools.
[19] carry out a probe in a sample of the whole population of
the study involves the data and financial record of SAIPA
auto-making company which is a member of Iranian stock, for
prediction of stock price. The prediction is done using linear
and nonlinear models for one ahead and multi ahead in stock
price by using exogenous variable of stock market cash index,
and the results show the preference of nonlinear neural-Fuzzy
model to classic linear model and verify the capabilities of
Fuzzy-neural networks in this prediction. [20] investigate
analysis on Stock Market Prediction using Data Mining
Techniques for evaluation of past stock prices. [21] examine
the capability of an ANFIS algorithm to accurately predicting
stock market return of the Istanbul Stock Exchange (ISE). The
study use six macroeconomic variables and three indices as
input variables. The experimental results reveal that the model
successfully forecasts the monthly return of ISE National 100
Index with an accuracy rate of 98.3%. ANFIS provides a
promising alternative for stock market prediction. [22] study
fuzzy rule-based framework for effective control of
profitability in a paper recycling plant. [23] present fuzzy-
neural network model for effective control of profitability in a
paper recycling plant. [24] study fuzzy-neural networks
approach to model the prediction of stock price. The
investigation of neural networks and Autoregressive
Integrated Moving Average (ARIMA) models of price data in
this research showed unique properties of high precision,
quick convergence, strong ability of function approximation,
and in operation criteria they showed noticeable superiority in
prediction. A fuzzy-neural system to predict financial time
series is described by [25]. The prediction of stock and option
prices of the S&P and Dow Jones indices is examined, which
results in profitable trading strategies.
3. ANALYSIS
The historical stock data for this project is obtained from the
Nigerian Stock Exchange, Uyo which is located at Udo
Udoma Avenue, Uyo, Akwa Ibom State. Established in 1960
as the Lagos Stock Exchange, it became known as The
Nigerian Stock Exchange in December 1977 with about
twelve branches having an electronic trading floor each for
real-time stock trading through a network of computers
connected to a server. The main concern of Nigerian Stock
Exchange is to determine the appropriate time to buy, hold or
sell stocks. System analysis involves the systematic study of
the structure of an adaptive fuzzy neural system model for the
prediction of the trends in stock prices. The data collection
method, analysis of case study will be explained as well as the
architecture of the system design. For this project, stock data
history for one year was gathered from interviews and written
documents from the Nigerian Stock Exchange in Uyo, Akwa
Ibom State. The price lists of daily transactions contains open
prices, low prices, high prices, close prices and volume which
are equated into different mathematical models called
technical indicators that are used for stock prediction. The
stock data history collected and used in this system was gotten
from Zenith Bank. Stock price prediction is majorly
concerned with the use of the history of stock prices gathered
in order to tell of its future. The data could be structured,
unstructured, static, dynamic, numerical, symbolic, precise or
imprecise, certain or uncertain. The system design involves
setting of standards to be duly observed during system
implementation like variable naming, modularity, coupling,
commenting issues, control issues and cohesion in the
analysis and design of the system for effective profit
optimization.
International Journal of Computer Applications (0975 – 8887)
Volume 103 – No.3, October 2014
3
4. DESIGN
4.1 SFNISSPP Architecture
The conceptual architecture of our model is based on [23] and
presents in Figure 1. The conceptual architecture comprises
the following: The Knowledge Base, Adaptive fuzzy model
and user interface.
The knowledge base design of the Sugeno-type fuzzy
inference system for stock price prediction comprises of
database model and mathematical model. It stores both static
and dynamic information about the decision variables. This
knowledge base is made up of facts, rules and stock price
technical indicators extracted from both structured and
unstructured knowledge of experts in the problem domain.
The structured knowledge is qualitative while unstructured
knowledge is acquired by the stock trading experts through
experience.
4.2 SFNISSPP Database Model
Figure 2 shows the database model for stock price prediction.
SFNISSPP Relationship Diagram is shown in Figure Table 1
shows Company Registration Table with their associated
attributes. Table 2 presents Stock Report Table.
COMPANY_REGISTRATION [Company_name collects
Company’s name, Open_price collects stock’s open price,
Low_price collects stock’s close price, High_price collects
stock’s high price, Close_price, Volume collects stock’s
volume price] where Company_name is the primary key.
STOCK_REPORT [Technical _indicators collects the
mathematical model for the technical indicator used,
Recommendation collects the recommended action to take
either to Buy, Hold or Sell stock, Date collects the dates of the
respective transaction, Company_name collects company’s
name] where Technical _indicators is the primary key.
Unstructured
Knowledge Base
Database Model
Mathematical Model
Adaptive Fuzzy
Model
User Interface
Structured
Unstructured
Knowledge Engine
Environmental factors, input variables: open
prices, low prices, high prices, close prices and
volume, financial experts, stock traders, bankers,
etc.
Stock Report
Company Registration
SFNISSPP Database
Company_name
Open_price
Low_price
High_price
Close_price
Volume
Technical _indicators
Accuracy
Recommendation
Company_name
Fig. 1: Adaptive Sugeno Fuzzy System Architecture for Stock Price Prediction
Fig 2 SFNISSPP Database Model for Stock Price Prediction
International Journal of Computer Applications (0975 – 8887)
Volume 103 – No.3, October 2014
4
Table 1: Company Registration Table
Table 2: Stock Report Table
Fields
Data type
Size
Technical_indicators
Float
10,2
Date
Char
-
Recommendation
Char
100
Company_name
Char
50
Fig. 3: SFNISSPP Relationship Diagram
4.3 Mathematical Model
Technical indicators are used to show price actions (changes
in price); they form the input parameters to the developed
system. Stock data are collected from the Nigerian Stock
Exchange and used for the work as shown in Table 3. The
past values of open, low, high and close prices and the
volumes of a particular stock are recorded for a sequence of
days and stored in database to train the system.
Table 3: Stock price list from the Nigerian Stock
Exchange.
Y
Date
Open
Low
High
Close
Volume
Wed.
05-Dec
14.9
14.79
14.9
14.79
14,302,790
Tues.
04-Dec
14.9
14.8
14.91
14.81
12,141,405
Mon.
03-Dec
14.88
14.88
14.91
14.89
5,706,231
Fri.
30-Nov
14.71
14.71
14.89
14.89
18,310,264
Tues.
16-Oct
17
17
17.13
17.01
35,780,706
Mon.
15-Oct
17
16.66
17
16.78
16,014,431
Fri.
12-Oct
16.94
16.94
17.01
16.95
42,499,228
Thurs.
11-Oct
16.7
16.6
17
16.95
17,836,610
Wed.
10-Oct
16.54
16.21
16.99
16.71
37,314,859
Tues.
09-Oct
15.85
15.85
17
16.87
34,615,587
Mon.
08-Oct
15.53
15.52
15.9
15.85
18,074,247
Fri.
05-Oct
15.49
15.15
15.6
15.52
21,162,323
Thurs.
04-Oct
15.1
15.1
15.53
15.55
13,059,154
Wed.
03-Oct
14.99
14.97
15.05
15
22,517,867
Tues.
02-Oct
14.99
14.85
15
14.96
17,180,736
Fri.
28-Sep
14.97
14.8
15.72
14.85
42,426,490
Thurs.
27-Sep
14.6
14.6
14.99
14.99
19,195,073
Wed.
26-Sep
14.51
14.49
14.7
14.63
22,417,338
Tues.
25-Sep
14.51
14.5
14.56
14.55
18,349,956
Mon.
24-Sep
14.48
14.47
14.55
14.51
23,547,805
Fri.
21-Sep
14.48
14.48
14.53
14.5
9,636,587
Thurs.
20-Sep
14.51
14
14.51
14.45
19,562,206
Wed.
19-Sep
14.5
14.5
14.55
14.51
35,102,272
Tues.
18-Sep
14.48
14.34
14.53
14.5
17,288,478
Mon.
17-Sep
14.5
14.4
14.55
14.5
67,776,946
Fri.
14-Sep
14.5
14.5
14.8
14.5
31,288,044
Thurs.
13-Sep
14.4
14.33
14.49
14.45
12,938,303
Wed.
12-Sep
13.9
13.82
14.5
14.41
26,745,236
Tues.
11-Sep
14.11
13.85
14.11
13.98
24,615,757
Mon.
10-Sep
14.35
14.16
14.35
14.3
16,405,985
Fri.
07-Sep
14.15
14.11
14.81
14.31
25,347,297
Thurs.
06-Sep
13.95
13.81
14.35
14.11
16,281,079
Wed.
05-Sep
13.72
13.16
13.9
13.85
32,630,029
Tues.
04-Sep
13.45
13.41
13.79
13.71
27,008,561
Mon.
03-Sep
13.4
13.4
13.52
13.46
18,229,340
Fri.
31-Aug
13.62
13.38
13.63
13.5
28,426,429
Thurs.
30-Aug
13.55
13.55
13.67
13.62
26,775,165
Wed.
29-Aug
13.3
13.3
13.52
13.51
12,744,752
Tues.
28-Aug
13.06
13.06
13.27
13.25
17,988,891
Mon.
27-Aug
13.08
13.06
13.12
13.11
17,068,097
Fri.
24-Aug
12.9
12.77
13.1
13.05
34,439,317
Thurs.
23-Aug
12.55
12.54
12.97
12.9
18,883,885
Wed.
22-Aug
12.52
12.5
12.55
12.52
19,437,131
Fri.
17-Aug
12.4
12.39
12.5
12.46
16,096,079
Thurs.
16-Aug
12.38
12.3
12.4
12.31
10,362,825
Wed.
15-Aug
12.1
12.1
12.38
12.37
44,347,013
Tues.
14-Aug
12.1
12.1
12.13
12.1
16,811,100
Mon.
13-Aug
12.08
12.08
12.3
12.1
29,188,476
Fri.
10-Aug
12
12
12.09
12.07
11,402,231
Thurs.
09-Aug
12.16
12
12.17
12
16,892,854
Wed.
08-Aug
12.1
12.1
12.28
12.17
20,455,699
Tues.
07-Aug
11.82
11.62
12.2
12.1
61,871,149
Mon.
06-Aug
11.9
11.7
11.94
11.7
4,939,578
Fri.
03-Aug
11.99
11.9
12.01
11.94
20,606,478
Thurs.
02-Aug
12
12
12.01
12
31,419,030
Fields
Data type
Size
Date
Char
-
Open_price
Float
6,2
Low_price
Float
6,2
High_price
Float
6,2
Close_price
Float
6,2
Volume
Float
6,2
1
1
1
1
Stock Report
PK Technical _indicators
FK Date
Accuracy
Recommendation
Company_name
Company Registration
PK Company_name
FK Date
Open_price
Low_price
High_price
Close_price
Volume
1
International Journal of Computer Applications (0975 – 8887)
Volume 103 – No.3, October 2014
5
Wed.
01-Aug
11.47
11.47
11.63
11.6
8,078,054
Tues.
31-Jul
11.4
11.4
11.45
11.43
16,407,752
Mon.
30-Jul
11.45
11.4
11.5
11.4
21,747,712
Fri.
27-Jul
11.52
11.45
11.6
11.42
9,898,487
Thurs.
26-Jul
11.81
11.5
11.81
11.51
16,859,604
Wed.
25-Jul
11.9
11.87
12.02
11.87
52,764,435
Tues.
24-Jul
11.8
11.8
12
11.86
57,341,109
Mon.
23-Jul
11.84
11.76
11.9
11.82
25,756,277
Fri.
20-Jul
11.85
11.5
11.85
11.7
19,611,606
Thurs.
19-Jul
12.17
11.7
12.27
11.9
38,941,703
Wed.
18-Jul
11.8
11.8
12.25
12.16
21,138,375
Tues.
17-Jul
11.57
11.56
11.79
11.73
18,860,845
Mon.
16-Jul
11.27
11.27
11.59
11.55
12,739,375
Fri.
13-Jul
11.26
11.26
11.35
11.33
15,060,058
Thurs.
12-Jul
11.2
11.2
11.28
11.26
19,099,134
Wed.
11-Jul
11.3
11.2
11.3
11.2
22,118,364
Tues.
10-Jul
11.2
11.2
11.25
11.26
17,999,958
Mon.
09-Jul
11.23
11.17
11.3
11.2
7,480,203
Fri.
06-Jul
11.16
11.16
11.26
11.26
10,199,147
Thurs.
05-Jul
11.05
11.05
11.25
11.15
19,152,926
Wed.
04-Jul
11.2
11
11.3
11.01
20,658,927
Tues.
03-Jul
11
11
11.23
11.2
21,853,101
Mon.
02-Jul
10.9
10.9
11.05
11.02
15,391,658
Fri.
29-Jun
10.71
10.71
11
10.91
10,283,889
Thurs.
28-Jun
10.78
10.6
10.82
10.76
7,076,971
Wed.
27-Jun
10.9
10.86
10.91
10.88
10,419,922
Tues.
26-Jun
10.91
10.89
10.94
10.9
11,291,494
Mon.
25-Jun
10.9
10.78
10.92
10.91
10,419,904
Fri.
22-Jun
10.99
10.93
11.02
10.93
10,047,120
Thurs.
21-Jun
11.02
10.99
11.05
10.98
17,976,500
Wed.
20-Jun
10.7
10.7
11.05
10.93
13,017,139
Tues.
19-Jun
10.52
10.52
10.65
10.68
10,615,374
Mon.
18-Jun
10.6
10.6
10.63
10.63
14,507,356
Fri.
15-Jun
10.52
10.51
10.67
10.6
16,866,915
Thurs.
14-Jun
10.54
10.51
10.65
10.56
23,420,226
Wed.
13-Jun
10.5
10.5
10.65
10.6
14,361,438
Tues.
12-Jun
10.61
10.47
10.64
10.55
21,052,462
Mon.
11-Jun
10.6
10.53
10.74
10.61
23,963,459
Fri.
08-Jun
11.31
10.75
11.31
10.8
21,423,190
Thurs.
07-Jun
11.35
11.3
11.43
11.3
31,087,754
Wed.
06-Jun
11.31
11.3
11.4
11.32
30,881,976
Tues.
05-Jun
11.5
11.15
11.5
11.3
37,903,273
Mon.
04-Jun
11.5
11.5
11.6
11.51
94,103,055
Fri.
01-Jun
11.37
11.37
11.55
11.5
27,672,476
Thurs.
31-May
11.36
11.36
11.53
11.52
30,112,085
Wed.
30-May
11.2
11.17
11.55
11.5
37,841,960
Mon.
28-May
11.4
11.4
11.52
11.5
20,468,799
Fri.
25-May
11.23
11.23
11.5
11.41
18,037,497
Thurs.
24-May
11.3
11.2
11.4
11.2
27,548,022
Wed.
23-May
10.91
10.9
11.35
11.29
51,201,124
Tues.
22-May
10.55
10.55
10.95
10.9
29,881,963
Mon.
21-May
10.74
10.54
10.74
10.6
12,294,365
The details of the parameters used in stock price prediction
based on [26] are modified and evaluated as follows:
4.3.1 Chaikin Money Flow
This measures the amount of money flow volume over a
specific period of time, typically 20 or 21 days. The resulting
indicator fluctuates above and below the zero line just like an
oscillator to identify changes on money flow. It’s presented
in (1) – (3).
Money Flow Multiplier =
(1)
Money Flow Volume (2)
20-period Chaikin Money Flow, CMF =
(3)
4.3.2 Force Index
Force Index is an indicator that uses price and volume to
assess the power behind a move or identity possible turning
points and is calculated in (4)-(5).
FI
(4)
13-Period FI =
(5)
4.3.3 Ease of Movement (EMV)
The ease of movement (EMV) is a technical indicator that
converts the information of the equivolume chart into a
numerical equivalent. The calculation is shown in (6)-(9).
Distance Moved
(6)
Box Ratio (7)
1-Period EMV = Distance Moved/ Box Ratio (8)
14-Period Ease of Movement = 14-Period simple moving
average of 1-period EMV =
(9)
4.3.4 Trend Index
We design Trend Index (TI) model as shown in Figure 5 and
(10), after a careful study of the candle sticks used in
monitoring the trends in the prices of stocks in the stock
market as shown in Figure 5. A number greater than zero
indicates a rise in the (positive) trend and a sell of stock is
encouraged, a zero indicates a state of no visible change
(stagnation point), where traders are advised to halt trading
and observe the direction in which the market will follow.
Finally, a number below zero shows a fall in the market
(negative) trend and a buy of stock is encouraged.
International Journal of Computer Applications (0975 – 8887)
Volume 103 – No.3, October 2014
6
Fig. 4: Stock market candle stick model
14-period TI =
(10)
Where H = High, C = Close, O =Open, and L = Low.
This indicator so developed seems to yield the best of results
in stock price prediction based on its computational analysis
as compared to the other technical indicators used.
5. SUGENO-FUZZY INFERENCE
SYSTEM MODEL FOR STOCK PRICE
PREDICTION
Fuzzy logic model of stock price prediction is presented in
Figure 5.
Fuzzification is the process of changing a real scalar (crisp)
value into a fuzzy value through a membership function to
determine an output. In this paper, technical indicators, Ease
of Movement (EMV), Force Index (FI), Chaikin Money Flow
(CMF) and Trend Index (TI) form the input parameters used
in Fuzzy Logic Model. The fuzzy linguistics terms are defined
for both the inputs and output variables and their
corresponding membership functions are evaluated using
Trapezoidal membership function due to its computational
efficiency.
The fuzzy linguistics variables are defined on each input
parameter as follows:
Ease of Movement, EMV {LOW, MEDIUM, HIGH}
Force Index, FI {LOW, MEDIUM, HIGH}
Chaikin Money Flow, CMF {LOW, MEDIUM, HIGH}
Trend Index, TI {LOW, MEDIUM, HIGH}
Price Movement {POSITIVE, NO CHANGE, NEGATIVE}
SFNISSPP universe of discourse is selected for input
parameters as; [-1, 1] for Chaikin Money Flow, Force Index,
Ease of Movement respectively, [-2, 2] for Trend Index and
[0, 1] for Output parameter.
Layer 1: In this layer, the crisp input values are converted to
the fuzzy values by the input MFs. In this paper, we employ
Trapezoidal membership functions method in (11) and are
evaluated for i = (3), j = (1, 2, and 3), x = (EMV, FI, CMF and
TI) respectively in (12) – (24) as follows:
High
Close
Open
Low
PM
ᾱ1Z1
ᾱ40Z40
ᾱ81Z81
ᾱ81Z81
ᾱ1Z1
α1
α81
EMF
FI
CMF
TI
L11
M12
H13
L
L21
M22
H23
L
L31
M32
H33
L
L41
M42
H43
L
∏1
∏
∏2
∏40
∏80
∏81
N1
∏
N2
N40
N80
N81
Z81 = r81(EMF, FI, CMF, TI)
Z80 = r80(EMF, FI, CMF, TI)
Z40 = r40(EMF, FI, CMF, TI)
Z2 = r2(EMF, FI, CMF, TI)
Z1 = r1(EMF, FI, CMF, TI)
∑
Fuzzy
Layer
(L1)
Product
Layer
(L2)
Normalized
Layer
(L3)
Defuzzification
Layer
(L4)
Summation
Layer
(L5)
ᾱ81
ᾱ80
ᾱ40
ᾱ1
Input
Variables
Fig 5: Sugeno Fuzzy Logic Model of stock price prediction
l
l
l
l
l
l
diction
0, if x < aij
0, if x ≥ dij
(x- aij)/ (bij -aij), if aij ≤ x < bij
1, if bij ≤ x < cij
(11)
µTrapij(x) =
(dij -x)/ (dij -cij), if cij ≤ x < dij
International Journal of Computer Applications (0975 – 8887)
Volume 103 – No.3, October 2014
7
where aij , bij , cij , and dij are the premise parameters that
characterize the shapes of the input MFs.
Ease of Movement (EMV)
Force Index (FI)
Trend Index (TI)
Price Movement (PM)
We obtain our rule base from derivation based on the stock
history records, expert experience and control engineers. In
this paper, the number of MFs for the input variables EMF,
FI, CMF and TI are determined as 3, 3, 3, and 3, respectively.
Each possible combination of inputs and their associated MFs
is represented by a rule in the rule base of the Sugeno FIS
models. So, the number of rules for FIS models is 81 (3 × 3 ×
3 × 3 = 81). The application of the Sugeno FIS models to the
stock price prediction calculation is given in the following
sections. From our knowledge base, 81 rules are defined for
the rule base for the decision making unit as shown in Figure
12.
0.096(x+0.356)/0.0693 if -0.356 ≤ x
< -0.287
0.267(-0.1487-x)/ 0.0693 if -0.218 ≤ x
<-0.1487
0 if x < -0.356
0 if x ≥ -0.1487
1 if -0.287≤ x <-0.218
(12)
µLow(x) =
0 if x < -0.147
0 if x ≥ 0.0609
(x+0.147)/0.0693 if -0.147 ≤ x < -0.0777
1 if -0.0777 ≤ x <-0.0084
(13)
µMedium(x
) =
(0.0609-x)/0.0693 if -0.0084 ≤ x < 0.0609
0 if x < 0.0509
0 if x ≥ 0.2588
(x-0.0509)/0.0693 if 0.0509 ≤ x < 0.1202
1 if 0.1202≤ x < 0.1895
(14)
µHigh(x) =
(0.2588-x)/0.0693 if 0.1895≤ x < 0.2588
0 if x < -0.19231
0 if x ≥ -0.088
(x+0.19231)/0.0348 if -0.19231≤ x < -0.1575
1 if -0.1575≤ x < -0.1228
(15)
µLow(x) =
(-0.088+x)/ 0.0348 if -0.1228 ≤ x < -0.088
0 if x < -0.08
0 if x ≥ 0.0163
(x+0.08)/0.0348 if -0.08 ≤ x < -0.05323
1 if -0.05323 ≤ x < -0.0185
(16)
µMedium(x) =
(0.0163-x)/ 0.0348 if -0.0185≤ x < 0.0163
0 if x < -0.2450
0 if x ≥ 0.012
(x+0.2450)/0.086 if -0.2450≤ x < -0.1595
1 if -0.1595≤ x < -0.074
(19)
µMedium(x) =
(-0.074-x)/ 0.086 if -0.074≤ x < 0.012
0 if x < 0.015
0 if x ≥ 0.0154
(x-0.015)/0.0348 if 0.015 ≤ x < 0.0498
1 if 0.0498 ≤ x < 0.11934
(17)
µHigh(x) =
(0.0154-x)/ 0.0348 if 0.11934≤ x < 0.0154
0 if x < -0.5035
0 if x ≥ -0.2471
(x+0.5035)/0.085 if -0.5035≤ x < -0.4181
1 if -0.4181≤ x < -0.3326
(18)
µLow(x) =
(-0.2471-x)/ 0.085 if -0.0185≤ x < -0.2471
0 if x < 0.01
0 if x ≥ 0.267
(x-0.01)/0.086 if 0.01≤ x <
1 if 0.096 ≤ x < 0.181
(20)
µHigh(x) =
(0.267-x)/ 0.086 if 0.181≤ x <
0 if x < -0.47
0 if x ≥ -0.164
(x+0.47)/0.102 if -0.47≤ x < -0.368
1 if -0.368≤ x < -0.266
(21)
µLow(x) =
(-0.266-x)/ 0.102 if -0.266 ≤ x < -0.164
0 if x < -0.15
0 if x ≥ 0.156
(x+0.15)/0.102 if -0.15 ≤ x < -0.048
1 if -0.048 ≤ x < 0.054
(22)
µMedium(x) =
(0.156-x)/ 0.102 if 0.054 ≤ x < 0.156
0 if x < 0.146
0 if x ≥ 0.452
(x- 0.146)/0.102 if 0.146 ≤ x < 0.248
1 if 0.248 ≤ x < 0.35
(23)
µHigh(x) =
(0.452-x)/ 0.102 if 0.35 ≤ x < 0.452
.24)
0 (Negative) if x < -1
1 (Positive) if 0.5 ≤ x < 1
0.5 (No Change) if -1 ≤ x < 0.5
µPriceMovement(x) =
International Journal of Computer Applications (0975 – 8887)
Volume 103 – No.3, October 2014
8
Fuzzy Rules
1. If (EMV isL11) and (FI isL21) and (CMF isL31) and
(FI isL41) then Z1 = c1 (EMF, FI, CMF, FI)
2. If (EMV isL11) and (FI isL21) and (CMF isL31) and
(TI isM42) then Z2 = c2 EMF, FI, CMF, FI)3. if (EMF isL11)
and (FI isL21) and (CMF isL31) and (TI isH43) then Z3 = c3
EMV, FI, CMF, FI)
4. If (EMV isL11) and (FI isL21) and (CMF isM32)
and (TI isL41) then Z4 = c4 EMF, FI, CMF, FI)
... …..… …….
... ……
…….
80. If (EMV isH13) and (FI isH23) and (CMF isM32)
and (TI isM42) then Z80 = c53 EMF, FI, CMF, FI)
81. If (EMV isH13) and (FI isHM23) and (CMF isM32)
and (TI isH43) then Z81 = c81 EMV, FI, CMF, FI)
Where,
Zk = ck=(EMF, FI, CMF, FI) k = 1, . . . , 81
Fig. 12: Fuzzy Rules for Stock price Prediction
Layer 2: In this layer, the weighting factor (firing strength) of
each rule is computed. The weighting factor of each rule,
which is expressed as αk, is determined by evaluating the
membership expressions in the antecedent of the rule. This is
accomplished by first converting the input values to fuzzy
membership values by using the input MFs in the layer 1 the
MAX non-zero minimum value of each of the variables is
selected and evaluated using AND function. Only the rules
that have strength higher than 0, would “fire” the output.
Hence, the weighting factors of the rules are computed as
follows:
in
i1(v0)
(x0)
(y0)
(z0)i2(v0)
i2(x0
)
i2(y0)
i2(z0)in0
in0
in0
in0 (25)
Where λi is the corresponding degree of a given input which
satisfies the condition of the ath rule and i = 1, 2,.., 81.
Layer 3: The normalized weighting factor of each rule, ᾱk, is
computed by using
k = 1……..81 (26)
Layer 4: In this layer, the output rules can be written as:
ᾱkZk = ᾱkck (EMV, FI, CMF, TI)
= ᾱk (EMVck1 + FIck2 +CMFck3 + TIck4 + ck5)
k = 1, . . . , 81 (27)
where ck are the consequent parameters that characterize the
shapes of the output MFs. Here, the types of the output MFs
(ck) are linear.
Layer 5: In layer 5, defuzzification is performed. The input to
the defuzzification process is a fuzzy set (the aggregated
output fuzzy set), and the output of the defuzzification process
is a single (crisp) number. Here each rule is weighted using it
normalized weighting factor and the output of the FIS is
computed by the summation of all rule outputs:
(28)
Where ᾱi is a running point in a discrete universe, and ∑
is its membership value in the membership function. The
expression can be interpreted as the weighted average of the
elements in the support set (Guney, 2009) (Umoh, et al.,
2011).
6. IMPLEMENTATION
The paper adopts Matlab®/Simulink® and its Fuzzy Logic
tool box functions to develop a computer simulation showing
the user interface and fuzzy inference to assist the
experimental decision for the best control action. From layer
1, the crisp input values are converted to the fuzzy values by
the input MFs. For example, when the fuzzy inputs for EMV,
FI, CMF and TI are selected at -0.1445, 0.0156, 0.29 and -0.8
and their corresponding degree of membership evaluated in
(29);
EMV = -0.1445, Low = 0.06, Medium = 0.04, High = 0.0
FI = 0.0156, Low = 0.0, Medium = 0.02, High = 0.02
CMF = 0.29, Low = 0.0, Medium = 0.0, High = 0.34
TI = -0.8, Low = 1.0, Medium = 0.0, High = 0.0 (29)
The above results indicate that, the degree of membership for
an EMV of -0.1445 projects up to the peak function so the
result is “Low” membership = 0.06, “Medium” membership =
0.04 and “High” membership = 0.0 in the fuzzy sets. Only
rules associated with "Low" and “Medium” are actually
applied to the output response.
The above results indicate that, the degree of membership for
an FI of 0.0156 projects up to the peak function so the result is
“Low” membership = 0.0, “Medium” membership = 0.02 and
“High” membership = 0.02 in the fuzzy sets. Only rules
associated with “Medium” and "High" are actually applied to
the output response. The same rule applies to the other input
parameters of the membership function.
Fuzzy logic toolbox in Matlab 7.5.0 is utilized for the
membership function plots for the EMV, FI, CFM, TI and
output (Price Movement) in this paper as shown in Figures 7-
11.
Fig. 7: Membership Function for EMV (Ease of
Movement)
International Journal of Computer Applications (0975 – 8887)
Volume 103 – No.3, October 2014
9
Fig.8: Membership Function for FI (Force Index)
Fig.8: Membership Function for FI (Force Index)
Fig. 9: Membership Function for CMF (Chaikin Money
Flow)
Fig. 10: Membership Function for TI (Trend Index)
Fig. 11: Linear parameter for Output (PriceMovement)
Results of evaluation of fuzzy rule base inference for four
ranges of inputs, EMV, FI, CMF and TI is shown in Tables 3.
Table 3: Rule base evaluation for EMV, FI, CMF and TI
at -0.1445, 0.0156, 0.29 and -0.8
For example, if Rules 30, 39, 46, 58, 70, 78 and 80 fire from
the rule base presented in this paper when EMV, FT, CMF
and TI values are selected at -0.1445, 0.0156, 0.29 and -0.8
and their corresponding degree of membership evaluated and
presented in (29).
From Table 3, the normalized weighting factor of each fired
rule, ᾱk, is computed for High , Low and No change using
(26) as follows;
For High, α30 = 0.20, α39 = 0.56
= 0.56/(0.20 + 0.56) = 0.7
For Low, α46 = 0.56, α58 = 0.20 (30)
= 0.20/(0.56 + 0.20) = 0.2
For NoC α70 = 0.43, α78 = 0.43, α80 = 0.20
= 0.20/(0.43 + 0.43) = 0.2
From (27), the output rule values are computed for High, Low
and NoC as;
For High, 0.7(-0.1445 + 0.0156 + 0.29 + (-0.80)) = -0.60
For Low, 0.2(-0.1445 + 0.0156 + 0.29 + (-0.80))
= -0.20 (31)
For NoC, 0.2(-0.1445 + 0.0156 + 0.29 + (-0.80)) = -0.20
From (28), = -0.9 (Low) (32)
These particular input conditions indicate negative value of -
0.90 (Low) therefore low price is expected with 90%
possibility and required system response. This result indicates
that the price is low; therefore the investors are advised to buy
more stocks.
In Figure 12, having clicked on the Predict menu, rule 59 fired
with EMV = H, FI = L, CMF = L, and TI = M as shown by
the scales and the system predicts that the stock price is low.
Therefore, recommending the trader to buy more stocks. In
Figure 13, having clicked on the Predict menu, rule 74 fired
with EMV = H, FI = H, CMF = M, and TI = M as shown by
the scales and the system predicts no change in stock price
movement. Therefore, recommending the trader to hold on
and observe the direction of the movement of stock prices to
determine what action to take next. In Figure 14 as shown
below, having clicked on the Predict menu, rule 56 fired with
EMV = H, FI = H, CMF = H, and TI = M as shown by the
scales and the system predicts that the stock price is high.
Therefore, recommending the trader to sells the available
stocks.
Rule
Number
Input Variables
Consequence
Non zero
Minimum
EMV
FI
CMF
TI
30
0.89
0.20
0.70
1.00
High
0.2
39
0.89
0.56
0.63
1.00
High
0.56
46
0.99
0.56
0.63
0.88
Low
0.56
58
0.99
0.20
0.63
0.94
Low
0.20
70
0.99
0.43
0.63
0.88
NoC
0.43
78
0.99
0.43
0.70
0.94
NoC
0.43
80
0.89
0.20
0.77
0.94
NoC
0.20
International Journal of Computer Applications (0975 – 8887)
Volume 103 – No.3, October 2014
10
Fig. 12: Main Menu Interface for Low Price
Fig. 13: Main Menu Interface No Change in Price
Fig. 14: Main Menu Interface for High Price
International Journal of Computer Applications (0975 – 8887)
Volume 103 – No.3, October 2014
11
7. CONCLUSION
The study constructs a quick and accurate feasible architecture
of Sugeno- based fuzzy stock prediction system by applying a
linear combination of the significant technical indicators as a
consequent to predict the stock price. The proposed system
introduced in this paper is tested on different stocks in the
historical stock data of the Nigerian Stock Exchange, Uyo
which is located at Udo Udoma Avenue, Uyo, Akwa Ibom
State. Stock Market for a 3 years period. The system is
simulated using Matlab and the results show a good accuracy
near -0.9 (90%) low price with 90% possibility, indicating
that the investors are advised to buy more stocks. At 0.75
(75%) high price, it shows that the investors are advised to
sell stocks while at 0.5 (50%), no change is observed with
50% possibility. This result indicates that the investors should
hold on. The proposed system has the ability to predict the
future trend at any trading day. Future work includes detailed
analysis of the errors and more advanced methods to
overcome these errors. Also, the proposed system is only
applied and examined on the Nigerian market stocks. The
system can explore other stock market. In addition, the system
can be optimized by exploring neural network tool.
8. REFERENCES
[1] Ching, L. S., Jyh C., and Shih, M. Y. (2010).
International Journal of Education and Information
Technologies, 4(3).
[2] Nassim, H. and Ali, A. (2011). Stock price prediction
using a fusion model of wavelet, fuzzy logic and ANN.
International Conference on E-business, Management
and Economics.IPEDR, 25. IACSIT Press, Singapore.
[3] Hemanth, K. P, Prashanth, K. B., Nirmala, T. V.,
Basavaraj S. P. (2012). Neuro Fuzzy based Techniques
for Predicting Stock Trends. IJCSI International Journal
of Computer Science 9, 4(3), 1694-0814.
[4] Yudong, Z., & Lenan, W. (2009). Stock market
prediction of S&P 500 via combination of improved
BCO approach and BP neural network. Expert Systems
with Applications, 36(5), 8849–8854.
[5] Boyacioglu, M. A. & Avci, D. (2010). An Adaptive
Network-Based Fuzzy Inference System (ANFIS) for the
prediction of stock market return: The case of the
Istanbul Stock Exchange. Expert Systems with
Applications 37. 7908–7912.
[6] Zadeh, L. A. (1965). Fuzzy Sets. Information and
Control 8, 338–353.
[7] Chang, P. C., & Liu, C. H. (2008). A TSK type fuzzy
rule based system for stock price prediction. Expert
Systems with Applications, 34(1), 135–144.
[8] Mohammadian, M. and Kingham, M. (2004). An
adaptive hierarchical fuzzy logic system for modelling of
financial systems. International Journal of Intelligent
Systems in Accounting, Finance and Management, 12(1),
61–82.
[9] Hiemstra, Y. (1994). A stock market forecasting support
system based on fuzzy logic. In Proceedings of the
Twenty-Seventh Hawaii International Conference on
System Sciences, 3, 281–287.
[10] Cheung, W. M. and Kaymak, U. (2012). A Fuzzy Logic
Based Trading System. Ching, L. S., Jyh C., and Shih,
M. Y. (2010). International Journal of Education and
Information Technologies. 3, 4.
[11] Abbasi, E. & Abouec, A. (2008). Stock price forecast by
using neuro-fuzzy inference system. Proceedings of
World Academy of Science, Engineering and
Technology, 36, 320–323.
[12] Sureshkumar, K. K. & Elango, N. M. (2012).
Performance Analysis of Stock Price Prediction using
Artificial Neural Network, Global Journal of Computer
Science and Technology (GJCST), 12(1), 2-9.
[13] Ahmad, S. M, Gayar, N, Elazim, H. A (2006). A Fuzzy
Engine Model for Efficient Stock Market Prediction
Proceedings of the 5th WSEAS Int. Conf. on
COMPUTATIONAL INTELLIGENCE, MAN-
MACHINE SYSTEMS AND CYBERNETICS, Venice,
Italy, November 20-22, 2006 217
[14] Saxena, N. Hotchandani, Y. Kulshrestha, M. Arora, P.
(2010). Stock Market Expert: Analyzing Stock Prices
Proceedings of the 4th National Conference;
INDIACom-2010 Computing For Nation Development,
February 25 – 26, 2010 Bharati Vidyapeeth’s Institute of
Computer Applications and Management, New Delhi
[15] Kasemsan, M.L. and Radeerom, M. (2011). Intelligence
Trading System for Thai Stock Index Based on Fuzzy
Logic and Neuro-fuzzy System. Proceedings of the
World Congress on Engineering and Computer Science
2011, I. San Francisco, USA.
[16] Feng, H. M. and Chou, H. C. (2011). Evolutional RBFNs
prediction systems generation in the applications of
financial time series data, Expert Systems with
Applications, 38, 8285-8292.
[17] Abiyev, R. H. Abiyev, V. H. (2012). Differential
Evaluation Learning of Fuzzy Wavelet Neural Networks
for Stock Price Prediction, Journal of Information and
Computing Science, 7(2), 121-130.
[18] ElAaL, M. M. A., Selim, G. and Fakhr, W. (2012). Stock
Market Trend Prediction Model for the Egyptian Stock
Market Using Neural Networks and Fuzzy Logic. D.-S.
Huang et al. (Eds.): ICIC 2011, LNBI 6840, 85–90.
[19] Jandaghi, G., Reza Tehrani, R. Hosseinpour, D.
Gholipour, R. and Shadkam, S.A.S., (2012)Application
of Fuzzy-neural networks in multi-ahead forecast of
stock price, African Journal of Business Management
4(6), 903-914.
[20] Prasanna, S. and Ezhilmaran, D. (2013), An analysis on
Stock Market Prediction using Data Mining Techniques.
International Journal of Computer Science &
Engineering Technology (IJCSET), 4(3), 49-51.
[21] Umoh, U. A, Nwachukwu, E. O.and Obot, O. U. (2010).
Fuzzy Rule-based Framework for Effective Control of
Profitability in a Paper Recycling Plant. Global Journal
of Computer Science and Technology (GJCST), 10, 56-
67.
International Journal of Computer Applications (0975 – 8887)
Volume 103 – No.3, October 2014
12
[22] Umoh, U. A, Nwachukwu, E. O. and Okure, O. U.
(2011). “Fuzzy-Neural Network Model for Effective
Control of Profitability in a Paper Recycling Plant”.
American Journal of Scientific and Industrial Research
(AJSIR). 2(4): 552-558.
[23] Pantazopoulos, K. N., Tsoukalas, L.H., Bourbakis, N. G.,
Brun, M. J. and Houstis, E. N. (1998). Financial
prediction and trading strategies using neurofuzzy
approaches. IEEE Transactions on Systems, Man and
Cybernetics, Part B, 28(4), 520–531. Publishing
Company, Boston.
[24] Takagi, T. and M. Sugeno, “Fuzzy identification of
systems and its applications to modeling and control,”
IEEE Trans. Systems, Man, and Cybernetics, 15, 116–
132, 1985.
[25] Guney, K. (2009). Comparison of Mamdani And Sugeno
Fuzzy Inference System Models For Resonant Frequency
Calculation Of Rectangular Microstrip Antennas.
Progress In Electromagnetics Research B, 12, 81–104.
[26] Achelis, S. B. (2000). Technical Analysis from A to Z,
Library of Congress Cataloging- in-Publication Data,
ISBN 0-07-136348-3. McGraw Hill.
IJCATM : www.ijcaonline.org