Evaluating the Employment of Technical Indicators in Predicting Stock Price Index Variations Using Artificial Neural Networks ( Case Study : Tehran Stock Exchange )

Stock price index is the initial significant factor influencing on investors' financial decision making. That's why predicting the exact movements of stock price index is considerably regarded. This study aims at evaluating the effectiveness of using technical indicators, such as Moving Average, RSI, CCI, MACD, etc in predicting movements of Tehran Exchange Price Index (TEPIX). An artificial neural network is employed for stock price index forecasting. The existing data are achieved from Tehran Stock Exchange. To capture the relationship between the technical indicators and the levels of the index in the market for the period under investigation, a back propagation neural network is used. The statistical and financial performance of this technique is evaluated and empirical results revealed that artificial neural networks are dominant tools for financial market predicting.


Introduction
Stock price data is one of the most essential information for investors.It is a dynamic, non-linear, non-parametric and non-trend data.That is the investors' duty to manage the opportunities correctly and keep up with the inconsistencies of the market.They should consider the unexpected events, continuous structural failures along with the market turbulence (Chann Chang, Wang& Le Zhou, 2012).Stock price movements are actually affected by many macro economics factors including political events, firms' guidelines, general economic situations, inventory price index, investors' expectations, institutional investors' selections and psychological factors.Hence, it can be concluded that the accurate prediction of stock price movements is a very challenging and important topic and is extensively regarded by investors (Zhou Wang, jie Wang, Zhang & Po Guo, 2011).
Stock price is fluctuated by the varying expectations of shareholders about the economical situation of firms and that is the factor which impacts market index.Market index is an indication of future economic performance in national level.As a whole, stock price index in all global financial markets has been defined as one of the most imperative performance evaluation measure of stock exchanges (A .Pakdin Amiri, Mojtaba.Pakdin Amiri & Morteza.Pakdin Amiri, 2009).There are many previous studies about future stock price prediction, mostly focused on the affect of macroeconomic variables such as oil price, currency rate, interest rate, inflation rate, etc on the stock price index.Applying technical analysis is the aspect that makes this study different from similar studies mentioned.The present paper seeks to investigate the ability of artificial neural networks in predicting stock price index movements in Iran.

Technical Analysis
Technical analysis includes various forecasting techniques which are achieved through historical stock price trend and the characteristics of other financial information.The analyzer will investigate the past performance along with the current information related to the stock price to recognize the feasibility of a model.Additionally, the prediction capacity of the feasible model will also be investigated (Sinaee, Mortazavi& Teimori Asl, 2005).
The stock price changes trend is influenced by insight variations of investors and that is the factor which holds the main idea of the technical analysis.Price, volume and interest rate are the components used by analyzers to predict the future stock price changes.It is consistently believed that the history is recurring and the future stock price changes are determined by regarding the previous prices of the stock (Razmi.J, Julie.F & Emami, 2005).
There were extensive studies about the correlation between price changes in diverse Stock Exchanges in the sixth decade of the 20 th century.All these studies aimed at demonstrating the existence of correlation and price changes trend in addition to the rejection of efficient market.Technical analysis is a generally accepted concept all around the world and there are many financial economists and analyzers who apply it as a powerful tool for measuring stock prices.That is the reason behind using this technique as an input for the specified models examined

Artificial Neural Networks
The biological model of human's brain is the infrastructure of the globally accepted model known as Neural Networks.These models have been proven to have a high efficiency in predicting the market financial performance.Artificial Neural Networks (ANN) is one of the most essential subsets of artificial intelligence which is a sample of human neural system defined in mathematics model.Each artificial neural network includes the components of data processing called artificial neuron.Each neuron is related to other neurons through a relation owning a specific weight.This weight reflects the required information about solving the problem (Kia.M. 2010).The following hypotheses are considered in artificial neural networks: a) Information processing occurs at many simple elements called neurons.b) Signals are passed between neurons over connection links.c) Each connection link has an associated weight, which, in a typical neuron net, multiplies the signal transmitted.d) Each neuron applies an activation function (usually non linear) to its net input (sum of weighted input signals) to determine its output signal (Fausset, 1994).The neural networks are defined by a communication pattern between different layers of a network, the number of neurons, the number of layers, learning algorithm and operational function of neurons.There is no generally accepted rule about the standard size of these items for any network.Mostly, this is an innovating process which multilayer networks with different neuron numbers in any layer, various learning rate and diverse activation functions are thought and it will be followed by choosing the best network.

