
Research Article


Stock Price Direction Prediction Using Artificial Neural Network Approach: The Case of Turkey


D. Senol
and
M. Ozturan


ABSTRACT

In this study, it is aimed to illustrate that Artificial
Neural Network (ANN) can be used for predicting the stock price behaviour
in terms of its direction. Financial daily statistical data, derived from
raw price data obtained from Istanbul Stock Exchange (ISE), which is the
only stock market in Turkey, have been defined in terms of five independent
variables that are grouped in seven different Prediction System (PS) models
to which eight different ANN and Logistic Regression (LR) models have
been applied. For this purpose, a software library package is developed
using C#.NET to run the ANN models whereas a commercial statistical analysis
software package is used to run the LR model. At the end of the study;
the best PS and ANN models are determined for ANN methodology by comparing
the average mean squared errors of training sets and the best PS model
is determined for LR methodology by eliminating the insignificant independent
variables; the outputs of the developed software library package and a
commercial ANN software are compared on the basis of prediction success
rate and the accuracies of prediction by ANN and LR methodologies are
compared on the basis of coefficient of determination. The results show
that; the best results are obtained for the PS model that has used stochastic
indicator for 14 days (K14%), stochastic moving average (D3%) and relative
strength index of 14 days (RSI14) simultaneously for both ANN and LR methodologies
whereas the best ANN model has consisted of three inputs, 11 hidden neurons
in single hidden layer and one output; developed software library package
performs statistically same as the commercial software; statistically
ANN methodology outperforms LR methodology; and there is relevant empirical
evidence that ISE30 is not weak form efficient. 




INTRODUCTION
Stock price behavior has been a widely questioned and not a mutually
agreed area of researchers, where the main question is whether stock price
behaviors are predictable or not.
Researchers, who believe that stock prices do not follow a trend, act
in a random walk and cannot be predicted, are usually followers of a hypothesis
called the Efficient Market Hypothesis (EMH). EMH has been a widely accepted
theory which claims that the prices are defined in a random walk procedure,
making price behavior completely unpredictable. It also suggests that
it is not possible for any kind of prediction algorithm to outperform
a buy and hold strategy (a long term trading strategy based on the concept
that in the long run financial markets give a good rate of return) consistently
for a long period of time. This hypothesis has been discussed, expanded
and deepened by Reilly and Brown (1997), Dutt and Ghosh (1999) and Dietrich
et al. (2001).
As oppose to EMH, various studies have been done using different methodologies
and different indicators to predict stock price behaviour. According to
Hellstrom and Holmstrom (1997), there are four main methodologies to predict
stock market; fundamental analysis, technical analysis, time series forecasting
and machine learning. As indicators of stock price behaviour, different
combinations of various indicators such as; closing stock price, stock
market index value, foreign exchange rate, interest rate value, vector
curve, turnover, moving average, momentum, relative strength index, stochastic
and moving average of stochastic have been used in previous researches
(Kimoto et al., 1990; Tsibouris and Zeidenberg, 1995; Yao and Poh,
1995; FernandezRodriguez et al., 2000; Egeli et al., 2003).
In recent studies, Artificial Neural Network (ANN), which is the most
popular machine learning methodology, with various sets of indicators
as inputs and with various topologies, has been utilized for stock price
behaviour prediction and contradictory to EMH, has shown that stock price
behaviour can be predicted and ANN approach can outperform conventional
methods (Van Eyden, 1996; Yao and Poh, 1995; FernandezRodriguez et
al., 2000; Phua et al., 2000; Egeli et al., 2003; Versace
et al., 2004; Yümlü et al., 2004).
The main objective of this study is to show that, with a well chosen
set of indicators and ANN topology, ANN method has the capability to predict
stock price direction and in this context, outperforms the conventional
technique, Logistic Regression (LR).
MATERIALS AND METHODS
Stock price direction, as stated before, is mostly predicted by financial
indicators and the act of selecting the true indicators, in other words
designing a correct Prediction System (PS) model, is not easy and varies
from market to market and even stock to stock. Based on the previous studies
discussed before and the opinions of the experts, the following financial
indicators are chosen to be the indicators of the PS models in this study:
• 
Moving average of 14 days (MA14) 
• 
Moving average of 37 days (MA37) 
• 
Stochastic indicator for 14 days (%K14) 
• 
Stochastic moving average (%D3) 
• 
Relative strength index of 14 days (RSI14) 
Considering these indicators, seven different PS models (PSM1 to PSM7)
consisting of different sets of these indicators have been considered
for the prediction of stock price direction:
Thus, the effectiveness of different combinations of financial data has
been investigated for the stock price direction prediction.
Istanbul Stock Exchange (ISE30) have been chosen for the data set of
this study. Daily closing prices of each stock in ISE30 for each day
have been acquired from a private data feeder company and these prices
are then used to calculate the indicators of the PS models. Statistical
summary of this data is given in Table 1.
Table 1: 
Statistical summary of the data set 

