Sei sulla pagina 1di 67

i

Forecasting Stock Price Index Using Artificial Neural


Networks in the Indonesian Stock Exchange



Soukkhy Tiphimmala Prof. Dr.J. Sukmawati Sukamulja





UNIVERSITY OF ATMA JAYA YOGYAKARTA
2014










ii


ABSTRACT

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 A/D Oscillator, Moving Average, RSI, CCI, MACD,
etc. in predicting movements of Indonesian Stock Exchange Price Index (IDX).
An artificial neural network is employed for stock price index forecasting. The
existing data are achieved from Yahoo.Finance. 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 fairly good tools for financial
market predicting.

Keywords: Forecasting, prediction, stock price index, technical indicators,
artificial neural networks (ANN)






iii




v

Table of Contents


ABSTRACT ............................................................................................................... ii
List of Tables ........................................................................................................... viii
List of Figures ............................................................................................................ xi
ABBREVATIONS .................................................................................................. xiv
CHAPTER 1 INTRODUCTION ................................................................................ 1
1.1. Problem Identification ......................................................................................... 5
1.2. Objective of the Research ................................................................................... 6
1.4. Scope of the Research ......................................................................................... 8
1.5. Organization of the Thesis .................................................................................. 9
CHAPTER 2 LITERATURE REVIEW ................................................................... 10
2.1 Artificial Neural Network ................................................................................. 10
2.2 Review of previous researches .......................................................................... 11
2.3 Learning Paradigms in ANNs ........................................................................... 14
CHAPTER 3 RESEARCH METHODOLOGY ...................................................... 20
3.1 Statistical Performance Evaluation of the Model.............................................. 22
3.2 Financial Performance Evaluation of the Model .............................................. 24
3.3 Research Data................................................................................................... 25
3.4 Data preparation ............................................................................................... 26


vi

3.5 Variable Calculation......................................................................................... 26
CHAPTER 4 DESCRIPTIVE STATISTICS .......................................................... 31
CHAPTER 5 RESEARCH RESULTS AND ANALYSIS ..................................... 36
5.1 Comparison of Financial Performance.............................................................. 36
5.2 Comparison of Statistical Performance ............................................................. 44
CHAPTER 6 CONCLUSION .................................................................................. 48
REFERENCES ......................................................................................................... 53
Apendix A: Matlab code ........................................................................................... 57
A. Preprocess code ................................................... Error! Bookmark not defined.
B. Training code ....................................................... Error! Bookmark not defined.
C. Testing code......................................................... Error! Bookmark not defined.











viii

List of Tables

Table 1. The number of sample in the entire data set ............................................... 25
Table 2. Selected technical indicators and their formulas ........................................ 27
Table 3. Defined Variables ....................................................................................... 29
Table 4. ANN parameter levels tested in parameter setting ..................................... 32
Table 5. Summary statistics for the selected indicators ............................................ 33
Table 6. Three parameters for training and testing of ANN model .......................... 37
Table 7: Testing with parameter combination (10, 0.2 , 0.5, 1e6) ............................ 38
Table 8. Testing with parameter combination (30, 0.3, 0.5, 1e6) ............................. 38
Table: 9. Testing with parameter combination (50, 0.2, 0.5, 1e-6) .......................... 39
Table 10. Summary of the best forecasting, parameters (10, 0.2 , 0.5, 1e6) ............ 40
Table 11. Financial performance of ANN model ..................................................... 42
Table 12. The empirical result of other research ...................................................... 44
Table: 13 the best statistic & financial performance ............................................... 45
Table 14. Statistical performance of ANN model .................................................... 47





xi

List of Figures

Fig. 1 An artificial neural network is an interconnected group of nodes................. 11
Fig. 2 A Neural network with three-layer feed forward .......................................... 16
Fig. 3 Tan-Sigmoid Transfer Function and Linear Transfer Function ................. 31
Fig. 4 Data preparation (actual technical parameters & normalized technical
parameters) ...................................................................................................... 34
Fig. 5 Training process of ANN model ................................................................... 34
Fig. 6 Testing of ANN model .................................................................................. 35
Fig.7 Predict next trading day, by entering new data to the network ...................... 35
Fig. 8 Training & Forecasting performance (%) of ANN model for a whole data
set (n = 50, = 0.2, = 0.5, ep = 1e6). .......................................................... 41
Fig. 9 Forecasting performance (%) of ANN model for various values .............. 43





xiv

ABBREVATIONS

GDP : gross domestic product
IA : artificial intelligent
ANN : artificial neural network
IDX : Indonesian Stock Index
JKSE : Jakarta Stock Exchange (Pervious name of IDX)
MAE : mean absolute error
RMSE : root mean square error
MAPE : mean absolute percentage error
R
2
: goodness of fit
APE : absolute percentage error
PO : predicted output
AO : actual output
CCI : commodity channel index
MACD: moving average convergence divergence
ROC : price-rate-of change
RSI : relative strength index
PR : predicted rate (forecasting rate)


xv

n : neuron
: learning rate
: momentum constant
ep : epoch
IT : information technology
LSM : The Libyan Exchange Stock Market
TEPIX : The Tehran Exchange Price Index








1



CHAPTER 1
INTRODUCTION

Trade decisions on a stock market are made on the basis of predicting the
trend which it is driven by many direct and indirect factors. Effective
decisions depend on accurate prediction. Even though there have been many
empirical researches which deal with the issue of predicting stock price index;
most empirical findings are associated with the developed financial markets.
There are few researches exist in the literature to predict the direct of stock
price index movement in emerging markets, especially in Indonesian Stock
exchange. Accurate predictions of movement of stock price indexes are very
important for developing effective market trading strategies (Leung et al.
2000) the stock market is essentially dynamic, nonlinear, complicated,
nonparametric, and chaotic in nature (Abu-Mostafa & Atiya 1996). In
addition, stock market is affected by many macro economical factors such as
political events, firms policies, general economic conditions, investors
expectations, institutional investors choices, movement of other stock market,
and psychology of investors etc. (Tan et al. 2007).
So far, there are many techniques are applied to predict the market in order
to maximize profit and minimize risks, it can be categorized into four groups;
these techniques are included fundamental analysis, technical analysis, time
series analysis, and machine learning. The results from these techniques is
different, for example the fundamental analysis is used to define models which
2



calculate the future price according to current indicators such as the gross
domestic product (GDP), consumer price index, interest rate and exchange
rate; the technical analysis is used for forecast the future price direction by
studying past market data - primarily stock price and volume. The technical
analysis basically use trading rules such as single moving trend, composite
moving trend, and channel breakout. However, these techniques dont have
ability to learn nonlinear variables as artificial intelligent (IA) approach does.
Artificial neural network (ANN) technique is one of data mining
techniques that is gaining increasing acceptance in the business area due to its
ability to learn and detect relationship among nonlinear variables. Also, it
allows deeper analysis of larger set of data especially those that have the
tendency to fluctuate within a short of period of time. If stock market return
fluctuations are affected by their recent historic behaviour, neural networks
which can model such temporal stock market changes can prove to be better
predictors (Tang et al. 1991). The elasticity and adaptability advantages of the
artificial neural network models have attracted the interest of many other
researchers (Adebiyi Ayodele A. et al 2012). Since the last decade, the
artificial neural network models have been used extensively in various
branches such as computer science, engineering, medical and criminal
diagnostics, biological investigation, analysing the business data, and
econometric analysis research. Also they can be used for analysing relations
among economic and financial phenomena, forecasting, data filtration,
3



generating financial time-series, and optimization (Shachmurove &
Witkowska 2000).
Why neural network is best for prediction? Because there are several
distinguished features that propound the use of neural network as a preferred
tool over other traditional models of prediction. Artificial neural networks are
nonlinear in nature and where most of the natural real world systems are non
linear in nature, artificial neural networks are preferred over the traditional
linear models. This is because the linear models generally fail to understand
the data pattern and analyse when the underlying system is a nonlinear one.
ANNs are data driven models. It has ability to discover nonlinear relationship
in the input data set without a priori assumption of the knowledge of relation
between the input and the output. The input variables are mapped to the output
variables by squashing or transforming by a special function known as
activation function. They independently learn the relationship inherent in the
variables from a set of labelled training example and therefore involves in
modification of the network parameters (Soni 2011).
It is of interest to study the extent of stock price index movement
predictability using data from emerging markets such as of the Indonesia stock
market. This emerging markets performance is incredible for a long period of
time. For example, in December 2002, composite index stand at 424.495
points, it was rapidly upwards to 2,745.826 at the end of 2007 and then
decreased to 1,135.408 at the end of 2008 (-50.64%) due to the impact of
global financial crisis and upwards again at the beginning of 2009 until
4