Literature Review
In recent years, there have been an increasing number of studies examining the movements of various kinds of financial instruments.Both educational researchers and practitioners have made great efforts to predict the future movements of stock market index or its return and devise financial trading strategies to translate the forecasts into profits (Kara, Boyacioglu & Baykan, 2011).In existing section, we focus the review of prior studies on prediction of financial market .Chen et al (2003) attempted to predict the trend of return on the Taiwan Stock Exchange index.The probabilistic neural network (PNN) is used to forecast the trend of index return.Statistical performance of the PNN forecasts is compared with that of the generalized methods of moments (GMM) with Kalman filter and random walk.Empirical results showed that PNN demonstrate a stronger predictive power than the GMM-Kalman filter and the random walk prediction models.Kim (2003) used SVM to predict the direction of daily stock price change in the Korea composite stock price index (KOSPI).This study selected 12 technical indicators to create the initial attributes.The indicators are stochastic K%, stochastic D%, momentum, ROC, Williams' %R, A/D oscillator, disparity5, disparity10, OSCP, CCI and RSI.In addition, this study examined the feasibility of applying SVM in financial prediction by comparing it with back-propagation neural network (BPN) and case-based reasoning (CBR).Experimental results proved that SVM outperform BPN and CBR and provide a promising alternative for stock market prediction.Altay & Satman (2005) compared the forecasting performance artificial neural network and linear regression strategies in Istanbul Stock Exchange and got some evidence of statistical and financial outperform of ANN models.Kumar& Thenmozhi (2006) investigated the usefulness of ARIMA, ANN, SVM, and random forest regression models in predicting and trading the S&P CNX NIFTY Index return.The performance of the three nonlinear models and the linear model are measured statistically and financially via a trading experiment.The empirical result suggested that the SVM model is able to outperform other models used in their study.
Hyup Roh (2007) introduces hybrid models with neural networks and time series model for forecasting the volatility of stock price index in two vision points: deviation and direction and the results showed that ANN-time series models can increase the predictive power for the perspective of deviation and direction accuracy.His research experimental results showed that the proposed hybrid NN-EGARCH model could be improved in forecasting volatilities of stock price index time series.
Yudong & Lenan (2009) applied a hybrid AI approach to predict the direction of daily price changes in S&P 500 stock index futures.The hybrid AI approach integrated the rule-based systems and the neural networks technique.Empirical results demonstrated that reasoning neural networks (RN) do better than the other two ANN models (back propagation networks and perceptron).Empirical results also confirmed that the integrated futures trading system (IFTS) outperforms the passive buy-and-hold investment strategy.
Liao&Wang (2010) applied a Stochastic Time Effective Neural Networks in predicting china global index and their study results showed that the mentioned model outperform the regression model.Ebadi (2010) employed gold price, Iran oil price and currency rate to forecast the stock price index (TEPIX) in Tehran Stock Exchange.His findings showed that neural networks have a high capacity in estimating total stock price index of TEPIX.Kara et al (2011) compared neural networks performance and SVM in predicting the movement of stock price index in Istanbul Stock Exchange.The input variables in suggested models include technical indicators such as CCI, MACD, LW R%, etc.The results revealed that neural networks work better in prediction than SVM technique.GhaliBaf&Masoum Zadeh (2011) tried to predict the stock price variations using Logistic regression.The independent variables included modified price, the percentage of stocks traded, cash returns index and stock price.They found that there is a significant relationship between past stock prices, the percentage of stocks traded and price and variations of stock prices.On the other hand, the relationship between the past prices of stocks and the trading day price variations is so strong.Zhou Wang et al (2011), propose a new model to predict the Shanghai stock price.They used Wavelet De-noising-based Back propagation (WDBP) neural network.For demonstrating superiority new model in predicting, the results of it is compared with Back Propagation neural network and the total results showed that the WDBP model for forecasting index is better than BP model.
Chann Chang et al (2012) suggested a new approach by Evolving Partially Connected Neural Networks (EPCNN s ) to forecast S&P500.They compared the performance of EPCCN s model with BPN, TSK fuzzy system and multiple regression analysis and stated that the EPCCN s do better than the other models.