Average number of days for available data of the stocks is 2255. Since
number of available trading dates for stocks listed under the name of
DENIZ, DOAS and VAKBN are less than 50% of the average number of days;
they are not included in this study due to insufficient amount of data,
thus, the number of stocks used in this study is dropped to 27.
The period used in the training data sets are between January 5, 1998
(first trading date of 1998) and December 29, 2005 (last trading date
of 2005). The period used in the testing data sets are between January
6, 2006 (first trading date of 2006) and August 31, 2007 (last trading
date of available data).
As suggested and used in previous studies (Kimoto et al., 1990;
Freisleben, 1992; Azoff, 1994; Zekic, 1998; Gencay, 1998; Quah and Srinivasan,
1999; FernandezRodriguez et al., 2000; ManChung et al.,
2000; Egeli et al., 2003; Heaton, 2005), backpropagation ANN model
with one hidden layer with eight possible different numbers of neurons
for the hidden layer, thus, eight different ANN models have been prepared
for seven different PS models. The number of inputs of the ANN models
is set to be the number of indicators of the corresponding PS model and
the stock price direction, within the boundary values 0 to 1, is set to
be the output that follows the below rule:
• 
Goes down if output is greater than or equal to 0.0
and less than 0.5 
• 
Stays same if output is equal to 0.5 
• 
Goes up if output is greater than 0.5 and equal or less than 0.0 
For all of the ANN models, the following network parameters are taken
the same:
• 
Learning rule: Momentum (Momentum factor = 0.5) 
• 
Stopping criteria: 10,000 cycles 
• 
Learning rate: 0.2 

Fig. 1: 
Class diagram of the developed software library package 
• 
Activation function: Linear Sigmoid 
• 
Initial weight: Randomized 
For applying the ANN models to PS models a software library package is
developed by object oriented methodology using C#.NET that can easily
be integrated to other systems, such as trading applications. The class
diagram of the developed software library package is given in Fig.
1.
Using the developed software package library, eight different ANN models
are applied to each of the seven PS models for each stock included in
ISE30. Due to the rules that do not yield a possible combination of number
of inputs of the PS model with the number of neurons in the hidden layer
of the corresponding ANN model, 26 combinations of ANN versus PS models
are dropped from the study thus leaving 30 combinations. For each of these
30 combinations, averages of the mean squared errors of training of 27
different stocks are calculated. The ANN and PS models that correspond
to the smallest average mean squared error of the trainings are selected
to be models of the study and for each of the 27 stocks, the predicting
ability of the developed software library package is tested by comparing
the predicted outputs of the selected models with actual data.
To check the reliability of the developed software library package, a
commercial ANN software is run for the selected ANN and PS models and
the outputs are statistically compared with the outputs of the developed
software library package.
ANN outputs can also be compared with the results of statistical methods,
generally regressive models (White, 1988; Weigend et al., 1990;
Bernd and Klaus, 1996; Dutta and Shekbar, 1988; Chiang et al.,
1996). Models which are used in these studies are targeted on forecasting
a future stock or index value. Since this study focuses on predicting
stock price direction, which is represented by a binary number, a regressive
model with a binary output is appropriate for comparison of the outcomes.
LR methodology is a statistical method used when the dependent variable
is desired to be interpreted as binary (Dreiseitl and OhnoMachado, 2002),
therefore it is an efficient way to measure the accuracy and performance
of ANN model when the output is going to be classified as binary (Bell
et al., 1990; Huang et al., 1994; Schumacher et al.,
1996; Luther, 1998; Dreiseitl and Ohno Machado, 2002). In this study,
the outcomes of ANN approach are compared with the outputs of LR method.
For that purpose, the five financial indicators chosen before are used
as independent variables and the stock price direction is used as the
dependent variable in LR methodology. A commercial statistical analysis
software package is used for running up the LR method and the best PS
model is determined by taking the significant independent variables into
consideration whereas correctness and correlation factors are used for
the comparison of outputs of the ANN and LR methodologies statistically.
RESULTS AND DISCUSSION
After applying the ANN models to each system model for 27 stocks included
in ISE30 using the developed software library package, ANN model with
three inputs, 11 hidden neurons in the single hidden layer and one output
(ANNM.3.11.1) applied to the PS model with the three indicators, R14,
K14 and D3 (PSM5) gives the lowest average mean squared error of training.
Therefore, these models are selected to be the models of this study. Table
2 gives the success rates of the predicted outputs (price goes downprice
stays sameprice goes up) of the application of ANNM3.11.1 to PSM5 for
27 different stocks in comparison to the actual price direction data.
Average of the success rates is 78.47% and for every stock, the success
rate is consistently much higher than 5050 chance indicating a high predicting
capability of the models.
The reliability of the developed software library package is checked
by applying the same selected models (ANNM3.11.1PSM5) to 27 stocks using
a commercial ANN software. Table 3 gives the correlations
between the predicted outputs and the actual price direction data for
the results of both the developed software library package and commercial
ANN software. One tailed ttest applied to these correlations shows that
in the 95% confidence interval, there is statistically no significant
difference (p = 0.48) between these sets indicating that the developed
software library package is reliable as much as the commercial ANN software.
The results of ANN approach are also compared with the outcomes of the
LR method to test if ANN approach outperforms LR method. A commercial
statistical analysis software is used to run the LR method. The significant
PS model suggested by LR method comes out to be the same as the best performing
PS model in ANN approach for each stock (PSM5) determining R14, K14 and
D3 as significant independent variables. Comparison of the correlations
of outputs of ANN and LR methods with actual values for the same PS model
and for each stock are given in Table 4. Twotailed
ttest applied to correlations show that in the 95% confidence interval,
ANN approach method has scored significantly (p = 0.000020) higher than
the LR method in terms of successful outcomes.
Table 2: 
Success rates of the application of ANNM3.11.1 to PSM5 

