Predicting Stock Price Using Fuzzy Grey Prediction System: Y.-F. Wang
Predicting Stock Price Using Fuzzy Grey Prediction System: Y.-F. Wang
with Applications
PERGAMON Expert Systems with Applications 22 (2002) 33±39
www.elsevier.com/locate/eswa
Abstract
The purpose of this paper is to predict the stock price instantly at any given time. One problem with predicting stock prices is that there
may be a large or small difference in two continuous sets of data. The other problem is that the volume of stock data is so large that it affects
our ability to use it. To solve these problems, we constructed a data mart to reduce the size of stock data and combined fuzzi®cation
techniques with the grey theory to develop a fuzzy grey prediction as one of predicting functions in our system to predict the possible answer
immediately. To demonstrate that our system is working correctly, we used our prediction system to analyse stock data and to predict the
stock price promptly at a speci®c time. The system can effectively help stock dealers deal with day trading. q 2001 Published by Elsevier
Science Ltd.
Keywords: Stock price; Fuzzy grey prediction
Table 1
Reformatted relational database
StockNo Date Time Open High Low Close Vol Invol OutVol Amt
2311 2000/07/24 09:10:00 8650 8750 8550 8750 192 118 74 16627
2311 2000/07/24 09:15:00 8750 8750 8650 8650 123 104 19 10694
2311 2000/07/24 09:20:00 8650 8700 8600 8650 88 48 40 7621
2311 2000/07/24 09:25:00 8650 8700 8650 8700 35 22 13 3032
2311 2000/07/24 09:30:00 8650 8650 8650 8650 64 64 0 5534
2311 2000/07/24 09:35:00 8650 8650 8650 8650 161 161 0 13923
2311 2000/07/24 09:40:00 8650 8650 8600 8650 221 220 1 19011
2311 2000/07/24 09:45:00 8600 8650 8600 8650 139 136 3 11955
2311 2000/07/24 09:50:00 8600 8650 8600 8600 73 58 15 6299
2311 2000/07/24 09:55:00 8650 8650 8600 8600 59 25 34 5089
2311 2000/07/24 10:00:00 8600 8600 8550 8550 100 41 59 8588
2311 2000/07/24 10:05:00 8550 8600 8550 8600 77 69 8 6586
2311 2000/07/24 10:10:00 8600 8600 8550 8600 39 21 18 3342
: : : : : : : : : : :
: : : : : : : : : : :
data to estimate the behaviour of unknown systems (Deng, x (1)(k 1 p) can be calculated by
1982, 1989a,b). Therefore, we use the grey theory to
develop an ef®cient method to solve the problems of stock
1
0 b
x
k 1 p x
1 2 1 2 ea e2a
k1p21
2
price prediction. In this paper, we adopt the most commonly a
used GM(1,1) for our fuzzy grey prediction. The forecasting
step is then generated dynamically from the most recently where p is the forecasting step, a and b are the development
system behaviour by the proposed method to reduce pre- coef®cient and the grey input respectively (Wong, Liang,
dication errors. Feng & Chiang, 1998). In this paper, we will use formula (2)
The other problem with predicting stock prices is that to predict the stock price.
price difference can vary greatly over 2 h. For instance, it As pointed out by Deng (1982), the constraint of grey
is often dif®cult to classify patients as fully sick (Kacprzyk prediction model GM(1,1) is that the ratio, x (0)(k 2 1)/
& Iwanski, 1992). Therefore, crisp data mining approaches x (0)(k), must be in the period of [0.1345, 7.389]; otherwise,
may not be appropriate for these situations. To solve this the grey prediction model GM(1,1) is not suitable to use for
problem, we employ a fuzzi®cation technique into our fuzzy predicting the behaviour of the system. Therefore, we
grey prediction (FGP) as one of predicting functions in our propose a fuzzy grey prediction method to overcome this
system to predict the stock price in the next hour. Using our problem.
system not only enables the user to know the stock price in Essentially, the traditional grey predictions use a ®xed
any given hour, but also to follow stock price trends. In forecasting step to predict the system behaviour. It can
order to demonstrate that our method works correctly, reduce or prevent overshoot. However, the appropriate fore-
we considered the stock price analysis problem over 300 casting step is hard to ®nd. To solve this problem, Chiang,
weekdays of trading. Wang, Lee and Shi (1999) developed a new method to
discover a suitable forecasting step dynamically from the
most recent system behaviour. Expanding on formula (2),
2. Preliminaries this formula can be rewritten as:
!
Dr Deng initialed the grey theory in 1982. He used a grey 0 1
1
0 b
predictor to predict the system behaviour and fed the p 2 loge x
k 1 p 2 1 1 loge x
1 2
a a
predicting information back to the decision-making mech- !!
anism to indicate an appropriate control action. The most
commonly used GM(1,1) model for the grey prediction is 2 loge 1 2 e2a 2k
3
described as follows (Deng, 1989b):
(3). Then, let x (0) (x (0)(2),¼,x (0)(5)) and apply formula (2) the graphic display tool is not much more friendly
to predict the value of x (1)(6). than commercial products, it is a useful tool that can
be used to analyse stock price trends effectively. It
includes window-based interactive dialog boxes,
3. Fuzzy grey prediction system mouse-driven menus and scroll bars. As shown in
Fig. 2, the input screen of the system can be separated
Our system was written with Visual BASIC on an
into two regions for input selection:
IBM PC and includes two major modules: graphic
display tool, prediction agent. The simpli®ed architec-
² StockNo/Name region;
ture of the system is given in Fig. 1. In the proposed
² Function groups region.
system, users can check the stock price through the
graphic display tool. Since the predicting process is an
application oriented process, different applications may
need different predicting approaches. In this paper, we 3.1.1. StockNo/Name region
introduce only fuzzy grey prediction in the prediction This includes one text box. Users can input the speci®c
agent. stock number or stock name they are interested in.
Table 2 Table 4
Stock price on 5 February 2001 Table of m price(t[price])
Fig. 3. Stock price from September 1994 to May 2001 (by month).
4.1. Checking stock price using the graphic display tool 4.2. Predicting stock price using prediction agent
The graphic display tool can also display both historical The advantage of using fuzzy grey prediction in our
and current stock price data for comparison purposes. First prediction agent is that only a few data inputs are needed
of all, after entering StockNo and choosing the `Stock Price' to predict stock behaviour. To assess the accuracy of our
function on the input screen as shown in Fig. 2, press the method, we conducted several experiments, similar to
`GO' button to generate the stock price diagram shown in Section 3.2.1. Consequently, the value of m price(t[price]) at
Fig. 3. In Fig. 3, the bar chart and line chart represent the highest is always equal to 1. Therefore, when we know
high/low value and average value of the stock price for each the m price(t[price]) at 09:00, we can infer the highest stock
month, respectively. price. In the Section 3.2.1, the highest stock price is:
Fig. 4. Stock price from January 2000 to May 2001 (by week).
38 Y.-F. Wang / Expert Systems with Applications 22 (2002) 33±39
Fig. 5. Stock price from January 2001 to May, 2001 (by day).
p
30.7 4 0:56 41.026. After running 180 trials, the aver- References
age deviation from the predicted values is less than 9%. The
result shows that our fuzzy grey prediction is feasible. Baba, N., & Kozaki, M. (1992). An intelligent forecasting system of stock
price using neural networks, Proc. IJCNN.
Chiang, D. A., Wang, Y. F., Lee, S. L., & Shi, C. H. (1999). Analyzing
mainframe resource usage by dynamic grey prediction. The Journal of
5. Conclusion Grey System, 11 (2), 97±106.
Chiang, D. A., Chow, L. R., & Wang, Y. F. (2000). Mining time series data
by a fuzzy linguistic summary system. Fuzzy Sets and Systems, 112 (3),
In the proposed system, the graphic display tool can assist 419±432.
users in checking the historical stock data or the current Demarest, M. (1994). Building the data mart. DBMA Magazine, 7 (8),
situation of the stock market. The prediction agent can be 44±45.
used to predict the stock price at any given moment when Deng, J. (1982). Control problems of grey system. Systems & Control
Letters, 1 (5), 288±294.
after trading begins. In addition, the proposed system can
Deng, J. (1989a). Introduction to grey system theory. The Journal of Grey
still be used to effectively predict stock prices even without System, 1 (1), 1±24.
using the graphic display tool. Deng, J. (1989b). Properties of multivariable grey model GM(1,1). The
In our system, most parameters are defaulted and cannot Journal of Grey System, 1 (1), 25±42.
be changed by the user. Therefore, we plan to develop a Fayyad, U., Piatesky-Shapiro, G., Smyth, P., & The, K. D. D. (1996).
more ¯exible interface for users in the near future. At process for extracting useful knowledge from volumes of data. ACM
Comm., 39 (11), 27±34.
present, we just simply ignore the data for that day when Kacprzyk, J., & Iwanski, C. (1992). Fuzzy logic with linguistic quanti®ers
missing data appears. In the future, we will consider the in inductive learning. Fuzzy logic for the management of uncertainty
problem of missing data and develop more useful agents (pp. 465±478). New York: John Wiley & Sons Ltd.
for our system. Kendall, S. M., & Ord, K. (1990). Time series, (3rd ed). New York: Oxford
University Press.
Kim, K. J., & Han, I. (2000). Genetic algorithms approach to feature
discretization in arti®cial neural networks for the prediction of stock
price index. Expert Systems with Applications, 19, 125±132.
Kuo, R. J., Chen, C. H., & Hwang, Y. C. (2001). An intelligent stock trading
decision support system through integration of genetic algorithm based
fuzzy neural network and arti®cial neural network. Fuzzy Sets and
Systems, 118, 21±45.
Lee, K. H., & Jo, G. S. (1999). Expert system for predicting stock market
timing using a candlestick chart. Expert Systems with Applications, 16,
357±364.
Liu, H., & Setiono, R. (1996). Dimensionality reduction via discretization.
Knowledge-Based Systems, 9 (1), 67±72.
Mahfoud, S., & Mani, G. (1996). Financial forecasting using genetic
algorithms. Appl. Arti®cial Intell., 10, 543±565.
Widom, J. (1995). Research problems in data warehousing. Proceedings of
the Fourth International Conference on Information and Knowledge
Management, Baltimore, 25±30 November.
Wong, C. C., Liang, W. C., Feng, H. M., & Chiang, D. A. (1998). Dynamic
grey prediction control design. The Journal of Grey System, 10 (2),
Fig. 6. Stock price on 3 May 2001 (every 5 min). 123±131.