Statistical Population and Sampling
The statistical population of this study includes the total price index of TIPEX in a period covering December 31, 2002 to February 18, 2009.The whole data in the statistical population were employed in the analysis and this leads to non-selection of a specified sampling method.The final number of sample is 1430.

Research Limitations
The main limitation of this study was about calculating total price index of Tehran Stock Exchange in the late 2009s which caused inability in continuously using data from 2000 to 2011.

Methodology
This paper is an applied research and is classified as a descriptive correlation study.

Data Analysis
The data used in this study include total stock price index which is composed of closing price, the high price and the low price of total price index in the period that mentioned prior.As shown in table 1, the total data covers 1430 trading days, among which 833 of them have an upward and 597 of them have downward position.It means that 58% of data have increasing and 42% of them have decreasing position which is shown separately in table 1.

Data Preparation
Some data own a high amount in comparison with others and this might lead to the excessive effect on prediction process which is a source of errors and reduction of prediction ability of neural networks.That's why the original data should be normalized in a range of [L, H].Normalizing data is done as follows: Also notes that in this study the original data were normalized in a range of [-1, 1]

Variable Calculation
Closing price, the high and low price index are converted into technical indicators in order to predict the position of stock price movements.There are many managers and investors who have accepted and employed specific measures as the signal of future market trend.Although various technical indicators are defined, some of them are useful in trending markets and some other ones are practical in non-trading markets.Our applied indicators are selected based on indicator selection of different groups and also along with the previous studies Armano et al,2005;Diler,2003;Manish&Thenmozhi,2005,Yakup Kara et al,2011,…).Table 2 demonstrates the titles of ten technical indicators and their calculation method separately.

Model Selection
Many researchers have verified the ability of neural networks in modeling and predicting of financial markets (Azar, Afsar & Ahmadi, 2009).In the present paper, a three layered feed framework ANN model has been employed to predict the stock price movement.The defined model is composed of an input layer, a hidden layer and an output model which are all related together.The output layer involves a neuron which shows the value of stock price index.Neuron numbers in the hidden layer is determined empirically.Figure 1 reflects a three layered feed forward ANN model.

Performance Evaluation of Neural Networks Model
In this section we seek to evaluate the performance of neural networks in predicting stock price index and its' movements.It should be reminded that the time period from 19/02/2002 to 18/03/2008 was chosen for network training and from 24/03/2008 to 18/2/2009 to test the predictive ability of the network.The network has been evaluated in terms of financial and statistical performance to test the power of neural network in the prediction of stock price and its' movement.This process is described below:

Statistical Performance Evaluation of the Model
The statistical performance of the model is evaluated through Mean Absolute Percentage Error (MAPE), Root Mean-Square Error (RMSE) and Mean Absolute Error (MAE) measures which are explained below: (1) (2) (3) Where p and are the actual value and predicted value, respectively, and N is the sample volume.Lesser values of these measures show more correctly predicted outputs.

Financial Performance Evaluation of the Model
In order to evaluate the financial performance of the model, the correct predicted positions by the model have been compared.Prediction rate is used in the formula to calculate the prediction accuracy and is as follows: Prediction rate = (4) Where: F = the outputs correctly predicted.