November 2012, it reached 4,317. 277 points and 4,985.58 points on May 28,
2014. On an average day, transactions worth of between IDR 5 to 6 trillion
(US $520 million to US $620 million), and it has an average daily volume of
about six billion shares. In 2012, foreign investors purchased assets in the
Indonesian capital markets totaled IDR 19.55 trillion (about US $2 billion). In
the period of January to March in 2013, net foreign purchases already stood at
IDR 18.5 trillion nearly 100% increase comparing to the previous year, which
shows the attractiveness of these markets (David 2013). Market capitalization
has increased 412% from IDR 801 trillion in 2005 to IDR 4,099.34 trillion -
November 2012. In term of trade value, showed a significant increased after
2006 (US$ 49.4 billion) to US$114.9 billion in 2007 and quite stable since
then i.e. eleven months of 2012 totaled of US$104.6 billion.
There are very little previous researches exist (accessible) in related to
stock price prediction by using ANN techniques at IDX, such as Putra and
Kosala (2011) used ANN to predict intraday trading signals and Veri and
Baba (2013) forecasting the next closing price.
As we understand the characteristic that all stock markets, including IDX,
have in common is the uncertainty, which is related with their short and long-
term future state. This feature is undesirable for the investor but it is also
unavoidable whenever the stock market is selected as the investment tool. The
best that one can do is to try to reduce this uncertainty. In this research ANN
model is proposed to forecast the movement of stock price in the daily IDX
Index.
5



1.1. Problem Identification
How to forecast the stock price index? The stock market index direction
prediction is regarded as one of the crucial issues in recent financial analysis
studies (Wang & Choi 2013). Many techniques are employed to predict stock
prices in the stock markets but the past results are being questioned.
Generally, there are three schools of thought in terms of the ability to profit
from the equity market. The first school believes that no investor can achieve
above average trading advantages based on the historical and present
information. The major theories include the Random Walk Hypothesis and the
Efficient Market Hypothesis (Peters 1991). The Random Walk Hypothesis
states that prices on the stock market wander in a purely random and
unpredictable way. Each price change occurs without any influence by past
prices. The Efficient Market Hypothesis states that the markets fully reflect all
of the freely available information and prices are adjusted fully and
immediately once new information becomes available. If this is true then there
should not be any benefit for prediction, because the market will react and
compensate for any action made from these available information. The second
schools view is the so-called fundamental analysis. It looks in depth at the
financial conditions and operating results of a specific company and the
underlying behavior of its common stock. The value of a stock is established
by analysing the fundamental information associated with the company such
as accounting, competition, and management. The fundamental factors are
overshadowed by the speculators trading.
6



Technical analysis assumes that the stock market moves in trends and these
trends can be captured and used for forecasting. Technical analysis belongs to
the third school of thought. It attempts to use past stock price and volume
information to predict future price movements The technical analyst believes
that there are recurring patterns in the market behavior that are predictable. In
fact, there is not any research proved the existing of such patterns due to each
stock market has different characteristics, depending on the economies they
are related to, and varying from time to time. Most of the techniques used by
technical analysts have not been shown to be statistically valid and many lack
a rational explanation for their use. However, technical analysis has its value
on forecasting.
Artificial Neural Networks are regarded by many as one of the more suitable
techniques for stock market forecasting (Yao & Tan 2001). It has been
demonstrated to be an effective technique for capturing dynamic non-linear
relationships in stock markets, while technical analysis techniques unable to
do so.
1.2. Objective of the Research
The core objective of this research is to forecast the direction of movement in
the daily JKSE or IDX using artificial neural network, also to compare a
financial performance model and statistical model of ANN on its precision of
stock price prediction. At the same times, its empirical result will be
comparing with some recently researchers works in this market that used
ANN models. Also, this research will seek to prove against a validity of the
7



Efficient Market Hypothesis and the Random Walk Hypothesis for short-term
trading advantages in this stock market, which is considered as one of the
most important emerging markets in Asia.
1.3. Contribution of the Research
Recently, a number of researchers have explored artificial intelligence
techniques such as ANNs to solve financial problems significantly increased,
but most has targeted the United States market (Suchira Chaigusin, 2011).
There have been limited attempts to research stock markets of developing
economies such as Indonesia. At the beginning of this research, the author find
that there are some previous research using intelligent approach in this market,
but there are not many existing research using artificial neural network
technique, specifically, to predict the index movements of the JKSE.
The major contributions of this study are to demonstrate and verify the
predictability of stock price index direction using the financial and statistical
performances of ANN model. It also benefit to other researchers/students who
are interested in studying stock market price movement with ANN model.
This study is one step along the path towards applying ANN to the IDX in
order to clarify and predict stock performances. Enhancing the use of ANN in
financial areas and contributing incrementally to the growing knowledge base
of this financial forecasting field.
8



1.4. Scope of the Research
As there are many ANN research techniques were used to predict stock price
movement index mentioned in 1.1; some of recently research are using
international market indicators, technical & fundamental indicators as inputs
which its called hybrid. But some try to combined a lot of indicators as
input variable. However, the research finding indicated that many indicators/
or higher number of input variables is not mean such forecasting technique
(model) will give a result more accuracy.
In this research, we will attempt to forecast daily stock price movement at
JKSE, using financial performance and statistical performance evaluations of
ANN models. The data collection with total period of 9 years and 5 months,
starting from January 3, 2005 to May 28, 2014. The reason we start from
2005 because the index prices at the beginning 2005 reached RP1.000 and has
dramatically increased until the end of 2007 and then in the direction of
decrease. At the beginning of 2009 index prices had in the direction of
increased again. So, we would like to see how ANN model perform in the
different period and direction. The data be divided into two separate sets, a
period of January 3, 2005 to December 30, 2010 is for network training
purposes. From January 3, 2005 to May 28, 2014 is for testing the predictive
ability of the network. A three-layered feed-forward ANN model will be
constructed (see Figure. 2). This ANN model consists of an input layer, a
hidden layer and an output layer, each of which is connected to the other.
Inputs for the network are twelve technical indicators which are represented
by twelve neurons in the input layer (see table 2).
9



The forecasting ability of the ANN model is accessed by using back-
propagation neural network of errors such as MAE, RMSE, MAPE, and R
2
, to
improve their prediction performances two comprehensive parameter setting
experiments for both technical indicators and the levels of the index in the
market are performed. The logistic sigmoid transfer function will be used in
neural network; this function converts an input value to an output ranging
from 0 to 1 (see 2.3). If the connection weight is negative or (value < 0) then
tomorrow close price value < than todays price (loss). If the value is positive
(value > 0.5) then tomorrow close price value > than todays price (profit).
As we want to see the direction of movement decrease or increase so the
output will be categorized as 0 and 1. Therefore, if the forecasting value
smaller than 0.5 it will be categorized as decreased direction.
Published stock data will be collected from Yahoo.Finance especially daily
closing price, daily high price, and daily low price of total price index.
1.5. Organization of the Thesis
This thesis is composed of six Chapters. The remaining portion of the thesis is
broken up into the following Chapters: Chapter 2 describes Artificial Neural
Network and related literature. Chapter 3 describes the research methodology
which includes ANN modeling, research data and technical input variables. In
Chapter 4 descriptive statistics are used simply to describe the sample.
Chapter 5 the empirical results are summarized and discussed. Chapter 6 brief
conclusion with some suggestions for the future work on the field of stock
market prediction
10



CHAPTER 2
LITERATURE REVIEW

2.1 Artificial Neural Network