Table 3: 
Correlations between the predicted outputs of ANNM3.11.1PSM5
models and the actual price direction data for the results of both
software 

Table 4: 
Correlations of outputs of ANN and LR methods with
actual values for PSM5 

CONCLUSION
This study is aimed at finding the best PS and ANN models for the prediction
of the stock price direction using five chosen financial indicators and
at showing that ANN model outperforms LR model in prediction. For this
purpose; a software library package is developed; a total of 810 sets
of predictions, which result from the application of 30 combinations of
PS and ANN models to 27 stocks, are produced; developed software package
is tested against a commercial ANN software and LR method is applied using
the chosen financial indicators as independent variables.
Based on the results of this study it can be concluded that:
• 
The best PS model comes out to be PSM5 that has R14,
K14 and D3 as financial indicators 
• 
The best ANN topology comes out to be ANNM3.11.1 that has three
inputs, 11 hidden neurons in single hidden layer and one output 
• 
The developed software package performs statistically same as the
commercial software 
• 
Results of LR method also determine PSM5 as the best PS model. 
• 
Comparison of ANN and LR methodologies has shown that ANN methodology
statistically outperforms LR methodology 
• 
The results of the study have shown that there is sufficient empirical
evidence that ISE30 is not weak form efficient 
ACKNOWLEDGMENTS
Authors would like to thank Dr. Ali Tükel for his valuable suggestions
and recommendations.