N= the total predicted outputs
The error level was determined 5% and it means that those outputs with the error level less than the defined value are considered as correctly predicted values.

Comparison of Financial Performance
The As is shown in table 6, the parameter combination (160, 30, 0.1, 0.039) is relatively better than others.Therefore, this combination in terms of financial and statistical performances is the best one.

Conclusion and Future Research
Investments in Stock Exchanges mainly aim at earning profit.That is the reason all investors need to predict the stock price index variations.It can be concluded that forecasting the future trend of stock prices in order to determine the proper time for buy or sell is the chief purpose of investors.Stock price index behavior, however, is not easily realizable.So it is important to design a model with the ability in predicting the stock price index.This study attempted to predict the direction of stock price index movements in the Tehran Stock Exchange.
Based on the empirical results obtained, some important conclusions can be drawn.The results of applying neural network in predicting direction of stock price index movement is summarized in table 7.According to table 7, as is expected, the ANN model is a powerful tool in predicting direction of stock price index movement and the current study results is in consistent with the previous studies such as (Altay et al, 2005, Kara et al, 2011, Yao et al, 2007, Sinaee et al, 2006).Some of suggestion for future research is mentioned in the following: 1) It is suggested to eliminate the specific data (with abnormal variations) from the data set.This event can be related to the particular days happening in a year.To name a few, consider the entrance of a big company, sudden increase or decrease in economic factors prices and so on.These events have falsified the general trend of data and these abnormal variations lead to reduction in model efficiency for prediction.
2) Future researches are suggested to use technical indicators of this study and other techniques such as SVM, Genetics Algorithm and GARCH model to predict the stock price index movements.There can also be a comparison of these models and neural networks.
3) Hybrid model can also be used in the prediction of stock price indexes.These models can include: SVM and Elman Back Propagation, Genetics Algorithm and neural networks, time series and neural networks, Genetics Algorithm and SVM, and GARCH and SVM.
the maximum value of the original data and C min = the minimum value of the original data.

Figure 1 .
Figure 1.A three layer back propagation neural network

Table 1 .
The number of cases in the entire data set

Table 2
. Selected technical indicators and their formulas Name of indicators Formulas 1.A/D (Accumulation/Distribution) Oscillator 2.CCI (Commodity Channel Index) 3.Larry William's R% 4.MACD (moving average convergence divergence) 5. Momentum 6. RSI (Relative Strength Index) 7. Simple 10-day moving average 8. Stochastic K% 9. Stochastic D% 10.Weighted 10-day moving averageC t is the closing price, L t : the low price, H t : the high price at time t, DIFF: EMA(12) t -EMA(26) t , EMA is exponential moving average, EMA(k) t : EMA(k) t-1 + α ×(C t -EMA(k) t-1 ), αsmoothing factor: 2/(1 + k), k is time period of k day exponential moving average, LL t and HH t mean lowest low and highest high in the last t days, respectively, Mt: ; SM t : ; D t : ; Up t means the upward price change, Dw t means the downward price change at time t.(Kara et al, 2011)] 6.

Table 3 .
ANN parameter levels tested in parameter settingThe original data is converted to technical indicators.As we mentioned earlier, ten technical indicators are as input variables.The Mean and Standard Deviation of input variables is shown in table 4.

Table 4 .
Summary statistics for the selected indicators

Table 6 .
data between 19/02/2002-18/03/2008 period with different combinations of parameters for testing the model is used and the training and validation values is obtained.The results is shown in table 5.Then, the data between 19/02/2002-18/02/2009 period separately as model inputs is used and prediction rate is calculated.According to the mentioned measures and network training with different parameters, there are three parameters composition shown in table 5 which are considered as the best compositions practically chosen.Statistical performance of the three parameter combination is compared in table 6.As already is mentioned, MAPE, MAE, RMSE and R2, measures are used in order to compare the Statistical performance of parameters combinations.Statistical performance of ANN model