Artificial neural network (ANN), usually called Neural Network (NN), is an
algorithm that was originally motivated by the goal of having machines that
can mimic the brain. A neural network consists of an interconnected group of
artificial neurons. They are physical cellular systems capable of obtaining,
storing information, and using experiential knowledge. Like human brain, the
ANNs knowledge comes from examples that they encounter. In human
neural system, learning process includes the modifications to the synaptic
connections between the neurons. In a similar way, ANNs adjust their
structure based on output and input information that flows through the
network during the learning phase.
Data processing procedure in any typical neural network has two major steps:
the learning and application step. At the first step, a training database or
historical price data is needed to train the networks. This dataset includes an
input vector and a known output vector. Each one of the inputs and outputs
are representing a node or neuron. In addition, there are one or more hidden
layers. The objective of the learning phase is to adjust the weights of the
connections between different layers or nodes. After setting up the learning
samples, in an iterative approach a sample will be fed into the network and
11



the resulting outputs will be compared with the known outputs. If the result
and the unknown output are not equal, changing the weights of the
connections will be continued until the difference is minimized. After
acquiring the desired convergence for the networks in the learning process,
the validation dataset is applied to the network for the validating step
(Shahkarami A. et al. 2014).

Figure 1. An artificial neural network is an interconnected group of nodes.
Source : SPE International, Colorado, USA, 1618April 2014.


2.2 Review of previous researches
Several economists advocate the application of neural networks to different
fields in financial markets and economic growth methods of analysis (Kuan,
C.M. and White, H. 1994). We focus the review of prior studies on prediction
of financial market. Chen et al (2003) attempted to predict the trend of return
12



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%,
Slow %D, momentum, ROC, Williams %R, A/D oscillator, disparity 5,
disparity 10, 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
13



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.
Adebiyi Ayodele A. et al. (2009) presented a hybridized approach which
combines the use of the variables of technical and fundamental analysis of
stock market indicators for daily stock price prediction. The study used three-
layer (one hidden layer) multilayer perceptron models (a feedforward neural
network model) trained with backpropagation algorithm. The best outputs of
the two approaches (hybridized and technical analysis) are compared.
Empirical results showed that the accuracy level of the hybridized approach is
better than the technical analysis approach. 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. 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
14



networks work better in prediction than SVM technique. 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.
Putra and Kosala (2011) try to predict intraday trading Signals at IDX they
used technical indicators - the Price Channel Indicator, the Adaptive Moving
Averages, the Relative Strength Index, the Stochastic Oscillator, the Moving
Average Convergence-Divergence, the Moving Averages Crossovers and the
Commodity Channel Index. The result of their experiments showed that the
model performs better than the nave strategy. Also Veri and Baba (2013)
forecasting the next closing price at IDX, they used opening price, highest
price, lowest price, closing price and volume of shares sold as experimental
variables. The result showed that the most appropriate network architecture
is 5-2-1 with dividing the data into two parts, with 40 training data with 95%
accuracy of data and 20 test data with 85% accuracy of data.
2.3 Learning Paradigms in ANNs

The ability to learn is a peculiar feature pertaining to intelligent systems,
biological or otherwise. In artificial systems, learning (or training) is viewed
as the process of updating the internal representation of the system in
response to external stimuli so that it can perform a specific task. This
15



includes modifying the network architecture, which involves adjusting the
weights of the links, pruning or creating some connection links, and/ or
changing the firing rules of the individual neurons.
ANN approach learning has demonstrated their capability in financial
modelling and prediction as the network is presented with training
examples, similar to the way we learn from experience. In this paper, a
three-layered feed-forward ANN model was structured to predict stock price
index movement is given in Fig. 2. This ANN model consists of an input
layer, a hidden layer and an output layer, each of which is connected to the
other. At least one neuron would be employed in each layer of the ANN
model. Inputs for the network were twelve technical indicators which were
represented by twelve neurons in the input layer. Each neuron (unit) in the
network is able to receive input signals, to process them and to send an
output signal. Each neuron is connected at least with one neuron, and each
connection is evaluated by a real number, called the weight coefficient, that
reflects the degree of importance of the given connection in the neural
network (Daniel et al. 1997).
The error between the predicted output value and the actual value is back-
propagated through the network for the updating of the weights. This
method is proven highly successful in training of multi-layered neural
networks. The network is not just given reinforcement for how it is doing on
a task. Information about errors is also filtered back through the system and
16



is used to adjust the connections between the layers, thus improving
performance.

Fig. 2. A Neural network with three-layer feed forward
Source: Y. Kara et al. / Expert Systems with Applications 38 (2011)
53115319
This a supervised learning procedure that attempts to minimise the error
between the desired and the predicted outputs. If the error of the validation

A/D Oscillator
CCI
Larry Williams (R%)
MACD
Momentum
ROC
RSI
Simple MA
Stochastic K%
Stochastic D%
Stochastic
slow (D%)
Weighted MA

Input Layer
12 Technical indicators


1 1
2 2
n

Output Layer
Direction of
Movement
Hidden Layer
17



patterns increases, the network tends to be over adapted and the training
should be stopped.
The most typical activation function used in neural networks is the logistic
sigmoid transfer function. This function converts an input value to an output
ranging from 0 to 1. The effect of the threshold weights is to shift the curve
right or left, thereby making the output value higher or lower, depending on
the sign of the threshold weight. The output values of the units are
modulated by the connection weights, either magnified if the connection
weight is positive and greater than 1.0, or being diminished if the connection
weight is between 0.0 and 1.0. If the connection weight is negative or (value
< 0) then tomorrow close price value < than todays price (loss). If (value >
0.5) then then tomorrow close price value > than todays price (profit). As
shown in Fig. 2, the data flows from the input layer through zero, one, or
more succeeding hidden layers and then to the output layer. The back-
propagation (BP) algorithm is a generalisation of the delta rule that works
for networks with hidden layers. It is by far the most popular and most
widely used learning algorithm by ANN researchers. Its popularity is due to
its simplicity in design and implementation. The idea is to train a network
by propagating the output errors backward through the layers. The errors
serve to evaluate the derivatives of the error function with respect to the
weights, which can then be adjusted. It involves a two stage learning process
using two passes: a forward pass and a backward pass. The basic back
propagation algorithm consists of three steps (Fig. 2). Although, the most
18