REFERENCES 
Azoff, E.M., 1994. Neural Network Time Series Forecasting of Financial Markets. 1st Edn., John Wiley and Sons, Inc., New York, ISBN: 0471943563.
Bell, T.B., G.S. Ribar and J. Verchio, 1990. Neural nets versus logistic regression: A comparison of each model's ability to predict commercial bank failures. Proceedings of the 1990 Deloitte and Touche/University of Kansas Symposium on Auditing Problems, May 1718, 1990, Kansas, pp: 2953.
Bernd, F. and R. Klaus, 1996. Volatility estimation with neural network. Proceedings of the IEEE/IAFE Conference on Computational Intelligence for Financial Engineering, March 2426, 1996, IEEE Press, New York, pp: 177181.
Chiang, W.C., T.L. Urban and G.W. Baldridge, 1996. A neural network approach to mutual fund net asset value forecasting. Omega, 24: 205215. CrossRef  Direct Link 
Dietrich, J.R., S.J. Kachelmeier, D.N. Kleinmuntz and T.J. Linsmeier, 2001. Market efficiency, bounded rationality and supplemental business reporting disclosures. J. Accos. Res., 39: 243268. CrossRef 
Dreiseitl, S. and L. OhnoMachado, 2002. Logistic regression and artificial neural network classification models: a methodology review. J. Biomed. Inform., 35: 352359. CrossRef 
Dutt, S.D. and D. Ghosh, 1999. A note on the foreign exchange market efficiency hypothesis. J. Econ. Finance, 23: 157161. CrossRef 
Dutta, S. and S. Shekhar, 1988. Bond rating: A nonconservative application of neural network. Proceedings of the International Conference on Neural Networks, July 2427, 1998, IEEE Press, California, pp: 443450.
Egeli, B., M. Ozturan and B. Badur, 2003. Stock market prediction using artificial neural networks. Proceedings of the 3rd International Conference on Business, June 1821, 2003, Hawaii, pp: 18.
FernandezRodriguez, F., C. GonzalezMartel and S. SosvillaRivero, 2000. On the profitability of technical trading rules based on artificial neural networks: Evidence from the Madrid stock market. Econ. Lett., 69: 8994. CrossRef 
Freisleben, B., 1992. Stock market prediction with backpropagation networks. Proceeding of the 5th International Conference Industrial and Engineering Applications of Artificial Intelligence and Expert System, June 912, 1992, Springer, Berlin, pp: 451460.
Gencay, R., 1998. Optimization of technical trading strategies and the profitability in security markets. Econ. Lett., 59: 249254. CrossRef 
Heaton, J.T., 2005. Introduction to Neural Networks with Java. 1st Edn., Heaton Research, Inc., Missouri, ISBN: 0977320608.
Hellstrom, T. and K. Holmstrom, 1997. Predicting the stock market. Tech. Report Series IMaTOM199707. Vasteras, Malardalen University, http://www.emh.org/HeHo98.pdf.
Huang, C.S., R.E. Dorsey and M.A. Boose, 1994. Life insurer financial distress prediction: Neural network model. J. Insur. Regul., 12: 131167. Direct Link 
Kimoto, T., K. Asakawa, M. Yoda and M. Takeoka, 1990. Stock market prediction system with modular neural networks. Proceedings of the International Joint Conference on Neural Networks, June 1721, 1990, IEEE Press, California, pp: 16.
Luther, R.K., 1998. An artificial neural network approach in predicting the outcome of Chapter 11 bankruptcy. J. Bus. Econ. Stud., 4: 5773. Direct Link 
ManChung, C., W. ChiCheong and L. ChiChung, 2000. Financial time series forecasting by neural network using conjugate gradient learning algorithm and multiple linear regression weight initialization. Computing in Economics and Finance 2000. (No. 61). Barcelona, Society for Computational Economics, Retrieved from http://fmwww.bc.edu/cef00/papers/paper61.pdf.
Phua, P.K.H., D. Ming and W. Lin, 2000. Neural network with genetic algorithms for stocks prediction. Proceeding of the Fifth Conference of the Association of AsianPacific Operations Research Societies within IFORS. July 57, 2000. Singapore.
Quah, T.S. and B. Srinivasan, 1999. Improving returns on stock investment through neural network selection. Expet. Syst. Appli., 17: 295301. CrossRef  Direct Link 
Reilly, F. and K. Brown, 1997. Investment Analysis and Portfolio Management. 1st Edn., Dryden Press, California, ISBN: 0324289039.
Schumacher, M., R. Robner and W. Vach, 1996. Neural networks and logistic regression part I. Comput. Stat. Data Anal., 21: 661682. CrossRef 
Tsibouris, G. and M. Zeidenberg, 1995. Testing the Efficient Markets Hypothesis with Gradient Descent Algorithms. In: Neural Networks in the Capital Markets, Refenes, A.P. (Ed.). John Wiley and Sons, Inc., New York, ISBN: 0471943648, pp: 127135.
Van Eyden, R.J., 1996. The Application of Neural Networks in the Forecasting of Share Prices. 1st Edn., Finance and Technology Publishing, Virginia, ISBN: 0965133203.
Versace, M., R. Bhatt, O. Hinds and M. Shiffer, 2004. Predicting the exchange traded fund DIA with a combination of genetic algorithms and neural networks. Expet. Syst. Appl., 27: 417425. CrossRef 
Weigend, A.S., D.E. Rumelhart and B.A. Huberman, 1990. Generalization by weightelimination with application to forecasting. Proceedings of the 1990 Conference on Advances in Neural Information Processing Systems 3. November 2629, 1990, Morgan Kaufmann Publishers Inc., pp: 875882.
White, H., 1988. Economic prediction using neural networks: the case of IBM daily stock returns. Proceedings of the International Conference on Neural Networks, July 2427, 1988, IEEE Press, California, pp: 451459.
Yao, J. and H.L. Poh, 1995. Forecasting the KLSE index using neural networks. Proceedings of the International Conference on Neural Networks, Volume 2, November 27December 1, 1995, IEEE Press, pp: 10121017.
Yümlü, S., F. Gürgen and N.Okay, 2004. A comparison of global, recurrent and smoothedpiecewise neural models for Istanbul stock exchange (ISE) prediction. Pattern Recogn. Lett., 26: 20932103. CrossRef 
Zekic, M., 1998. Neural network applications in stock market predictions  a methodology analysis. Proceedings of the 9th International Conference on Information and Intelligent Systems, September 2325, 1998, Varazdin, pp: 255263.