(i = 1,2,n) (1)
(2)
(3)
commercial back propagation tools provide the most impact on the neural
network training time and performance. The output value for a unit is given
by the following Equation:
(

)
(

)
{


Where y the output value is computed from set of input patterns, X
i
of i
th

unit in a previous layer, W
ij
is the weight on the connection from the
neuron i
th
to j,
j
is the threshold value of the threshold function f, and n is
the number of units in the previous layer. The function (x) is a sigmoid
hyperbolic tangent function (Barndorff-Nielsen et al. 1993)

() ()

Threshold: () {






where (x) is the threshold function remains the most commonly applied in
ANN models due to the activation function for time series prediction in
back-propagation (Najeb Masoud, 2014):

(

) (

)
19



(4)
(5)
Once the output has been calculated, it can be passed to another neuron (or
group of neurons) or sampled by the external environment. In terms of the
weight change, w
ij
, the formula equation is given as:


where is the learning rate (0<<1),
j
is the error at neuron j, x
i
is an input
vector and w
i
the weights vector. This rule of IDX can also be rewritten as:


Although a high learning rate, , will speed up training (because of the large
step) by changing the weight vector, w, significantly from one phase to
another. According to Wythoff BJ. (1993) suggests that e[0.1,1.0].






20



CHAPTER 3
RESEARCH METHODOLOGY

Chaigusin (2011) mentioned that stock markets have different characteristics,
depending on the economies they are related to, and, varying from time to
time, a number of non-trivial tasks have to be dealt with when developing
Neural Networks for predicting exchanges. It is not easy task to design
artificial neural network model for a particular forecasting problem or a stock
market index movement. Therefore, Modelling issues must be considered
carefully because it affects the performance of an ANN. One critical factor is
to determine the appropriate architecture, the number of optimal hidden layers
as well as the number of hidden nodes for each layer. Other network design
decisions include the selection of activation functions of the hidden and output
nodes, the training algorithm, and performance measures. The design stage
involves in this study to determine the input (independent) and output
(dependent) layers through the hidden layers in the case where the output layer
is known to forecast future values. Output of the network was two patterns 0 or
1 of stock price direction. The output layer of the network consisted of only
one neuron that represents the direction of movement. The number of neurons
in the hidden layer was determined empirically. The determination of the
formulation between input and output layers is called learning and through the
learning process, model recognises the patters in the data and produces
estimations.
21



From the literature, multi-layer feed-forward ANN with back-propagation is
the most commonly used architecture in this area. So, we use the three-layered
feed-forward architecture (see Fig. 2). The entire data set covers the period
from 03/01/2005 to 30/12/2010 for network training, while data from
03/01/2005 to 28/05/2014 is to test the predictive ability of the network.
There are some steps as follow:
12 indicators has to be calculated in excel and then the results will be loaded
to the network for training and testing,
The data will be loaded to the network and then Normalization will take
place ranging between -1, 1 so that the network will able to learn faster,
training period will be in yearly because of avoiding too much of time
consuming.
Training process will take place within time frame (20 minutes), if the
process cannot reach the goal, and then changing its learning rate and
momentum constant will be needed.
Looking for the best parameter combination that enhance the best output
and save as net for testing step(forecasting)
The testing process can be conducted in the new set of data to see how best
the performance of the model
The basic methodologies applied in this research are based on previous
researches such as (Kim 2003, Mahmood Moein Aldin et al. 2012, Najeb
Masoud 2014,...) The performance evaluation of the model can be described
below:
22





3.1 Statistical Performance Evaluation of the Model

In order to estimate the forecasting statistical performance of some methods or
to compare several methods we should define error functions. Many previous
research works had applied some of the following forecast accuracy measures:
Mean Error (ME), Mean Absolute Error (MAE), Mean Squared Error (MSE),
Root Mean Squared Error (RMSE), Standard Deviation of Errors (SDE), Mean
Percent Error (MPE) and Mean Absolute Per cent Error (MAPE), etc. In our
study we use four performance criteria namely mean absolute error (MAE),
root mean square error (RMSE), mean absolute percentage error (MAPE) and
goodness of fit R
2
. The back-propagation learning algorithm was used to train
the three-layered feed-forward ANN structure in this study were the most used
error functions is as following:
The mean absolute error is an average of the absolute errors E = (P
i
- ),
where P
i
and are the actual (or observed) value and predicted value,
respectively. Lesser values of these measures show more correctly predicted
outputs. This follows a long-standing tradition of using the ex-post facto
perspective in examining forecast error, where the error of a forecast is
evaluated relative to what was subsequently observed, typically a census based
benchmark (Poon 2005). The most commonly used scale-dependent summary
measures of forecast accuracy are based on the distributions of absolute errors
23



(|E|) or squared errors (E
2
) observations (n) is the sample volume. The mean
absolute error is given by:
Mean Absolute Error (MAE) = ( ) |
.
|

\
|

=
n
i
n E
1
/ (i = 1, 2,n) (6)
The MAE is often abbreviated as the MAD (D for deviation). Both MSE
and RMSE are integral components in statistical models (e.g., regression). As
such, they are natural measures to use in many forecast error evaluations that
use regression-based and statistical. The square root of the mean squared error
as follows:
Mean Square Error (MSE) = ( ) |
.
|

\
|

=
n
i
n E
1
2
/ (i = 1, 2,n)
Root Mean Square Error (RMSE) = ( ) |
.
|

\
|

=
n
i
n E Sqrt
1
2
/ (i = 1, 2,n) (7)
If the above RMSE is very less significant, the prediction accuracy of the ANN
model is very close to 100%. Since percentage errors are not scale-
independent, they are used to compare forecast performance across different
data sets of the area using absolute percentage error given by APE = (P
i
- )
*100. Like the scale dependent measures, a positive value of APE is derived
by taking its absolute value (| APE |) observations (n). This measure includes:
MAPE = ( ) |
.
|

\
|

=
n
i
n APE
1
/ (i = 1, 2,n) (8)
The use of absolute values or squared values prevents negative and positive
errors from offsetting each other. All these features and more make MATLAB
an indispensable tool for use in this work.
24



(i = 1,2,...n) (10)
Goodness of Fit (R
2
) = |
.
|

\
|

=
n
i
e E
1
2 2
) /( ) ( (i = 1, 2,n) (9)
where e
i
= p
i
- p
i
, is the forecast error values. p
i
, the actual values and p
i
,
denote the predicted values. The more R
2
correlation coefficient gets closer to
one, the more the two data sets are correlated perfectly. As the aim of all of
the prediction system models proposed in this study is to predict the direction
of the stock price index forecasting, the correlation between the outputs do not
directly reflect the overall performance of the network.
3.2 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 performance
is evaluated used in the formula to calculate the prediction accuracy (Kim
2003) and is as follows:
()


Where R
i
the prediction result is for the i
th
trading day is defined by:


PO
i
is the predicted output from the model for the i
th
trading day, and AO
i
is
the actual output for the i
th
trading day, 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.
25



3.3 Research Data
The research data used in this study is the direction of change in the daily
Jakarta composite stock price index (JKSE). This is composed of closing price,
the high price and the low price of total price index. The grand total number of
sample is 2,298 trading days, from January 3, 2005 to May 28, 2014. It is
divided into two sub-periods. First sub-periods of January 3, 2005 to December
30, 2010 is in network training periods, its values are obtained with different
combinations of parameters for testing the models. The second sub-period of
January 3, 2005 to May 28, 2014 is in sample period for testing prediction rate.
The whole data in the statistical population were employed in the analysis and
this leads to non-selection of a specified sampling method. The number of
sample with increasing direction is 1,303 while the number of sample with
decreasing direction is 995. That is, 57% of the all sample have an increasing
direction and 43% of the all sample have a decreasing direction. The research
data used in this study is the direction of daily closing price movement in the
JKSE. The number of sample for each year is shown in Table 1.
Table 1. The number of sample in the entire data set
Description Year

Total
05 06 07 08 09 10 11 12 13 14
May

Increase 136 144 151 123 141 140 137 135 131 62 1,300
(%) 56% 59% 60% 51% 58% 57% 55% 55% 55% 63% 57%
Decrease 107 101 109 120 102 105 110 109 109 36 998
(%) 44% 41% 40% 49% 42% 43% 45% 45% 45% 37% 43%
Total 243 245 250 243 243 245 247 244 240 98 2,298
Source: author calculation, 2014

26



(i = 1,2,...n) (11)
3.4 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. Thats why the original data
should be normalized in a range of [l, h]. with regards to Mahmood Moein
Aldin et al. (2012) normalizing data is done as follows:

(

)
(

)
(


Where:
u = the normalized data
x
i
= the original data
x
i,min
= the minimum value of the original
x
i,max
= the maximum value of the original data
h
i
= upper bound of the normalising interval and
l
i
= lower bound of the normalising interval
Max-min normalization plans a value u of x
i
in the range (h
i
l
i
) i.e. (-1.0;
1.0), in this case. As a value greater than 0 represents a buy signal while a
value less than 0 represents a sell signal. (i = 1,2,3,...,n) the number of
observations.
3.5 Variable Calculation

27



Closing price, the high and low price index are converted into technical
indicators. Technical indicators are used as input variables in the construction
of prediction models to predict the position of stock price movements. In this
research, 12 technical indicators has to be calculated in Excel and then the
network (Program matlab) will read the results from excel spreadsheet.
Training or learning data will be year on year, because if we combine data of
many years to train at one time it means the learning process is very long and
sometimes may not reach the goal.
The research applied indicators are selected based on indicator selection of
different groups and also along with the previous studies Kim (2003), Kumar
& Thenmozhi (2006), Kara et al. (2011), Mahmood Moein Aldin et al. (2012),
A. Victor Devadoss (2013) Table 2 demonstrates the titles of twelve
technical indicators and their calculation method separately.
Table 2. Selected technical indicators and their formulas
No Name of
indicators
Formulas Description

1

A/D
Oscillator




where C
t
is the closing
price at time t, L
t
the low
price at time t, H
t
the high
price at time t (J. Chang et
al. 1996)
2 CCI
Commodity
Channel
index



Where
M
t
= (H
t
+ C
t
+ L
t
)/3,


(S.B. Achelis, 1995 & J.
Chang et al. 1996)
28



3 Larry
Williams
(R%)




(S.B. Achelis, 1995)

4 MACD
(moving
average
convergence
divergence)
MACD(n)
t-1
+2/n+1* (DIFF
t
-
MACD(n)
t-1
)
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 (Gerald,
2005)
No Name of
indicators
Formulas Description
5 Momentum

where C
t
is the closing
price at time t, n the price
day (J. Chang et al. 1996)

6 ROC Price-
rate-of
change




(J.J. Murphy, 1986)


7 RSI
(Relative
strength
index)

)(

)


where Up
t
means upward-
price change and Dw
t

means downward price-
change at time t. (S.B.
Achelis, 1995)

8 Simple MA



It shows the average value
of a securitys price over a
period of time. If the value
of a securitys price over a
period of time. If the price
moves above its MA, a buy
signal is generated. If the
price moves below its MA
a sell signal is generated.
(Mahmood Moein Aldin et
al. 2012 & Najeb Masoud,
2014)

9 Stochastic
(K %)



where LL
t
and HH
t
, mean
lowest low and highest
high in the last t days,
respectively. (S.B. Achelis,
1995)

29



10 Stochastic
(D%)
(



(S.B. Achelis, 1995)

11 Stochastic
slow (D%)

(



(E. GiEord, 1995)


12 WMA ()

( )

( ( ) )

Mahmood Moein Aldin et
al. (2012), Najeb Masoud
(2014)


Notes: In this study the original data were normalized in a range of [-1,1].
Table 3. Defined Variables
Code Definitions
A/D Oscillator Accumulation/distribution oscillator. It is a
momentum
indicator that associates changes in price

CCI Commodity
Channel index
It measures the variation of a securitys price from its
statistical mean

Larry Williams
(R%)
It is a momentum indicator that measures
overbought/ oversold levels

MACD (moving
average convergence
divergence)

Moving average convergence divergence
Momentum It measures the amount that a securitys price has
changed over a given time span

ROC Price-rate-of
change
It displays the difference between the current price
and the price n days ago

RSI Relative strength index. It is a price following an
oscillator
that ranges from 0 to 100. A method for analysing
RSI is
to look for divergence in which the security is
making
a new high.

Simple MA Simple 10-day moving average

Stochastic (K %) It compares where a securitys price closed relative
to its price range over a given time period
30




Stochastic (D%) Moving average of %K

Stochastic slow (D%) Moving average of %D.

WMA Weighted 10-day moving average
Source: Kim K. (2003), Kara et al. (2011), Mahmood Moein Aldin et al.
(2012), Najeb Masoud (2014)

31



CHAPTER 4
DESCRIPTIVE STATISTICS

The function of hidden layer is tansigmoid and the transferred function of
output layer is linear in a three layer network, where input layer is simply
distributing the inputs in various hidden layer and no processing takes place
there, in general requires least number of training epochs.

Fig. 3 Tan-Sigmoid Transfer Function and Linear Transfer Function
Source: Beale.M.H et al. Neural Network Toolbox, Users Guide R2013b

The aim of linear scaling is to independently normalise each feature
component to the specified choice. It ensures the larger value input attributes
do not overwhelm smaller value inputs, and then helps to reduce prediction
errors (Kim 2003).
The number of neurons (n) in the hidden layer, value of learning rate (),
momentum coefficient () and number of training epochs (ep) are ANN model
parameters that must be efficiently determined. Ten levels of neurons (n), five
levels of momentum () and 1e-6 levels of epochs (ep) were tested in the
parameter setting process. As suggested in the previous Chapter 2, literature, a
32



small value of was selected as 0.1-1.0. The levels of the ANN parameters
that are tested for choosing the best combination is presented in Table 4.
Each parameter combination was applied to the training data sets and
prediction accuracy of the models were evaluated. Therefore, the training
performance were calculated for each parameter combination. The parameter
combination that resulted in the best average of training performances are
selected as the best one for the corresponding model. It is noteworthy that
MATLAB software is the device used to implement the model.
Table 4. ANN parameter levels tested in parameter setting
Parameters Level(s)

neurons(n)

10, 20, 30, 40, 50
Epochs(ep) 1e-6 or (1,000,000)
Momentum constant () 0.1, 0.2, 0.3, 0.4, 0.5,
Learning rate () 0.1, 0.2, 0.3, 0.4, 0.5
Source: author selection 2014
As we have mentioned above the original data is converted to technical
indicators. Twelve technical indicators are as input variables. The Mean and
Standard Deviation of input variables is shown in Table 5. Summary statistics
for the selected indicators (next page).



33



Table 5. Summary statistics for the selected indicators
Name of
indicators
Max Min Mean Standard
Deviation

A/D Oscillator


3.7177

-2.0910

0.5333

0.5954
CCI

299.2441 -378.3367 36.4674 107.0075
Larry
Williams
(R%)

100.00 0.00 36.4677 30.0590
MACD

107.1505 -165.0661 11.8421 41.6158
Momentum

400.0300 -510.1500 5.1798 72.3753
ROC

120.6309 73.0980 100.7319 4.5414
RSI

87.7758 16.6560 55.7838 12.7347
Simple MA

5162.5620 1017.6010 2774.3818 1234.6479
Stochastic K%

100.00 0.00 63.5323 30.0590
Stochastic D%

100.00 1.5892 63.5394 27.2896
Stochastic
slow (D%)

33.3071 1.2065 21.1834 8.7109
Weighted MA

100827.61 19848.154 54198.6853 24081.7470
Source: author calculation, 2014

34




Fig. 4 Data preparation (actual technical parameters & normalized technical
parameters)
Source: computer displays, 2014



Fig. 5 training process of ANN model
Source: computer displays, 2014

35




Fig. 6 Testing of ANN model
Source: computer displays, 2014



Fig.7 Predict next trading day, by entering new data to the network
Source: computer displays, 2014
36



CHAPTER 5
RESEARCH RESULTS AND ANALYSIS
The first concept of the training methodology in this research is to train data
for 6 years (2005-2010) at one time and then testing for a whole data set.
However, the train process it seems to require a lot of time consuming. So, the
data is divided yearly for training and also for testing. The training time was
set within 20 minutes for each year, if the training performance is not complete
within the time frame, the higher learning rate, momentum constant is
required. After the training completed but its result is not desired, so changing
its parameter is needed.
5.1 Comparison of Financial Performance
The data between 03/01/2005-30/12/2010 period is in network training
process, if the result of the training with any parameter combination provide
the highest accuracy rate, which mean that the learning or training process is
perfectly done as the network can know the direction of increase/decrease of
stock price index well and then such result of parameter combination will be
saved as a net or model so that we can use the model to test (forecast) the
future direction of stock price index. If the tested result shows a significant
accuracy rate, it will be adopted as the best parameter combination of the
research. The data between 03/01/2005- 28/05/2014 period as input variable is
used for testing and forecasting rate is calculated. In table 6 shows three
parameters composition which are assumed to be the best ones in representing
all cases in the entire data set.
37



As already mentioned in Chapter 4 about ANN model parameters, Each
parameter combination consists of number of neurons (n), value of learning
rate(), momentum constant() and epochs(ep).
Table 6. Three parameters for training and testing of ANN model
No n ep Results (4ys) Average

1

10

0.2

0.5

1e6

98% - 99% 99%

2

30

0.3

0.5

1e6

97% -99%

98%

3

50

0.2

0.5

1e6

96% -99%

98%
Source: author calculation, 2014
Through these parameter combinations, we are now able to perform
comparison experiments of the ANN model, based on the data sets presented in
Table 1.
The average of training performance of the ANN model for these parameter
combination was varied between 98% and 99%. It can be assumed that the
training performances of the ANN model are significant for parameter
combination setting data set.
Based on selected parameters mention above, now we try to test each period of
time to see how each parameter combination can generate the result, in
general the testing (forecasting) process is very fast. All yearly testing results
has presented in Table 7, Table 8 and Table 9. Each Table head shows Test-1
to Test-6, it can be classified i.e. Test-1 refers to data in 2005 be trained
(learned) when the best training result be reached and then save it as
38



net(model) then we use this model to test the same year data and also the
following year data, for other Test also refer to the same procedure
Table 7: Testing with parameter combination (10, 0.2 , 0.5, 1e6)
Year Test-1 Test-2 Test-3 Test-4 Test-5 Test-6
2005 59%
2006 42% 51%
2007 41% 56% 52%
2008 53% 54% 52% 58%
2009 37% 60% 48% 53% 55%
2010 43% 56% 49% 58% 60% 54%
2011 44% 54% 49% 59% 57% 52%
2012 46% 53% 59% 57% 55% 51%
2013 44% 55% 52% 58% 59% 54%
2014 37% 62% 56% 65% 66% 62%
Average 45% 56% 52% 58% 59% 55%
Source: author calculation, 2014
In Table 7 showed that the result of forecasting rate of year 2005 is 59%
accuracy which higher rate than following year model in terms of testing the
same year data as it was be trained. However, the following year forecasting
ability of Test-1 is very low compare to others. The best results of parameter
combination (10, 0.2 , 0.5, 1e6) is Test-5, meaning we train data of 2009, and
then use this model to forecast the following year, the highest forecasting rate
(66%) and the worse one (55%), by average is 59%.
Table 8. Testing with parameter combination (30, 0.3, 0.5, 1e6)
Year Test-1 Test-2 Test-3 Test-4 Test-5 Test-6
2005 59%
2006 54% 52%
2007 46% 48% 52%
2008 40% 51% 50% 60%
2009 51% 49% 56% 61% 55%
2010 50% 44% 55% 54% 56% 54%
2011 47% 48% 61% 58% 60% 56%
2012 52% 45% 55% 59% 51% 59%
39



2013 52% 46% 61% 55% 46% 63%
2014 56% 37% 62% 59% 38% 63%
Average 51% 46% 56% 58% 51% 59%
Source: author calculation, 2014
In Table 8 the higher rate of forecasting for the same year data (training and
testing) is 60% in Test-4 (year 2008) and Test-1 also as good as 59% (year
2005). However, if we look at a whole tested results in this parameter
combination. By average Test-6 can provide the highest forecasting rate
(59%), but it is not significant outperform Test-4 (58%), therefore, two model
can be considered as the best in this parameter combination which can be used
for further forecasting. The worse one is Test-2 (2006) as the following year
forecasting rate is not reached 50%, by average only 46%. The best results of
parameter combination (30, 0.3, 0.5, 1e6) in term of yearly higher forecasting
rate is 63% (year 2013 & 2014) in Test-6.
Table: 9. Testing with parameter combination (50, 0.2, 0.5, 1e-6)
Year Test-1 Test-2 Test-3 Test-4 Test-5 Test-6
2005 59%
2006 47% 52%
2007 43% 49% 55%
2008 58% 45% 59% 59%
2009 43% 56% 43% 55% 57%
2010 43% 58% 58% 51% 49% 54%
2011 46% 56% 61% 53% 49% 53%
2012 46% 54% 61% 55% 45% 50%
2013 46% 56% 54% 57% 46% 48%
2014 37% 63% 63% 59% 45% 58%
Average 47% 54% 57% 56% 49% 52%
Source: author calculation, 2014
The best results of parameters (50, 0.2, 0.5, 1e-6) is Test-3 ( 2007), the highest
forecasting rate (63%) and the worse one (43%), by average is 57%. It is
adopted as the best model in this parameter combination. For a whole data set,
40



model that proved higher forecasting rate for the same year data training and
testing is Test-1 (2005) as same as forecasting rate of parameter combination
(10, 0.2 , 0.5, 1e6) Test-1 in Table 7. But its ability to forecast the following
year is very less, by average only reach 47% of accuracy.
Among these testing with different parameter combination as mentioned in
three tables above, by comparison, the best average result is 59% Test-5 with
parameter combination (10, 0.2 , 0.5, 1e6) in Table 7 and Test-6 of parameter
combination (30, 0.3, 0.5, 1e6) in Table 8 with the same rate (59%). As we
observe that the highest forecasting rate is 66% and the worse one is 55% in
Test-5 that is relatively better than Test-6 in Table 8. Therefore, the forecasting
performance of this parameter combination (10, 0.2 , 0.5, 1e6) can be adopted
as the best of this ANN model.
Table 10. Summary of the best forecasting, parameters (10, 0.2 , 0.5, 1e6)
Year 05 06 07 08 09 10 11 12 13 14
PR 59% 51% 52% 58% 55% 60% 57% 55% 59% 66%
Source: author calculation, 2014

In Fig. 7 shows the training and forecasting performance of the best model in
this research (Test-5), author noted that from year 2005 -2008 the
forecasting rate showed there come from the same year data for training and
testing, but from year 2009 (as the model) and following forecasting rate be
considered the best forecasting performance in this research.
41




Fig. 8 Training & Forecasting performance (%) of ANN model for a
whole data set (n = 50, = 0.2, = 0.5, ep = 1e6).
Source: author calculation, 2014

In this research, we also find out how forecasting performance is, if we train
data each year and test it for the same year data. The result of this method
showed in Table 11.
Table 11 shows the average training for a whole data set varies between 96% -
99%, which be considered as the best training result. When testing is
conducted the results show that forecasting performance is lower than the
results of our proposed methodology, the forecasting rate varies between 53% -
55%. If comparing the forecasting rate values (as the measure of financial
performance) presented in the table 11. We find that the best forecasting rate
is 61% in 2014 with parameter combination (50, 0.2, 0.5, 1e-6), and the worst
rate is 51% in all parameter combination.
99% 99%
96%
98%
99%
97%
59%
51%
52%
58%
55%
60%
57%
55%
59%
66%
0%
20%
40%
60%
80%
100%
120%
2005 2006 2007 2008 2009 2010 2011 2012 2013 May-14
Comparing training & forecasting rate
Training Testing
42



As the results of this method for all of three parameter combination has not
showed any significance different in term of better performance than others.
Therefore, the prediction rate values performance of three parameter
combination can be adopted as the worse of the ANN model for this
methodology.
Table 11. Financial performance of ANN model
Parameter combination (n, , , ep)
Year (10, 0.2 , 0.5, 1e6) (30, 0.3, 0.5, 1e6) (50, 0.2, 0.5, 1e-6)

Training , Testing Training , Testing Training , Testing
2005 0.99 0.59 0.98 0.51 0.99 0.59
2006 0.99 0.51 0.99 0.51 0.99 0.52
2007 0.99 0.52 0.99 0.51 0.96 0.54
2008 0.98 0.57 0.97 0.60 0.98 0.59
2009 0.99 0.55 0.97 0.55 0.99 0.57
2010 0.99 0.53 0.99 0.54 0.97 0.54
2011 0.99 0.53 0.96 0.55 0.99 0.52
2012 0.97 0.53 0.94 0.50 0.97 0.51
2013 0.99 0.50 0.97 0.51 0.96 0.52
May 2014 0.91 0.53 0.84 0.56 0.83 0.61

Average % 98% 54% 96% 53% 96% 55%

Source: author calculation 2014

As 61% is the best forecasting rate in 2014(50, 0.2, 0.5, 1e-6). Therefore, we
try to find out how forecasting performance generate the result, if we use
various learning rate () as mentioned in Table 4. The results show in Fig. 8
which can be concluded that with different learning rate is not enhance the
forecasting performance to better than ( =0.2).


43





Fig. 9 Forecasting performance (%) of ANN model for various values
(n = 50, = 0.5, ep = 1e6).
Source: author calculation 2014

Author also try to find out why the forecasting performance as mention in Fig.
8 is less power in its prediction. Author has compared forecasting results in
term of accuracy between direction number of increase and decrease of stock
price index by percentage, the research finding show that direction of increase
is more accuracy percentage. i.e. year 2014 (direction of increase 62 days &
decrease 36 days) with parameter combination (50, 0.2, 0.5, 1e-6) forecasting
results showed that 77% accuracy of increase and only 13% accuracy of
decrease direction. The reason behind this issue still unable to be justified by
author.
In Table 12. We present the empirical result of other research work in the past
which they used same technical indicators as input variables to forecast the
index prices in different stock markets.
48.48%
61.62%
50.51%
51.52% 51.52%
52.53%
51.52%
0.00%
10.00%
20.00%
30.00%
40.00%
50.00%
60.00%
70.00%
0.1 0.2 0.3 0.4 0.5 0.6 0.7
Forecasting with different in 2014
Forecasting rate
44




Table 12. The empirical result of other research
Author name/year Market No. of
inputs
Training rate Forecasting
rate
Kim (2003 KOSPI 12 58.52% 54.73%
Y.Kara et al.(2011) ISE
(100)
10 84% - 99%. 79.37%
Mahmood Moein
Aldin et al. (2012)
TEPIX 10 94%
Najeb Masoud(2014) LSM 12 82 - 93% 91%


5.2 Comparison of Statistical Performance
Statistical performance of the three parameter combination is compared in
Table 7 (Test-5), Table 8 (Test-6) and Table 9 (Test-3) due to it is considered
as the best forecasting results. As we already mentioned in sub-section 3.1,
MAE, RMSE, MAPE and R
2
, measures are used in order to compare the
statistical performance of parameters combinations. Goodness of fit R
2
is also
referred to as the coefficient of multiple correlations.
MAPE and RMSE measure the residual errors, which gives a global idea of
the difference between the predicted and actual values. Although, the MAE is
very similar to the RMSE but it is less sensitive to large forecast errors. The
longer MAE means higher bias level and less accurate forecast to predict
prices, but it does not mean that MAE is not suitable to predict stock market
fluctuations.
45



As shown in Table 14, the parameter combination (30, 0.3, 0.5, 1e6) is
relatively better than other parameter combination, by average its errors are
smaller. While financial performance showed that parameter combination(30,
0.3, 0.5, 1e6) and (10, 0.2 , 0.5, 1e6) is given the same forecasting results by
average (59%). If we look at the yearly forecasting rate in these parameter
combination Table 7 (Test-5), Table 8 (Test-6); the research finding shows that
(10, 0.2 , 0.5, 1e6) provided the highest forecasting rate as 66% (year 2014)
and statistical error also less than the best forecasting rate (63%) of parameter
combination(30, 0.3, 0.5, 1e6). While parameter combination (50, 0.2, 0.5, 1e-
6) Table 9 (Test-3) showed higher error rate than others. Therefore, parameter
combination (30, 0.3, 0.5, 1e6) can be adopted as the best statistic performance
by average for a whole data analysis, and parameter combination(10, 0.2 , 0.5,
1e6) 66% forecasting rate can be adopted as the best performance in term of
financial and statistical performance in this research.
Table: 13 the best statistic & financial performance
Model No. of
Obs.
R
2
MAE RMSE MAPE Forecasting
rate
ANN 10 0.6283 0.001619 0.227642 0.00464
6
0.66
Source: author calculation, 2014
In all cases the relationship strength between parameter combination and
forecast accuracy measures such as MAE, MAPE, and RMSE is relatively
weak and quite fluctuated, the best results (R
2
= 0.98) and the worst one
(R
2
0.46). According to Table 13, as good as ANN model can be, it is
considered that this model may not really be a powerful tool in forecasting
direction of Indonesian stock price index movement and this research study
46



results is not in consistent with the previous studies as mention in Table 12.
Particularly, Mahmood Moein Aldin et al. (2012) and Najeb Masoud(2014).
If we analyze from the training process, we found that the training results is
very desired and similar to other research work using technical indicators as
input variables, which its results varied between 0.96 to 0.99 and statistic
performance also desired. When we test the model its power of forecasting is
relatively low comparing with its high training results. Author observes that
the forecasting power lessen may cause by a short period of data be trained
(learned). So, the model unable to have enough experience to forecast. The
other factor might be dataset-12 technical indicators(input variables) were
calculated outside the network, as the best knowledge of author technical
indicator be calculated inside the network (Program matlab). Therefore, the
technique of coding may not perfectly done and caused the power of
prediction decrease.

47



Table 14. Statistical performance of ANN model
Parameter combination (n, , , ep)
(10, 0.2, 0.5, 1e6) (30, 0.3, 0.5, 1e6) (50, 0.2, 0.5, 1e-6)
Year R
2
MAE RMSE MAPE R
2
MAE RMSE MAPE R
2
MAE RMSE MAPE
2005 0.6467 0.001945 0.004784 0.004066 0.6467 0.001945 0.004784 0.004066 0.6467 0.001945 0.004784 0.004066
2006 0.8224 0.001982 0.008130 0.004878 0.9875 0.001966 0.004065 0.004837 0.9875 0.001966 0.004065 0.00483
2007 0.9865 0.001920 0.003984 0.004820 0.9865 0.001920 0.003984 0.004820 0.8716 0.001809 0.015936 0.004541
2008 0.6885 0.001730 0.004098 0.004221 0.5901 0.001629 0.004098 0.003975 0.6393 0.001679 0.114754 0.004098
2009 0.6283 0.001619 0.227642 0.004467 0.8266 0.001830 0.012295 0.004467 0.7596 0.001763 0.004098 0.004303
2010 0.7317 0.001723 0.225806 0.004634 0.8776 0.001867 0.004065 0.004593 0.7114 0.001702 0.109756 0.004186
2011 0.8205 0.003096 0.342466 0.004637 0.7971 0.001788 0.032258 0.004435 0.5683 0.001560 0.25 0.003870
2012 0.6559 0.001202 0.291176 0.004647 0.6550 0.002814 0.164384 0.004109 0.5722 0.002674 0.253425 0.003904
2013 0.4673 0.003469 0.30303 0.004911 0.5130 0.001098 0.267647 0.003735 0.8585 0.001349 0.147059 0.004588
2014 0.6283 0.001619 0.227642 0.004646 0.5967 0.003775 0.232323 0.003737 0.5967 0.003775 0.171717 0.003737
Source: author calculation, 2014





48



CHAPTER 6
CONCLUSION

This paper aims to find the answer of the following question: how to
forecast the stock price index in in Indonesian stock exchange? Whether the
forecasted IDX through the learning procedure techniques of ANN model or
not. Is it RWH and EMH theory true?. And comparing the results with
some recent research using ANN model in this market.
Due to the issue of accurately forecasting the direction of movements of the
stock market price levels is highly significant for formulating the best
market trading solutions. It is fundamentally affecting financial traders
decisions to buy or sell.
The research finding can be concluded as follows:
a. ANN technique can be applicable to forest stock price index in
Indonesian stock market, The results of learning rate can be reached
99%, while the best result of forecasting rate is 66%, and the worst rate is
51%. This forecasting technique is considered as a new method which
need to be improved in term of designing the model and find out its input
variable that the market related to. So that it will enhance the better
forecasting results.
b. The power of prediction may not really high in this research
methodology as the authors expectation. However, the prediction result
49



showed above is fairly good. So, it means that stock market price can be
predictable.
c. In terms of comparing ANN performance with recently research. Putra
and Kosala (2011)-using technical variables as input data, the highest
accuracy rate is 80.48% and the worst one is 49.90%, but their
forecasting was focused on individual company, not index prices. For
Veri and Baba (2013) forecasting index price of the next trading day
theyve used daily prices as input variables, the empirical results showed
that 95% of training accurate and for prediction value percentage varied
from 95% to 5% of accuracy. Due to both research provided higher
forecasting rate so this research model is not outperform their research
methodology.
d. However, author believes this methodology can be applied along with
other techniques to help a trading decision.
e. This research methodology has been proved very successful in other
stock market research like LMY, TEPX, etc. there are some factors may
affect the results of this research as to be mentioned in the limitation of
this study.
f. A few of input indicators in the research may not enhance the accuracy
rate (unnecessary), because, this stock market can be affected by many
macro-economic factors such as political events, investors expectations,
institutional investors choices, firms policies, general economic
50



conditions, interest rates, foreign exchange rates, movement of other
stock market, psychology of investors etc.
The limitations of current study: Forecasting stock price index using
artificial neural network is a new methodology applied in emerging market
(Suchira Chaigusin, 2011) comparing to other methodology i.e. fundamental
analysis, technical analysis etc. accessibility to this methodology have some
limited.
The most important part of research work is to concentration on coding or
programing to create the right forecasting model and find out the best
training parameter combination in the goal of reaching the best forecasting
results. Meanwhile the researcher himself has very less experience in the
field of computer science and information technologies, as this
knowledge/skill is required by the research itself. So, the forecasting model
in this research may not perfectly done as same as IT expert does. However,
author hope that this research will be the first step for other students who
wish to continue improving this research methodology or other ANN model.
For further research, author would like to provide some such suggestion as
following:
a. Improving this methodology through using matlab tool box, which will
enhance more accurate prediction rate.
b. Each method has its own strengths and weaknesses. So, author suggest
to use technical indicators of this study and other combining techniques
51



models by integrating ANN with other classification models such as
Support Vector Machines (SVM), Genetics Algorithm (GA) etc. The
weakness of one method can be balanced by the strengths of another by
achieving a systematic effect.
c. To the best knowledge of the author, the prediction performance of this
model can be improved by many ways i.e. adjusting the model
parameters by conducting a more sensitive and comprehensive parameter
setting. Otherwise, reduction of current variables and adding more
different input variables i.e. macro-economic variables such as foreign
exchange rates, interest rates and international stock indexes that related
to IDX, etc.

Benefit of this research: author believes that this research method would
benefits to other students in many ways for their further study about
using artificial neural network as a tool to forecast stock prices:
a. For student who dont know about ANN, this research can provide
some information and idea on ANN, how its work and why its used
in financial field.
b. It will be the basic idea for students who wants to try a new
methodology of forecasting stock prices, especially, who are
majoring finance or related fields.
c. Student can learn some part of its function used in this research and
its code in the matlab program. So that they can create their own
52



methodology and may have more powerful prediction model than
current research.
d. Author believes that this research methodology cannot be done
without any mistake. However, this research provides student some
basic understanding on how to do it and also benefits to other
researcher more or less in someway.
e. As we are a student at present who want to be a successful investor
in the future, we cannot reliance on the old ways of forecasting stock
prices or using single analyzing technique for making investment
decision. This technique (ANN) is highly supported for further study
and author believes this research can be a reference or being the first
step for other researcher who never used this forecasting technique
before.








53




REFERENCES
Alireza Shahkarami, Shahab D. Mohaghegh & Vida Gholami (2014)
Artificial Intelligence (AI) Assisted History Matching. West
Virginia University, SPE-169507-MS
Adebiyi Ayodele A., Ayo Charles K., Adebiyi Marion O. and Otokiti
Sunday O. (2009) Stock Price Prediction using Neural Network
with Hybridized Market Indicators. Journal of Emerging Trends in
Computing and Information Sciences. Retrieved January 2012.
Vol. 3, No. 1
Altay, E., & Hakan Satman, M. (2005) Stock market forecasting: artificial
neural network and linear regression comparison in an emerging
market. Journal of Financial Management and Analysis, 18(2), 18-
33
A. Victor Devadoss & T. Antony Alphonnse Ligori (2013) Stock Prediction Using
Artificial Neural Networks. International Journal of Data Mining
Techniques and Applications. December. Vol. 02, 283-291
An-Sing Chen, Mark T. Leung and Hazem Daouk (2003) Application of
neural networks to an emerging financial market: forecasting and
trading the Taiwan Stock Index. Computers & Operations
Research 30, 901923
Appel, Gerald (2005). Technical Analysis Power Tools for Active Investors.
Financial Times Prentice Hall. p. 166. ISBN 0-13-147902-4
Chung-Ming Kuan and Halbert White (1994) Comment on artificial neural
networks: an econometric perspective. Econometric Reviews 13(1):
93-97
David Sutyanto (2013) Investing in Indonesia: a basic Introduction to the
Indonesia Stock Exchange, April 1. at http://www.indonesia-
investments.com
Daniel Svozil, Vladimir Kvasnika, Ji Pospchal(1997) Introduction to
multi-layer feed-forward neural networks. Chemometrics and
Intelligent Laboratory Systems 39, 43-62
Eddy F. Putra & Raymondus Kosala (2013) Application of Artificial Neural
Networks To Predict Intraday Trading Signals. Recent Researches
in E-Activities ISBN: 978-1-61804-048-0
54



E. E. Peters, Chaos and order in the capital markets: A new view of cycles,
prices, and market volatility, John Wiley & Sons Inc. (1991).
E. GiEord, Investors Guide to Technical Analysis: Predicting Price Action
in the Markets, Pitman Publishing, London, 1995.
Tae Hyup Roh (2007) Forecasting the volatility of stock price index. Expert
Systems with Applications, 33, 916922
Jhon Veri and Mohd.Sopiyan Baba (2013) Intelligent Decission Support
System For Prediction Of Indonesia Stock Exchanges. IJISI, Vol 1,
No. 1, April. ISSN: 2289-3709
Jing Tao YAO & Chew Lim TAN (2001) Guidelines for Financial
Forecasting with Neural Networks, available at
http://www2.cs.uregina.ca/~jtyao/Papers/guide_iconip01.pdf
J. Chang, Y. Jung, K. Yeon, J. Jun, D. Shin, H. Kim, Technical Indicators
and Analysis Methods, Jinritamgu Publishing, Seoul, 1996.
J.J. Murphy, Technical Analysis of the Futures Markets: A Comprehensive
Guide to Trading Methods and Applications, Prentice-Hall, New
York, 1986.
Kim Kyoung-jae (2003) Financial time series forecasting using support
vector machines. Neurocomputing 55, 307 319
Mark T. Leunga, Hazem Daoukb and An-Sing Chen (2000). Forecasting
stock indices: A comparison of classification and level estimation
models. International Journal of Forecasting, 16, 173190.
Liao Zhe & Wang Jun (2010). Forecasting model of global stock index by
stochastic time effective neural network. Expert Systems with
Applications, 37, 834841
Mahmood Moein Aldin et al., (2012) Evaluating the Employment of
Technical Indicators in Predicting Stock Price Index Variations
Using Artificial Neural Networks, International Journal of
Business and Management; Vol. 7, No. 15
Manish Kumar & Dr. M. Thenmozhi (2006) Support Vector Machines Approach to
Predict the S&P CNX NIFTY Index Returns, available at:
http://ssrn.com/abstract=962833
Mark Hudson Beale et al. Nueral Nextwork Toolbox - Users Guide R2013b.
MathWorks
Najeb Masoud (2014) Predicting Direction of Stock Prices Index Movement
Using Artificial Neural Networks: The Case of Libyan Financial
Market. British Journal of Economics, Management & Trade
55



O.E. Barndorff-Nielsen, J.L. Jensen and W.S. Kendall (1993). Networks and
chaos: statistical and probabilistic aspects. London: Chapman and
Hall; 1993.
Sneha Soni (2011) Applications of ANNs in Stock Market Prediction: A
Survey. International Journal of Computer Science & Engineering
Technology. Vol. 2, Issue.3, 71-83
Suchira Chaigusin (2011) An Investigation Into the Use of Neural Network
for the Prediction of the Stock Exchange of Thailand. Edith Cowan
University
S.B. Achelis, Technical Analysis from A to Z, Probus Publishing, Chicago,
1995.
Ser-Huang Poon (2005) A Practical Guide to Forecasting Financial Market
Volatility. Jhon Wiley and Sons, ltd, England.
Stock price data (Jan. 2005 - May 2014) of Indonesia Stock Index available
at
https://finance.yahoo.com/q/hp?s=^JKSE&a=00&b=1&c=2005&d
=04&e=28&f=2014&g=d
Zaiyong Tang, C. de Almeida, P. A. Fishwick (1991) Time series
forecasting using neural networks vs. Box-Jenkins methodology.
Simulation 57(5):303-310 from
http://www.researchgate.net/publication/242925036_Time_series_f
orecasting_using_neural_networks_vs._Box_Jenkins_methodology
Tuan Zea Tan, Chai Quek and Geok See Ng (2007). Biological brain-
inspired genetic complementary learning for stock market and bank
failure prediction. Computational Intelligence, 23(2), 236261.
Wythoff BJ. (1993) Back-propagation neural networks: a tutorial.
Chemometrics and
Intelligent Laboratory Systems. 18(2):115-155.
Yakup Kara, Melek Acar Boyacioglu, mer Kaan Baykan (2011) Predicting
direction of stock price index movement using artificial neural
networks and support vector machines: the sample of the Istanbul
Stock Exchange. Expert Systems with Applications 38, 5311-5319
Yanshan Wang & In-Chan Choi (2013) Market Index and Stock Price
Direction Prediction using Machine Learning Techniques: An
empirical study on the KOSPI and HSI. ScienceDirec. 1-13
Yaser S. Abu-Mostafa & Amir F. Atiya (1996). Introduction to financial
forecasting. Applied Intelligence, 6(3), 205213.
56



Yochanan Shachmurove and Dorota Witkowska (2000) Utilizing Artificial
Neural Network Model to Predict Stock Markets. The City College
of the City University of New York and The University of
Pennsylvania. Variable at
http://www.scribd.com/doc/189092644/file
























57



Apendix A: Matlab code


(Blank)
58

Potrebbero piacerti anche