Вы находитесь на странице: 1из 41

STOCK MARKET PREDICTION USING HIDDEN MARKOV MODEL

REKHA THELLA B111318


RADHIKA GUBIGE B111441
RUBINA B111522

Under the guidance of

Mr. E. Anjaneyulu
Assistant Professor in the Department of CSE

DEPARTMENT OF COMPUTER SCIENCEAND ENGINEERING


RAJIV GANDHI UNIVERSITY OF KNOWLEDGE TECHNOLOGIES
BASAR, NIRMAL (DIST.),
TELANGANA - 504107

i
STOCK MARKET PREDICTION USING HIDDEN MARKOV MODEL

Project report submitted to


Rajiv Gandhi University of Knowledge Technologies, Basar
for the partial fulfillment of the requirements
for the award of the degree of

Bachelor of Technology
in
Computer Science and Engineering
Submitted by

Rekha Thella B111318


Radhika Gubige B111441
Rubina B111522

Under the guidance of

Mr. E. Anjaneyulu
Assistant Professor in the Department of CSE

DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING


RAJIV GANDHI UNIVERSITY OF KNOWLEDGE
TECHNOLOGIES, BASAR
May-2017

ii
DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING

RAJIV GANDHI UNIVERSITY OF KNOWLEDGE

TECHNOLOGIES, BASAR

CERTIFICATE

This is to certify that the thesis entitled ‘STOCK MARKET PREDICTION USING HIDDEN
MARKOV MODEL’ submitted by Rekha Thella ID - B111318, Radhika Gubige ID - B111441,
Rubina ID - B111522, Department of Computer Science and Engineering, Rajiv Gandhi University Of
Knowledge Technologies, Basar; for partial fulfillment of the requirements for the degree of Bachelor of
Technology in Computer Science and Engineering; is a bonafide record of the work and investigations
carried out by him under my supervision and guidance.

Mr. E. Anjaneyulu, Mr. A. Ranjith Kumar,


Supervisor, Head of the Department,
Assistant Professor in CSE, Assistant Professor in CSE,
Rajiv Gandhi University of Rajiv Gandhi University of
Knowledge Technologies, Knowledge Technologies,
Basar. Basar.

External Examiner

iii
DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING

RAJIV GANDHI UNIVERSITY OF KNOWLEDGE TECHNOLOGIES, BASAR

DECLARATION

We hereby declare that the work which is being presented in this project entitled, " STOCK MARKET
PREDICTION USING HIDDEN MARKOV MODEL " submitted to RAJIV GANDHI UNIVERSITY OF
KNOWLEDGE TECHNOLOGIES, BASAR in the partial fulfillment of the requirements for the award of the
degree of BECHLOR OF TECHNOLOGY in COMPUTER SCIENCE AND ENGINEERING, is an
authentic record of our own work carried out under the supervision of Mr. E. Anjaneyulu, Assistant Professor
in Department of Computer Science And Engineering, RGUKT, Basar.
The matter embodied in this project report has not been submitted by us for the award of any other degree.

Place: BASAR REKHA THELLA B111318


Date: RADHIKA GUBIGE B111441
RUBINA B111522

iv
ACKNOWLEDGEMENT

We deem it a privilege to have been students of Computer Science and Engineering stream in
Rajiv Gandhi University of Knowledge Technologies, Basar. We wish to express our deep sense of
gratitude from the bottom of our hearts to our project guide Mr. Anjaneyulu sir for his motivating
discussions, overwhelming suggestions, ingenious encouragement and advice, invaluable supervision,
exemplary guidance, valuable inputs throughout this project. We consider ourselves fortunate to be
working under his supervision.

We would like to extend our heartfelt thanks to our HOD Mr. Ranjith Kumar sir for
encouraging us in every possible way.

For us it was a unique experience to study many interesting things. It also helped in enhancing
our knowledge and gave a platform for applying our theoretical knowledge in practical and to have new
ideas for our future career.

We express our sincere thanks to all of our friends and parents who have patiently extended all
sorts of help for accomplishing this undertaking without whom this project could not have been
achieved.

REKHA THELLA B111318


RADHIKA GUBIGE B111441
RUBINA B111522

v
ABSTRACT

Stock prices change every day as a result of market forces. There is a change in share price
because of supply and demand. According to the supply and demand, the stock price either moves up
or undergoes a fall. When the economy slows, stock prices tend to be more mixed. Markets may take
time to form bottoms or make tops, sometimes of two years or more. This makes it difficult to
determine when the market hits a top or a bottom.
Despite its prevalence, Stock Market prediction remains a secretive and empirical art. Few
people, if any, are willing to share what successful strategies they have. A chief goal of this project is to
add to the academic understanding of stock market prediction using Hidden Markov model. The hope
is that with a greater understanding of how the market moves, investors will be better equipped to
prevent another financial crisis. So this project focuses on prediction of stock price trend, and takes the
approach of analyzing the time series indicators as features to classify trend (Raise or Down).
By using this method the investor can predict whether he gets profit or loss before investing on
particular company or stock.

vi
Table of Contents
CERTIFICATE ..................................................................................................................................................... iii
DECLARATION ................................................................................................................................................... iv
ACKNOWLEDGEMENT ..................................................................................................................................... v
ABSTRACT ........................................................................................................................................................... vi
List of Figures ...................................................................................................................................................... viii
List of Tables ........................................................................................................................................................ viii
Chapter 1.Introduction ..................................................................................................................................... - 1 -
1.1 Introduction to Hidden Markov model ................................................................................................ - 2 -
1.1.1 Description in terms of urns ........................................................................................................ - 3 -
2.1 Stock Trend Prediction with Technical Indicators .................................................................................... - 4 -
2.2 The random walk model ............................................................................................................................ - 5 -
2.3 Prediction of Stock Performance in the Indian Stock Market Using Logistic Regression ........................ - 5 -
Chapter 3. Methodology ................................................................................................................................... - 6 -
3.1 Markov chains ........................................................................................................................................... - 6 -
3.2 Transition Probabilities ............................................................................................................................. - 6 -
3.3 Transition Matrix ....................................................................................................................................... - 7 -
3.4 State Transition Diagrams ......................................................................................................................... - 7 -
3.5 Categorizing States of Markov Chains ...................................................................................................... - 8 -
3.5.1 Transition States ................................................................................................................................. - 9 -
3.5.2 Recurrent States and Absorbing States ............................................................................................... - 9 -
3.6 Properties of Markov Chains in the Long Run .......................................................................................... - 9 -
3.6.1 Steady State Probabilities ....................................................................................................................... - 9 -
3.6.2 Applying Steady State Probabilities to the Transition Matrix .......................................................... - 10 -
Chapter 4: Results and Discussions ............................................................................................................... - 12 -
4.1 Procedure with Data ................................................................................................................................ - 12 -
4.3 Results and Observations: ....................................................................................................................... - 30 -
4.3.1 Output for Infosys data: .................................................................................................................... - 30 -
4.3.2 Output for CapGemini data .............................................................................................................. - 31 -
Chapter 5. Summary and Conclusions .......................................................................................................... - 32 -
Chapter 6. References ..................................................................................................................................... - 33 -

vii
List of Figures
FIGURE 1.1:PROBABILISTIC PARAMETERS OF A HIDDEN MARKOV MODEL (EXAMPLE) ........................... - 3 -
FIGURE 3.1:TRASITION MATRIX FOR N-STEP TRANSITION ...................................................................... - 7 -
FIGURE 3.2:STATE TRANSITION DIAGRAM ............................................................................................. - 8 -
FIGURE 4.1:FINAL OUTPUT FOR INFOSYS DATA .................................................................................... - 30 -
FIGURE 4.2:FINAL OUTPUT FOR CAPGEMINI DATA .............................................................................. - 31 -

List of Tables
TABLE 1.1:TECHNICAL INDICATORS ...................................................................................................... - 4 -
TABLE 4.2:CALCULATIONS FOR CLOSING PRICES ................................................................................. - 19 -
TABLE 4.3: INTERVALS FOR I=3 OPENING VALUES ............................................................................... - 26 -
TABLE 4.4: INTERVALS FOR I=3 CLOSING VALUES ............................................................................... - 26 -
TABLE 4.5:INTERVAL I=3 OPENING PRICES COUNT .............................................................................. - 27 -
TABLE 4.7: INTERVAL I=3 CLOSING PRICES COUNT .............................................................................. - 28 -
TABLE 4.7:RESULTS FOR OPENING PRICES ........................................................................................... - 29 -

viii
Chapter 1.Introduction

In our project, we were asked to analyze a year’s worth of stock portfolio for a company and
apply moving averages and Markov Chains to the data in hopes to predict the stock prices for the near
future. We chose Infosys datasets as it is a company that everyone knows and the stock price data was
well diverse and had enough information for many applications of moving average.

The first thing we did was to apply moving averages to create an approximate evaluation of the
data. In order to find moving averages, we first had to apply a moving average with an increment of
three. This involves taking the sum of three days of stock and then dividing it by three. However, one
can only do this starting at day three , because there was enough data to actually create a moving
average. We eventually had a data set that included a moving average price and a closing price. We
then needed to find a difference data set to apply Markov Chains too. We took the difference of the
closing price and the moving average price. These differences were going to be what we applied
Markov Chains too.
However, we first had to group the differences into four blocks. The reason why we did this
was to create more accurate observations that it makes it more exact when we analyze the data. We
then create a transition matrix. The entries in the matrix represented how many times the data points go
from one block to another. This leads to 16 observations of data. For example, the first row of entries
the matrix represents the number of times the data goes from the first block and stays in the first block,
the number of times the data goes from the first block to the second block, the number of times the data
goes from the first block to the third block, and the last entry of the row represents the number of times
the data goes from the first block to the fourth block. All entries needed to be in decimal form, so the
total number of observation points divided each entry.
With the matrix, we could now apply Markovian properties to our data. In other words, using
Markovian properties we created a system of equations with the unknown variables being our steady
states that we are aiming to obtain. These equations are sums of probabilities multiplied by our
unknown variables. We then aimed to solve the system of equations to find our steady state
probabilities.
With our steady state probabilities we were now able to predict where each immediate stock
price can fall into an interval. These probabilities are now good indicators of where the stock prices
will fall. We then observed the new data and made some observations. We noticed that a moving
average with an interval of 3, was too small and it’s resulting steady states were too close together to

-1-
see an actual difference in intervals. We then increased it to an interval of 5 and found that there was an
improved steady state differences, but still a little close. We were able to predict what the possible price
range for a given day could be, but we also came to the conclusion that only four interval blocks may
have not been a large enough selection. However, due to time constraints, if we did increase the
number of blocks, there would be issues in completing the project on time. In conclusion, applying
Markov Chains is an effective way to predict stock prices, but one needs to create a large enough
intervals to get better results.

1.1 Introduction to Hidden Markov model


A hidden Markov model (HMM) is a statistical Markov model in which the system being
modeled is assumed to be a Markov process with unobserved (hidden) states. An HMM can be
presented as the simplest dynamic Bayesian network. The mathematics behind the HMM were
developed by L. E. Baum and coworkers. It is closely related to an earlier work on the optimal
nonlinear filtering problem by Ruslan L. Stratonovich who was the first to describe the forward-
backward procedure.
In simpler Markov models (like a Markov chain), the state is directly visible to the observer, and
therefore the state transition probabilities are the only parameters. In a hidden Markov model, the state
is not directly visible, but the output, dependent on the state, is visible. Each state has a probability
distribution over the possible output tokens. Therefore, the sequence of tokens generated by an HMM
gives some information about the sequence of states. The adjective 'hidden' refers to the state sequence
through which the model passes, not to the parameters of the model; the model is still referred to as a
'hidden' Markov model even if these parameters are known exactly.
A hidden Markov model can be considered a generalization of a mixture model where the
hidden variables (or latent variables), which control the mixture component to be selected for each
observation, are related through a Markov process rather than independent of each other. Recently,
hidden Markov models have been generalized to pairwise Markov models and triplet Markov models
which allow consideration of more complex data structures and the modelling of non-stationary data.

-2-
1.1.1 Description in terms of urns

In its discrete form, a hidden Markov process can be visualized as a generalization of the Urn
problem with replacement (where each item from the urn is returned to the original urn before the next
step). Consider this example: in a room that is not visible to an observer there is a genie. The room
contains urns X1, X2, X3, … each of which contains a known mix of balls, each ball labeled y1, y2, y3,
… . The genie chooses an urn in that room and randomly draws a ball from that urn. It then puts the
ball onto a conveyor belt, where the observer can observe the sequence of the balls but not the
sequence of urns from which they were drawn. The genie has some procedure to choose urns; the
choice of the urn for the nth ball depends only upon a random number and the choice of the urn for the
(n-1)th ball. The choice of urn does not directly depend on the urns chosen before this single previous
urn; therefore, this is called a Markov process. It can be described by the upper part of Figure.

The Markov process itself cannot be observed, only the sequence of labeled balls, thus this
arrangement is called a "hidden Markov process". This is illustrated by the lower part of the diagram
shown in Figure 1, where one can see that balls y1, y2, y3, y4 can be drawn at each state. Even if the
observer knows the composition of the urns and has just observed a sequence of three balls, e.g. y1, y2
and y3 on the conveyor belt, the observer still cannot be sure which urn (i.e., at which state) the genie
has drawn the third ball from. However, the observer can work out other information, such as the
likelihood that the third ball came from each of the urns.

Figure 1.1:Probabilistic parameters of a hidden Markov model (example)

X—states
y—possible observations
a—state transition probabilities
b—output probabilities

-3-
Chapter 2.Review of Literature

2.1 Stock Trend Prediction with Technical Indicators

This method focuses on predicting stock price trend for a company in the near future. Unlike
some other approaches which are concerned with company fundamental analysis (e.g. Financial
reports, market performance, sentiment analysis etc.), the feature space is derived from the time series
of the stock itself and is concerned with potential movement of past price. Tree algorithm is applied to
feature selection and it suggests a subset of stock technical indicators are critical for predicting the
stock trend. It explores different ways of validation and shows that overfitting tend to occur due to
fundamentally noisy nature of a single stock price. Experiment results suggest that we are able to
achieve more than 70% accuracy on predicting a 3-10 day average price trend with some technical
indicators.

Table 1.1:Technical Indicators

Indicators Name Description Formula


WILLR Williams %R Determines where (highest-
today’s closing price closed)/(highest-
fell within the range lowest)*100
on past 10day’s
transaction.
ROCR Rate of Change Compute rate of (Price(t)/Price(t-
change relative to n))*100
previous trading
intervals
MOM Momentum Measures the change Price(t)-Price(t-n)
in price
TSF Time Series Calculates the linear Linear Regression
Forecasting regression of 20-day Estimate with 20-day
price price.

-4-
2.2 The random walk model

Let Xt be the price of stock on any particular day t. At each subsequent time unit, Xt varies in
an unpredictable fashion such that during each time unit the stock price moves its location either one
unit left ward, or one unit right ward or it remains the same. We suppose that the system can either
remain in i, or move to state i-1 or to state i+1 and the random direction of each jump is independent of
all earlier jumps. More specifically, if Sn denotes the location of the stock prices at time n the overall
behavior of the sequence (Sn) is of the form:

Where:
S0=The Starting Position
Xj=Independent and identically distributed random variables each taking either the value -1 with
probability q, or the value +1 with probability p, or remain the same at value 0 with probability

2.3 Prediction of Stock Performance in the Indian Stock Market Using Logistic
Regression

The authors use logistic regression (LR) and various financial ratios as independent variables to
investigate indicators that significantly affect the performance of stocks actively traded on the Indian
stock market. The study sample consists of the ratios of 30 large market capitalization companies over
a four-year period. The study identifies and examines eight financial ratios that can classify the
companies up to a 74.6% level of accuracy into two categories – ―good‖ or ―poor‖ – based on their rate
of return. The paper asserts that the model developed can enhance an investor's stock price forecasting
ability. Macro economic variables, which also can influence the share price, were not taken into
account, however. The paper discusses the practical implications of using the LR method to predict the
probability of good stock performance. The authors state that the model can be used by investors, fund
managers, and investment companies to enhance their ability to select out-performing stocks

-5-
Chapter 3. Methodology

3.1 Markov chains

A Markov Chain is a stochastic process that has the Markovian property.

Definition 1.1: A stochastic process is defined to be an indexed collection of random variables {X t}, where the
index t runs through a given set T, generally labeled with the set of nonnegative integers. The variable X t is
meant to represent a measurable characteristic, or point of interest. For example, if one were to look at a
collection of muffins, some with blueberries and some without blueberries, the variable Xt can be used to label
muffins with blueberries. Supposedly, if there were four blueberry muffins within a given collection, the set X t
could be designated as the set of blueberry muffins, with each muffin labeled as X1, X2, X3, or X4.Thus, it is
evident from this example that stochastic processes are discrete collections of random variables.
A stochastic process often has the following structure:
The current status of the system can fall into any one of a set of (M+1) mutually exclusive categories
called states. For convenience, these states are labeled with integers from 0 to M. The random variable X t
represents the state of the system at time t, so it’s only possible values are 0 to M. The system is observed at
particular points of time, labeled t= 0 to M. Thus, the stochastic process {Xt} = {X0, X1, X2,…} provides a
mathematical representation of how the status of the physical system evolves over time.1 Using the previous
example of a collection of muffins, the variable X2 here would represent the number of blueberry muffins at
time, t=2.
Definition 1.2: A stochastic process {X t } is said to have the Markovian property if P {X t+1 =j| X 0 = k 0
, X 1 = k 1 ,...,X t-1 = k t-1 , X t = i} = P{X t+1 = j| X t = i}, for t = 0,1,2... and every sequence i, j, k 0 , k 1
,..., k t-1 . 2 This is saying that the probability of Xt+1 being equal to j is solely dependent upon the
preceding event of what X t equals.

3.2 Transition Probabilities

Conditional probabilities for Markov Chains are called transition probabilities.

Definition 1.3: If Conditional probabilities are defined as P{Xt+1 = j|Xt = i} then, for each i and j,
stationary one-step transition probabilities for a Markov Chain are defined as
P{Xt+1 = j | Xt = i} = P{X1 = j|X0 = i} for all t = 1,2, ...
Aside from one-step transition probabilities, Markov Chains can also have n-step transition
probabilities, which is the conditional probability that the process will be in state j after n-steps
provided that it starts in state i at time t.

-6-
Definition 1.4: n-step transition probabilities are defined as the conditional probability {Xt+1=j
|Xt=i}=P{Xn=j|X0=i} for all t=0,1,…
Therefore, a Markov Chain is a stochastic process that states that the conditional probability of a future
event relies on the present state of the process, rather than any past states, or events.
A conventional way to note stationary transition probabilities that will be seen later in this paper is,
Pij={Xt+1=j|Xt=i},
(n)={Xt+1=j|Xt=i}.

3.3 Transition Matrix

The conditional probabilities for a stochastic process can be organized into an n-step transition
matrix. Such a matrix is of the form

Figure 3.1:Trasition Matrix for n-step transition

A transition matrix shows the transition probability in a particular column and row as the
transition from the row state to the column state. Since transition matrices are comprised of conditional
probabilities, each entry of a transition matrix is nonnegative and less than 1. Each row of a transition
matrix must also sum to the value 1 since each row signifies a state of the overall stochastic process,
and each entry within each row is a conditional probability for the process to be in that state.

3.4 State Transition Diagrams

A convenient and useful method to visualize the state of Markov Chains when they have
stationary transition probabilities and a finite number of states is through the use of a state transition

-7-
diagram. In such diagram, each state of a Markov chain is drawn as a numbered node, the conditional
probability of moving from one state to another is drawn by connecting the nodes with an edge and
labeling the edge with the numbered probability. For example, if the weather in a certain town is given
by the following stochastic process {Xt} for t=0,1,2,…

where: Xt= 1 if day t is sunny


2 if day t is cloudy
And
{Xt+1=1 |Xt=1}=0.7 {Xt+1=2|Xt=1}=0.4
Then the state transition diagram for this example is:

Figure 3.2:State Transition Diagram

3.5 Categorizing States of Markov Chains

Since Markov chains are long run stochastic processes that include transitional probabilities
which indicate the likelihood the process will move from one state to another, it is often necessary to
categorize, or classify, the varying types of states.

Definition 1.5: A state k is said to be accessible from a state j if(n)>0 for some n≥0, or simply stated,
the system can eventually move from state j to state k.
Definition 1.6: If a state j is accessible from a state k and k is accessible from state j then states j and k
are said to communicate with one another.
In a Markov chain, every state communicates with itself, since(0)=P{X0=j|X0=j}=1, and if a
state j is said to communicate with another state k then k communicates with j. If a state j
communicates with k and k communicated with l then state j communicates with state.
Since different states can communicate with one another within the same system, Markov
Chains can be placed into classes, which are groupings of states that only communicate with one
another. If every state of a Markov chain communicates with every other state within the chain, that is
if the entire Markov chain is in itself one class, then the chain is said to be irreducible.

-8-
3.5.1 Transition States

When studying a Markov chain, certain states may only be accessible from others and often
times whether or not the system will move from one state to another is convenient to know.

Definition 1.6: If some state j is accessible from state k, but k is not accessible from j (provided that
j≠k), then j is considered a transient state. Therefore a transient state is one where once the process
enters the state, the process can never return to the state, and once the process enters the state, there
exists a positive probability that the process will move to another state and will never return to the
original state. Thus, the chain will only enter transient states a finite number of times.

3.5.2 Recurrent States and Absorbing States

Aside from transient states where once the process enters, it can leave, but will never return,
other states have the characteristic that the process will most certainly return to it after it has entered it
once, and certain others have the characteristic that once the process enters the state, it will never leave
the state.

Definition 1.7: If a stochastic process, such as a Markov chain, enters a state, and will definitely return
to it, the state is said to be recurrent. Hence, recurrent states cannot be transient; however, they can be
absorbing.
Definition 1.8: A state is considered to be absorbent, if after entering the state, the process will never
leave the state. If for example, the state j is an absorbing state, then Pjj=1.
From the above definitions, it is apparent that when grouping the states of a Markov chain into
classes, each state belonging to a class is either transient or recurrent. For an irreducible finite-state
Markov chain, every state is recurrent, and for any finite-state Markov chain, all the states cannot be
transient.

3.6 Properties of Markov Chains in the Long Run

3.6.1 Steady State Probabilities

After the n-step transition probabilities for a Markov chain have been calculated, the Markov
chain will display the characteristic of a steady state. Meaning, that if the value of n is large enough,
every row of the matrix will be the same, and such, the probability that the process is in each state does

-9-
not depend on the initial state of the process. Therefore, the probability that the process will be in each
state k after a certain number of transitions is a limiting probability that exists independently of the
initial state. This can be defined as:

For any irreducible ergodic Markov chain, limn→∞(n) exists and is independent of i. Furthermore,
limn→∞(n)=πj>0
where the πj uniquely satisfy the following steady-state equations
πj=πjpij,=0 for j=0,1,…,M, πj=1.Mj=0
The steady state probabilities of the Markov chain are πj. These values indicate that after a large
number of transitions the probability of finding the process in a particular state such as j tends to the
value of πj which is independent of the initial state. The πj are also known as stationary probabilities,
when if the initial probability of being in state j is given by πj for all j, then the probability of finding
the process in state j at time n=1,2,… is also given by πj, or P{Xn=j}=πj.

3.6.2 Applying Steady State Probabilities to the Transition Matrix

In order to solve for the steady state probabilities formulas must be applied to the transition
matrix, and the linear system needs to be solved. Suppose, for a given Markov chain, the one-step
transition matrix is the following:

By solving above linear equations we will get all steady states.

- 10 -
3.7 Stock Terminology

In order to proceed with the application of Markov chains to the prediction of stock prices, a set
of terminology regarding stocks is also useful to have. This project in particular uses opening and
closing prices.

Definition 2.5.1: A stock market is an exchange where security trading is conducted by professional
stockbrokers. It is a public market in which shares of different companies are bought and sold. The
technical analysis for it is anticipating future price movements using historical prices, trading volume,
open interest, and other trading data to study price patterns.

Definition 2.5.2: The opening price refers to the price of each individual share on the beginning of that
trading day.

Definition 2.5.3: The closing price refers to the price of each individual share at the end of that trading
day.
Once a list of stock prices has been found, calculating a moving average for the prices provides
a method for forecasting the stock prices. Moving averages show the general tendency of the stock
prices over the long run, and therefore provide a simple and useful way to predict the future of the
prices.
Definition 2.5.4: Given a sequence, {ai}=1N, an n-moving average is a new sequence {si}u=1N−n+1
defined from the ai by taking the average of the subsequence of n terms,

Si= 1naij+n−1j=1 .

- 11 -
Chapter 4: Results and Discussions

4.1 Procedure with Data

In order to better understand the process of using Markov chains and how we reached the data
that we have, this section explains the procedure with a corresponding data set so as to better explain
our work.

Once we had our data set, we calculated the corresponding moving average. In this case the
moving average is over an interval of 4 days. For the other data sets that were used for this project.

Table 4.1:Calculations for Opening prices

Date Opening Moving Average of Difference of Prices P Transition


Prices Opening (Actual-Mov. Avg) State State
Prices(Interval =3) Count

01-Jan-2016 1100.00 #NA #NA #NA #NA


04-Jan-2016 1099.95 #NA #NA #NA #NA
05-Jan-2016 1085.50 1095.1499999999999 -9.649999999999864 p_2 p_2
06-Jan-2016 1074.65 1086.7 -12.049999999999955 p_1 p_21
07-Jan-2016 1060.05 1073.3999999999999 -13.349999999999909 p_1 p_11
08-Jan-2016 1061.50 1065.4 -3.900000000000091 p_2 p_12
11-Jan-2016 1056.30 1059.2833333333335 -2.983333333333576 p_2 p_22
12-Jan-2016 1062.00 1059.9333333333334 2.066666666666606 p_3 p_23
13-Jan-2016 1057.00 1058.4333333333334 -1.433333333333394 p_2 p_32
14-Jan-2016 1066.00 1061.6666666666667 4.3333333333332575 p_3 p_23
15-Jan-2016 1148.00 1090.3333333333333 57.66666666666674 p_4 p_34
18-Jan-2016 1139.90 1117.9666666666667 21.933333333333394 p_4 p_44
19-Jan-2016 1135.00 1140.9666666666667 -5.966666666666697 p_2 p_42
20-Jan-2016 1134.00 1136.3 -2.2999999999999545 p_2 p_22
21-Jan-2016 1135.00 1134.6666666666667 0.33333333333325754 p_3 p_23
22-Jan-2016 1148.10 1139.0333333333333 9.066666666666606 p_3 p_33
25-Jan-2016 1140.25 1141.1166666666666 -0.8666666666665606 p_2 p_32
27-Jan-2016 1146.45 1144.9333333333332 1.5166666666668789 p_3 p_23
28-Jan-2016 1136.00 1140.8999999999999 -4.899999999999864 p_2 p_32
29-Jan-2016 1138.00 1140.1499999999999 -2.1499999999998636 p_2 p_22

- 12 -
01-Feb-2016 1170.00 1148.0 22.0 p_4 p_24
02-Feb-2016 1176.85 1161.6166666666666 15.233333333333348 p_4 p_44
03-Feb-2016 1167.80 1171.55 -3.75 p_2 p_42
04-Feb-2016 1160.05 1168.2333333333333 -8.183333333333394 p_2 p_22
05-Feb-2016 1175.50 1167.7833333333335 7.71666666666647 p_3 p_23
08-Feb-2016 1163.75 1166.4333333333334 -2.683333333333394 p_2 p_32
09-Feb-2016 1128.30 1155.8500000000001 -27.550000000000182 p_1 p_21
10-Feb-2016 1108.00 1133.3500000000001 -25.350000000000136 p_1 p_11
11-Feb-2016 1111.00 1115.7666666666667 -4.7666666666666515 p_2 p_12
12-Feb-2016 1094.70 1104.5666666666666 -9.86666666666656 p_2 p_22
15-Feb-2016 1096.25 1100.6499999999999 -4.399999999999864 p_2 p_22
16-Feb-2016 1087.00 1092.6499999999999 -5.649999999999864 p_2 p_22
17-Feb-2016 1081.75 1088.3333333333333 -6.5833333333332575 p_2 p_22
18-Feb-2016 1100.00 1089.5833333333333 10.416666666666742 p_4 p_24
19-Feb-2016 1119.20 1100.3166666666666 18.88333333333344 p_4 p_44
22-Feb-2016 1131.00 1116.7333333333333 14.266666666666652 p_4 p_44
23-Feb-2016 1130.25 1126.8166666666666 3.433333333333394 p_3 p_43
24-Feb-2016 1119.50 1126.9166666666667 -7.4166666666667425 p_2 p_32
25-Feb-2016 1125.40 1125.05 0.3500000000001364 p_3 p_23
26-Feb-2016 1120.15 1121.6833333333334 -1.533333333333303 p_2 p_32
29-Feb-2016 1129.50 1125.0166666666667 4.4833333333333485 p_3 p_23
01-Mar-2016 1094.80 1114.8166666666668 -20.01666666666688 p_1 p_31
02-Mar-2016 1137.05 1120.45 16.59999999999991 p_4 p_14
03-Mar-2016 1168.00 1133.2833333333335 34.71666666666647 p_4 p_44
04-Mar-2016 1175.60 1160.2166666666665 15.38333333333344 p_4 p_44
08-Mar-2016 1163.00 1168.8666666666666 -5.866666666666561 p_2 p_42
09-Mar-2016 1145.00 1161.2 -16.200000000000045 p_1 p_21
10-Mar-2016 1162.90 1156.9666666666667 5.933333333333394 p_3 p_13
11-Mar-2016 1146.20 1151.3666666666668 -5.1666666666667425 p_2 p_32
14-Mar-2016 1146.00 1151.7 -5.7000000000000455 p_2 p_22
15-Mar-2016 1144.00 1145.3999999999999 -1.3999999999998636 p_2 p_22
16-Mar-2016 1141.90 1143.9666666666667 -2.066666666666606 p_2 p_22
17-Mar-2016 1156.90 1147.6000000000001 9.299999999999955 p_3 p_23
18-Mar-2016 1162.80 1153.8666666666666 8.933333333333394 p_3 p_33
21-Mar-2016 1188.00 1169.2333333333333 18.76666666666665 p_4 p_34
22-Mar-2016 1191.25 1180.6833333333334 10.566666666666606 p_4 p_44
23-Mar-2016 1190.00 1189.75 0.25 p_3 p_43
28-Mar-2016 1232.40 1204.55 27.850000000000136 p_4 p_34

- 13 -
29-Mar-2016 1199.00 1207.1333333333334 -8.13333333333344 p_2 p_42
30-Mar-2016 1197.60 1209.6666666666667 -12.066666666666833 p_1 p_21
31-Mar-2016 1210.25 1202.2833333333333 7.966666666666697 p_3 p_13
01-Apr-2016 1220.25 1209.3666666666666 10.88333333333344 p_4 p_34
01-Apr-2016 1216.00 1215.5 0.5 p_3 p_43
04-Apr-2016 1213.55 1216.6000000000001 -3.050000000000182 p_2 p_32
05-Apr-2016 1242.00 1223.8500000000001 18.149999999999864 p_4 p_24
06-Apr-2016 1228.00 1227.8500000000001 0.14999999999986358 p_3 p_43
07-Apr-2016 1208.40 1226.1333333333334 -17.73333333333335 p_1 p_31
08-Apr-2016 1175.85 1204.0833333333333 -28.23333333333335 p_1 p_11
11-Apr-2016 1165.80 1183.35 -17.549999999999955 p_1 p_11
12-Apr-2016 1180.50 1174.05 6.4500000000000455 p_3 p_13
13-Apr-2016 1194.95 1180.4166666666667 14.533333333333303 p_4 p_34
18-Apr-2016 1250.00 1208.4833333333333 41.51666666666665 p_4 p_44
20-Apr-2016 1244.00 1229.6499999999999 14.350000000000136 p_4 p_44
21-Apr-2016 1251.00 1248.3333333333333 2.6666666666667425 p_3 p_43
22-Apr-2016 1226.30 1240.4333333333334 -14.13333333333344 p_1 p_31
25-Apr-2016 1212.05 1229.7833333333333 -17.73333333333335 p_1 p_11
26-Apr-2016 1215.45 1217.9333333333334 -2.4833333333333485 p_2 p_12
27-Apr-2016 1229.20 1218.8999999999999 10.300000000000182 p_4 p_24
28-Apr-2016 1231.00 1225.2166666666665 5.78333333333353 p_3 p_43
29-Apr-2016 1211.45 1223.8833333333332 -12.433333333333167 p_1 p_31
02-May-2016 1210.00 1217.4833333333333 -7.4833333333333485 p_2 p_12
03-May-2016 1202.75 1208.0666666666666 -5.316666666666606 p_2 p_22
04-May-2016 1181.00 1197.9166666666667 -16.916666666666742 p_1 p_21
05-May-2016 1195.15 1192.9666666666667 2.183333333333394 p_3 p_13
06-May-2016 1189.80 1188.6499999999999 1.150000000000091 p_3 p_33
09-May-2016 1182.00 1188.9833333333333 -6.9833333333333485 p_2 p_32
10-May-2016 1202.50 1191.4333333333334 11.066666666666606 p_4 p_24
11-May-2016 1198.50 1194.3333333333333 4.1666666666667425 p_3 p_43
12-May-2016 1203.90 1201.6333333333334 2.2666666666666515 p_3 p_33
13-May-2016 1206.00 1202.8 3.2000000000000455 p_3 p_33
16-May-2016 1210.20 1206.7 3.5 p_3 p_33
17-May-2016 1220.00 1212.0666666666666 7.933333333333394 p_3 p_33
18-May-2016 1199.00 1209.7333333333333 -10.733333333333348 p_1 p_31
19-May-2016 1210.95 1209.9833333333333 0.966666666666697 p_3 p_13
20-May-2016 1205.00 1204.9833333333333 0.01666666666665151 p_3 p_33
23-May-2016 1203.40 1206.45 -3.0499999999999545 p_2 p_32

- 14 -
24-May-2016 1191.05 1199.8166666666666 -8.766666666666652 p_2 p_22
25-May-2016 1194.10 1196.1833333333332 -2.0833333333332575 p_2 p_22
26-May-2016 1210.10 1198.4166666666667 11.683333333333167 p_4 p_24
27-May-2016 1231.60 1211.9333333333332 19.666666666666742 p_4 p_44
30-May-2016 1241.50 1227.7333333333333 13.766666666666652 p_4 p_44
31-May-2016 1265.00 1246.0333333333333 18.966666666666697 p_4 p_44
01-Jun-2016 1246.05 1250.8500000000001 -4.800000000000182 p_2 p_42
02-Jun-2016 1255.00 1255.3500000000001 -0.3500000000001364 p_2 p_22
03-Jun-2016 1260.05 1253.7 6.349999999999909 p_3 p_23
06-Jun-2016 1264.90 1259.9833333333333 4.9166666666667425 p_3 p_33
07-Jun-2016 1267.00 1263.9833333333333 3.0166666666666515 p_3 p_33
08-Jun-2016 1263.95 1265.2833333333333 -1.3333333333332575 p_2 p_32
09-Jun-2016 1226.25 1252.3999999999999 -26.149999999999864 p_1 p_21
10-Jun-2016 1175.40 1221.8666666666668 -46.4666666666667 p_1 p_11
13-Jun-2016 1176.80 1192.8166666666666 -16.01666666666665 p_1 p_11
14-Jun-2016 1182.40 1178.2 4.2000000000000455 p_3 p_13
15-Jun-2016 1183.70 1180.966666666667 2.733333333333121 p_3 p_33
16-Jun-2016 1189.50 1185.2 4.2999999999999545 p_3 p_33
17-Jun-2016 1189.00 1187.3999999999999 1.6000000000001364 p_3 p_33
20-Jun-2016 1181.00 1186.5 -5.5 p_2 p_32
21-Jun-2016 1211.20 1193.7333333333333 17.466666666666697 p_4 p_24
22-Jun-2016 1204.00 1198.7333333333333 5.2666666666666515 p_3 p_43
23-Jun-2016 1197.30 1204.1666666666667 -6.866666666666788 p_2 p_32
24-Jun-2016 1188.00 1196.4333333333334 -8.433333333333394 p_2 p_22
27-Jun-2016 1172.05 1185.7833333333335 -13.733333333333576 p_1 p_21
28-Jun-2016 1162.80 1174.2833333333333 -11.483333333333348 p_1 p_11
29-Jun-2016 1169.00 1167.95 1.0499999999999545 p_3 p_13
30-Jun-2016 1180.50 1170.7666666666667 9.733333333333348 p_3 p_33
01-Jul-2016 1180.00 1176.5 3.5 p_3 p_33
04-Jul-2016 1176.20 1178.8999999999999 -2.699999999999818 p_2 p_32
05-Jul-2016 1185.00 1180.3999999999999 4.600000000000136 p_3 p_23
07-Jul-2016 1168.70 1176.6333333333332 -7.933333333333167 p_2 p_32
08-Jul-2016 1163.00 1172.2333333333333 -9.233333333333348 p_2 p_22
11-Jul-2016 1167.40 1166.3666666666668 1.033333333333303 p_3 p_23
12-Jul-2016 1180.00 1170.1333333333334 9.86666666666656 p_3 p_33
13-Jul-2016 1180.00 1175.8 4.2000000000000455 p_3 p_33
14-Jul-2016 1195.00 1185.0 10.0 p_4 p_34
15-Jul-2016 1189.50 1188.1666666666667 1.3333333333332575 p_3 p_43

- 15 -
18-Jul-2016 1077.25 1153.9166666666667 -76.66666666666674 p_1 p_31
19-Jul-2016 1088.60 1118.45 -29.850000000000136 p_1 p_11
20-Jul-2016 1070.00 1078.6166666666666 -8.61666666666656 p_2 p_12
21-Jul-2016 1079.00 1079.2 -0.20000000000004547 p_2 p_22
22-Jul-2016 1070.00 1073.0 -3.0 p_2 p_22
25-Jul-2016 1063.00 1070.6666666666667 -7.6666666666667425 p_2 p_22
26-Jul-2016 1070.35 1067.7833333333333 2.566666666666606 p_3 p_23
27-Jul-2016 1084.70 1072.6833333333334 12.016666666666652 p_4 p_34
28-Jul-2016 1085.40 1080.15 5.25 p_3 p_43
29-Jul-2016 1072.60 1080.8999999999999 -8.299999999999955 p_2 p_32
01-Aug-2016 1071.50 1076.5 -5.0 p_2 p_22
02-Aug-2016 1079.90 1074.6666666666667 5.2333333333333485 p_3 p_23
03-Aug-2016 1085.65 1079.0166666666667 6.633333333333439 p_3 p_33
04-Aug-2016 1086.40 1083.9833333333333 2.4166666666667425 p_3 p_33
05-Aug-2016 1072.00 1081.3500000000001 -9.350000000000136 p_2 p_32
08-Aug-2016 1069.00 1075.8 -6.7999999999999545 p_2 p_22
09-Aug-2016 1077.00 1072.6666666666667 4.3333333333332575 p_3 p_23
10-Aug-2016 1076.00 1074.0 2.0 p_3 p_33
11-Aug-2016 1081.70 1078.2333333333333 3.466666666666697 p_3 p_33
12-Aug-2016 1075.05 1077.5833333333333 -2.533333333333303 p_2 p_32
16-Aug-2016 1042.00 1066.25 -24.25 p_1 p_21
17-Aug-2016 1049.95 1055.6666666666667 -5.716666666666697 p_2 p_12
18-Aug-2016 1036.50 1042.8166666666666 -6.316666666666606 p_2 p_22
19-Aug-2016 1030.00 1038.8166666666666 -8.816666666666606 p_2 p_22
22-Aug-2016 1018.00 1028.1666666666667 -10.166666666666742 p_1 p_21
23-Aug-2016 1020.10 1022.6999999999999 -2.599999999999909 p_2 p_12
24-Aug-2016 1047.00 1028.3666666666666 18.63333333333344 p_4 p_24
25-Aug-2016 1055.00 1040.7 14.299999999999955 p_4 p_44
26-Aug-2016 1036.00 1046.0 -10.0 p_2 p_42
29-Aug-2016 1017.60 1036.2 -18.600000000000023 p_1 p_21
30-Aug-2016 1032.45 1028.6833333333334 3.7666666666666515 p_3 p_13
31-Aug-2016 1037.10 1029.05 8.049999999999955 p_3 p_33
01-Sep-2016 1038.00 1035.8500000000001 2.1499999999998636 p_3 p_33
02-Sep-2016 1039.05 1038.05 1.0 p_3 p_33
06-Sep-2016 1038.25 1038.4333333333334 -0.18333333333339397 p_2 p_32
07-Sep-2016 1048.00 1041.7666666666667 6.2333333333333485 p_3 p_23
08-Sep-2016 1045.00 1043.75 1.25 p_3 p_33
09-Sep-2016 1037.00 1043.3333333333333 -6.3333333333332575 p_2 p_32

- 16 -
12-Sep-2016 1025.25 1035.75 -10.5 p_1 p_21
14-Sep-2016 1053.95 1038.7333333333333 15.216666666666697 p_4 p_14
15-Sep-2016 1045.60 1041.6000000000001 3.9999999999997726 p_3 p_43
16-Sep-2016 1049.00 1049.5166666666667 -0.5166666666666515 p_2 p_32
19-Sep-2016 1046.00 1046.8666666666666 -0.8666666666665606 p_2 p_22
20-Sep-2016 1053.30 1049.4333333333334 3.8666666666665606 p_3 p_23
21-Sep-2016 1054.00 1051.1000000000001 2.8999999999998636 p_3 p_33
22-Sep-2016 1059.00 1055.4333333333334 3.566666666666606 p_3 p_33
23-Sep-2016 1057.00 1056.6666666666667 0.33333333333325754 p_3 p_33
26-Sep-2016 1042.75 1052.9166666666667 -10.166666666666742 p_1 p_31
27-Sep-2016 1035.05 1044.9333333333334 -9.88333333333344 p_2 p_12
28-Sep-2016 1040.00 1039.2666666666667 0.7333333333333485 p_3 p_23
29-Sep-2016 1044.95 1040.0 4.9500000000000455 p_3 p_33
30-Sep-2016 1031.10 1038.6833333333334 -7.583333333333485 p_2 p_32
03-Oct-2016 1035.50 1037.1833333333334 -1.683333333333394 p_2 p_22
04-Oct-2016 1040.00 1035.5333333333333 4.466666666666697 p_3 p_23
05-Oct-2016 1049.20 1041.5666666666666 7.633333333333439 p_3 p_33
06-Oct-2016 1045.00 1044.7333333333333 0.2666666666666515 p_3 p_33
07-Oct-2016 1029.95 1041.3833333333332 -11.433333333333167 p_1 p_31
10-Oct-2016 1017.00 1030.6499999999999 -13.649999999999864 p_1 p_11
13-Oct-2016 1021.40 1022.7833333333334 -1.3833333333334394 p_2 p_12
14-Oct-2016 1052.90 1030.4333333333334 22.466666666666697 p_4 p_24
17-Oct-2016 1034.95 1036.4166666666667 -1.466666666666697 p_2 p_42
18-Oct-2016 1030.00 1039.2833333333333 -9.283333333333303 p_2 p_22
19-Oct-2016 1042.00 1035.6499999999999 6.350000000000136 p_3 p_23
20-Oct-2016 1044.75 1038.9166666666667 5.8333333333332575 p_3 p_33
21-Oct-2016 1035.00 1040.5833333333333 -5.5833333333332575 p_2 p_32
24-Oct-2016 1037.50 1039.0833333333333 -1.5833333333332575 p_2 p_22
25-Oct-2016 1036.50 1036.3333333333333 0.16666666666674246 p_3 p_23
26-Oct-2016 1017.00 1030.3333333333333 -13.333333333333258 p_1 p_31
27-Oct-2016 1017.90 1023.8000000000001 -5.900000000000091 p_2 p_12
28-Oct-2016 1005.20 1013.3666666666667 -8.166666666666629 p_2 p_22
30-Oct-2016 1001.00 1008.0333333333333 -7.033333333333303 p_2 p_22
01-Nov-2016 1006.80 1004.3333333333334 2.4666666666665833 p_3 p_23
02-Nov-2016 984.80 997.5333333333333 -12.733333333333348 p_1 p_31
03-Nov-2016 981.05 990.8833333333332 -9.833333333333258 p_2 p_12
04-Nov-2016 967.00 977.6166666666667 -10.616666666666674 p_1 p_21
07-Nov-2016 985.00 977.6833333333334 7.316666666666606 p_3 p_13

- 17 -
08-Nov-2016 986.90 979.6333333333333 7.2666666666666515 p_3 p_33
09-Nov-2016 930.00 967.3000000000001 -37.30000000000007 p_1 p_31
10-Nov-2016 962.50 959.8000000000001 2.699999999999932 p_3 p_13
11-Nov-2016 940.00 944.1666666666666 -4.166666666666629 p_2 p_32
15-Nov-2016 924.00 942.1666666666666 -18.16666666666663 p_1 p_21
16-Nov-2016 930.00 931.3333333333334 -1.3333333333333712 p_2 p_12
17-Nov-2016 934.25 929.4166666666666 4.833333333333371 p_3 p_23
18-Nov-2016 930.00 931.4166666666666 -1.4166666666666288 p_2 p_32
21-Nov-2016 926.90 930.3833333333333 -3.4833333333333485 p_2 p_22
22-Nov-2016 916.90 924.6 -7.7000000000000455 p_2 p_22
23-Nov-2016 922.10 921.9666666666667 0.13333333333332575 p_3 p_23
24-Nov-2016 928.20 922.4000000000001 5.7999999999999545 p_3 p_33
25-Nov-2016 930.45 926.9166666666666 3.5333333333334167 p_3 p_33
28-Nov-2016 979.30 945.9833333333332 33.31667 p_4 p_34
29-Nov-2016 978.80 962.85 15.95 p_4 p_44
30-Nov-2016 973.00 977.0333333333333 -4.03333 p_2 p_42
01-Dec-2016 976.00 975.9333333333334 0.06666666666660603 p_3 p_23
02-Dec-2016 964.80 971.2666666666668 -6.466666666666811 p_2 p_32
05-Dec-2016 965.90 968.9 -3.0 p_2 p_22
06-Dec-2016 961.80 964.1666666666666 -2.3666666666666742 p_2 p_22
07-Dec-2016 968.00 965.2333333333332 2.766666666666765 p_3 p_23
08-Dec-2016 970.05 966.6166666666667 3.4333333333332803 p_3 p_33
09-Dec-2016 985.00 974.35 10.649999999999977 p_4 p_34
12-Dec-2016 982.80 979.2833333333333 3.5166666666666515 p_3 p_43
13-Dec-2016 980.50 982.7666666666668 -2.266666666666765 p_2 p_32
14-Dec-2016 991.00 984.7666666666668 6.233333333333235 p_3 p_23
15-Dec-2016 997.40 989.6333333333333 7.7666666666666515 p_3 p_33
16-Dec-2016 1003.80 997.4 6.399999999999977 p_3 p_33
19-Dec-2016 1006.10 1002.4333333333334 3.6666666666666288 p_3 p_33
20-Dec-2016 1002.00 1003.9666666666666 -1.9666666666665833 p_2 p_32
21-Dec-2016 1016.00 1008.0333333333333 7.966666666666697 p_3 p_23
22-Dec-2016 1002.50 1006.8333333333334 -4.333333333333371 p_2 p_32
23-Dec-2016 984.90 1001.1333333333333 -16.23333333333335 p_1 p_21
26-Dec-2016 988.00 991.8000000000001 -3.800000000000068 p_2 p_12
27-Dec-2016 982.75 985.2166666666667 -2.466666666666697 p_2 p_22
28-Dec-2016 1002.95 991.2333333333332 11.71666666666681 P_4 P_24
29-Dec-2016 1003.75 996.4833333333332 7.266666666666765 P_3 P_43
30-Dec-2016 998.00 1001.5666666666666 -3.566666666666606 p_2 p_2

- 18 -
Table 4.2:Calculations for Closing prices

Date Closing Moving Average Difference of P State Transition


prices of Closing Prices (Actual- Count State
Prices(Interval Mov. Avg)
=3)

01-Jan-2016 1105.40 #NA #NA #NA #NA


04-Jan-2016 1105.25 #NA #NA #NA #NA
05-Jan-2016 1078.90 1096.5166666666667 -17.61666666666656 p_1 p_1
06-Jan-2016 1074.05 1086.0666666666666 -12.016666666666652 p_1 p_11
07-Jan-2016 1069.35 1074.1 -4.75 p_2 p_12
08-Jan-2016 1050.80 1064.7333333333333 -13.933333333333394 p_1 p_21
11-Jan-2016 1063.30 1061.1499999999999 2.150000000000091 p_3 p_13
12-Jan-2016 1055.70 1056.6000000000001 -0.900000000000091 p_2 p_32
13-Jan-2016 1049.95 1056.3166666666666 -6.366666666666561 p_2 p_22
14-Jan-2016 1083.40 1063.0166666666667 20.38333333333344 p_4 p_24
15-Jan-2016 1133.00 1088.7833333333335 44.21666666666647 p_4 p_44
18-Jan-2016 1139.90 1118.7666666666667 21.13333333333344 p_4 p_44
19-Jan-2016 1131.90 1134.9333333333334 -3.033333333333303 p_2 p_42
20-Jan-2016 1139.65 1137.15 2.5 p_3 p_23
21-Jan-2016 1121.25 1130.9333333333334 -9.683333333333394 p_2 p_32
22-Jan-2016 1137.05 1132.65 4.399999999999864 p_3 p_23
25-Jan-2016 1136.25 1131.5166666666667 4.7333333333333485 p_3 p_33
27-Jan-2016 1137.65 1136.9833333333333 0.6666666666667425 p_3 p_33
28-Jan-2016 1138.50 1137.4666666666667 1.033333333333303 p_3 p_33
29-Jan-2016 1129.60 1135.25 -5.650000000000091 p_2 p_32
01-Feb-2016 1164.90 1144.3333333333333 20.566666666666833 p_4 p_24
02-Feb-2016 1173.35 1155.95 17.399999999999864 p_4 p_44
03-Feb-2016 1175.55 1171.2666666666667 4.283333333333303 p_3 p_43
04-Feb-2016 1157.70 1168.8666666666666 -11.166666666666515 p_2 p_32
05-Feb-2016 1179.75 1171.0 8.75 p_3 p_23
08-Feb-2016 1174.70 1170.7166666666665 3.983333333333576 p_3 p_33
09-Feb-2016 1150.80 1168.4166666666667 -17.616666666666788 p_1 p_31
10-Feb-2016 1107.65 1144.3833333333332 -36.73333333333312 p_1 p_11

- 19 -
11-Feb-2016 1108.55 1122.3333333333333 -13.783333333333303 p_1 p_11
12-Feb-2016 1078.65 1098.2833333333333 -19.633333333333212 p_1 p_11
15-Feb-2016 1084.65 1090.6166666666668 -5.966666666666697 p_2 p_12
16-Feb-2016 1091.75 1085.0166666666667 6.7333333333333485 p_3 p_23
17-Feb-2016 1079.15 1085.1833333333334 -6.033333333333303 p_2 p_32
18-Feb-2016 1097.85 1089.5833333333333 8.266666666666652 p_3 p_23
19-Feb-2016 1123.40 1100.1333333333334 23.26666666666665 p_4 p_34
22-Feb-2016 1127.25 1116.1666666666667 11.083333333333258 p_3 p_43
23-Feb-2016 1126.65 1125.7666666666667 0.8833333333334394 p_3 p_33
24-Feb-2016 1123.90 1125.9333333333334 -2.033333333333303 p_2 p_32
25-Feb-2016 1125.35 1125.3 0.049999999999954525 p_3 p_23
26-Feb-2016 1110.30 1119.85 -9.549999999999955 p_2 p_32
29-Feb-2016 1121.15 1118.9333333333332 2.2166666666669244 p_3 p_23
01-Mar-2016 1084.05 1105.1666666666667 -21.116666666666788 p_1 p_31
02-Mar-2016 1125.45 1110.2166666666667 15.233333333333348 p_4 p_14
03-Mar-2016 1156.00 1121.8333333333333 34.16666666666674 p_4 p_44
04-Mar-2016 1169.30 1150.25 19.049999999999955 p_4 p_44
08-Mar-2016 1170.65 1165.3166666666666 5.333333333333485 p_3 p_43
09-Mar-2016 1163.45 1167.8000000000002 -4.350000000000136 p_2 p_32
10-Mar-2016 1178.50 1170.8666666666666 7.633333333333439 p_3 p_23
11-Mar-2016 1142.50 1161.4833333333333 -18.98333333333335 p_1 p_31
14-Mar-2016 1143.00 1154.6666666666667 -11.666666666666742 p_2 p_12
15-Mar-2016 1141.20 1142.2333333333333 -1.033333333333303 p_2 p_22
16-Mar-2016 1134.40 1139.5333333333335 -5.133333333333439 p_2 p_22
17-Mar-2016 1152.45 1142.6833333333334 9.766666666666652 p_3 p_23
18-Mar-2016 1161.75 1149.5333333333333 12.216666666666697 p_4 p_34
21-Mar-2016 1193.40 1169.2 24.200000000000045 p_4 p_44
22-Mar-2016 1194.90 1183.3500000000001 11.549999999999955 p_4 p_44
23-Mar-2016 1189.95 1192.7500000000002 -2.800000000000182 p_2 p_42
28-Mar-2016 1207.80 1197.55 10.25 p_3 p_23
29-Mar-2016 1204.90 1200.8833333333332 4.016666666666879 p_3 p_33
30-Mar-2016 1197.25 1203.3166666666666 -6.066666666666606 p_2 p_32
31-Mar-2016 1205.95 1202.7 3.25 p_3 p_23
01-Apr-2016 2136.10 1513.1000000000001 622.9999999999998 p_4 p_34
01-Apr-2016 1218.30 1520.1166666666666 -301.8166666666666 p_1 p_41
04-Apr-2016 1205.45 1519.95 -314.5 p_1 p_11
05-Apr-2016 1243.70 1222.4833333333333 21.216666666666697 p_4 p_14
06-Apr-2016 1219.80 1222.9833333333333 -3.183333333333394 p_2 p_42

- 20 -
07-Apr-2016 1200.70 1221.3999999999999 -20.699999999999818 p_1 p_21
08-Apr-2016 1181.50 1200.6666666666667 -19.166666666666742 p_1 p_11
11-Apr-2016 1165.75 1182.6499999999999 -16.899999999999864 p_1 p_11
12-Apr-2016 1183.90 1177.05 6.850000000000136 p_3 p_13
13-Apr-2016 1182.20 1177.2833333333335 4.916666666666515 p_3 p_33
18-Apr-2016 1172.70 1179.6000000000001 -6.900000000000091 p_2 p_32
20-Apr-2016 1238.70 1197.8666666666668 40.83333333333326 p_4 p_24
21-Apr-2016 1243.60 1218.3333333333333 25.26666666666665 p_4 p_44
22-Apr-2016 1226.30 1236.1999999999998 -9.899999999999864 p_2 p_42
25-Apr-2016 1211.25 1227.05 -15.799999999999955 p_1 p_21
26-Apr-2016 1215.85 1217.8 -1.9500000000000455 p_2 p_12
27-Apr-2016 1232.15 1219.75 12.400000000000091 p_4 p_24
28-Apr-2016 1240.15 1229.3833333333334 10.766666666666652 p_3 p_43
29-Apr-2016 1209.15 1227.15 -18.0 p_1 p_31
02-May-2016 1208.10 1219.1333333333334 -11.03333333333353 p_2 p_12
03-May-2016 1201.05 1206.1 -5.0499999999999545 p_2 p_22
04-May-2016 1177.80 1195.6499999999999 -17.84999999999991 p_1 p_21
05-May-2016 1188.85 1189.2333333333333 -0.38333333333343944 p_3 p_13
06-May-2016 1192.45 1186.3666666666668 6.0833333333332575 p_3 p_33
09-May-2016 1181.50 1187.6 -6.099999999999909 p_2 p_32
10-May-2016 1199.05 1191.0 8.049999999999955 p_3 p_23
11-May-2016 1212.80 1197.7833333333333 15.016666666666652 p_4 p_34
12-May-2016 1201.85 1204.5666666666666 -2.716666666666697 p_2 p_42
13-May-2016 1210.00 1208.2166666666665 1.7833333333335304 p_3 p_23
16-May-2016 1207.25 1206.3666666666666 0.8833333333334394 p_3 p_33
17-May-2016 1215.00 1210.75 4.25 p_3 p_33
18-May-2016 1214.25 1212.1666666666667 2.0833333333332575 p_3 p_33
19-May-2016 1209.85 1213.0333333333333 -3.183333333333394 p_2 p_32
20-May-2016 1205.75 1209.95 -4.2000000000000455 p_2 p_22
23-May-2016 1201.60 1205.7333333333333 -4.133333333333439 p_2 p_22
24-May-2016 1188.00 1198.45 -10.450000000000045 p_2 p_22
25-May-2016 1187.75 1192.45 -4.7000000000000455 p_2 p_22
26-May-2016 1208.65 1194.8 13.850000000000136 p_4 p_24
27-May-2016 1234.15 1210.1833333333334 23.966666666666697 p_4 p_44
30-May-2016 1247.50 1230.1000000000001 17.399999999999864 p_4 p_44
31-May-2016 1267.60 1249.75 17.84999999999991 p_4 p_44
01-Jun-2016 1248.65 1254.5833333333333 -5.933333333333167 p_2 p_42
02-Jun-2016 1258.20 1258.15 0.049999999999954525 p_3 p_23

- 21 -
03-Jun-2016 1261.55 1256.1333333333334 5.416666666666515 p_3 p_33
06-Jun-2016 1266.90 1262.2166666666665 4.683333333333621 p_3 p_33
07-Jun-2016 1266.75 1265.0666666666666 1.683333333333394 p_3 p_33
08-Jun-2016 1257.40 1263.6833333333334 -6.283333333333303 p_2 p_32
09-Jun-2016 1238.10 1254.0833333333333 -15.983333333333348 p_1 p_21
10-Jun-2016 1185.50 1227.0 -41.5 p_1 p_11
13-Jun-2016 1180.60 1201.3999999999999 -20.799999999999955 p_1 p_11
14-Jun-2016 1180.90 1182.3333333333333 -1.4333333333331666 p_2 p_12
15-Jun-2016 1175.00 1178.8333333333333 -3.8333333333332575 p_2 p_22
16-Jun-2016 1189.95 1181.95 8.0 p_3 p_23
17-Jun-2016 1186.00 1183.6499999999999 2.3500000000001364 p_3 p_33
20-Jun-2016 1179.50 1185.1499999999999 -5.649999999999864 p_2 p_32
21-Jun-2016 1208.75 1191.4166666666667 17.333333333333258 p_4 p_24
22-Jun-2016 1206.10 1198.1166666666666 7.9833333333333485 p_3 p_43
23-Jun-2016 1199.50 1204.7833333333333 -5.283333333333303 p_2 p_32
24-Jun-2016 1211.60 1205.7333333333333 5.866666666666561 p_3 p_23
27-Jun-2016 1194.55 1201.8833333333332 -7.3333333333332575 p_2 p_32
28-Jun-2016 1166.20 1190.7833333333333 -24.583333333333258 p_1 p_21
29-Jun-2016 1159.15 1173.3000000000002 -14.150000000000091 p_1 p_11
30-Jun-2016 1176.85 1167.3999999999999 9.450000000000045 p_3 p_13
01-Jul-2016 1170.80 1168.9333333333332 1.866666666666788 p_3 p_33
04-Jul-2016 1172.40 1173.35 -0.9499999999998181 p_2 p_32
05-Jul-2016 1183.95 1175.716666666667 8.233333333333121 p_3 p_23
07-Jul-2016 1175.45 1177.2666666666667 -1.816666666666606 p_2 p_32
08-Jul-2016 1157.25 1172.2166666666665 -14.96666666666647 p_1 p_21
11-Jul-2016 1158.20 1163.6333333333332 -5.433333333333167 p_2 p_12
12-Jul-2016 1175.05 1163.5 11.549999999999955 p_4 p_24
13-Jul-2016 1176.55 1169.9333333333334 6.616666666666561 p_3 p_43
14-Jul-2016 1193.80 1181.8 12.0 p_4 p_34
15-Jul-2016 1176.25 1182.2 -5.9500000000000455 p_2 p_42
18-Jul-2016 1072.55 1147.5333333333335 -74.98333333333358 p_1 p_21
19-Jul-2016 1081.95 1110.25 -28.299999999999955 p_1 p_11
20-Jul-2016 1086.95 1080.4833333333333 6.466666666666697 p_3 p_13
21-Jul-2016 1083.10 1084.0 -0.900000000000091 p_2 p_32
22-Jul-2016 1079.90 1083.3166666666666 -3.416666666666515 p_2 p_22
25-Jul-2016 1072.45 1078.4833333333333 -6.033333333333303 p_2 p_22
26-Jul-2016 1080.85 1077.7333333333333 3.1166666666665606 p_3 p_23
27-Jul-2016 1088.70 1080.6666666666667 8.033333333333303 p_3 p_33

- 22 -
28-Jul-2016 1085.35 1084.9666666666667 0.38333333333321207 p_3 p_33
29-Jul-2016 1077.50 1083.8500000000001 -6.350000000000136 p_2 p_32
01-Aug-2016 1073.85 1078.8999999999999 -5.0499999999999545 p_2 p_22
02-Aug-2016 1085.25 1078.8666666666666 6.383333333333439 p_3 p_23
03-Aug-2016 1083.80 1080.9666666666667 2.8333333333332575 p_3 p_33
04-Aug-2016 1084.90 1084.6499999999999 0.2500000000002274 p_3 p_33
05-Aug-2016 1071.80 1080.1666666666667 -8.366666666666788 p_2 p_32
08-Aug-2016 1068.00 1074.9 -6.900000000000091 p_2 p_22
09-Aug-2016 1078.70 1072.8333333333333 5.866666666666788 p_3 p_23
10-Aug-2016 1083.40 1076.7 6.7000000000000455 p_3 p_33
11-Aug-2016 1082.35 1081.4833333333333 0.8666666666665606 p_3 p_33
12-Aug-2016 1077.35 1081.0333333333333 -3.683333333333394 p_2 p_32
16-Aug-2016 1062.55 1074.0833333333333 -11.533333333333303 p_2 p_22
17-Aug-2016 1051.80 1063.8999999999999 -12.099999999999909 p_1 p_21
18-Aug-2016 1033.30 1049.2166666666665 -15.916666666666515 p_1 p_11
19-Aug-2016 1023.40 1036.1666666666667 -12.766666666666765 p_1 p_11
22-Aug-2016 1021.30 1026.0 -4.7000000000000455 p_2 p_12
23-Aug-2016 1015.45 1020.0500000000001 -4.600000000000023 p_2 p_22
24-Aug-2016 1039.65 1025.466666666667 14.183333333333167 p_4 p_24
25-Aug-2016 1057.40 1037.5 19.90000000000009 p_4 p_44
26-Aug-2016 1036.15 1044.4 -8.25 p_2 p_42
29-Aug-2016 1020.25 1037.9333333333334 -17.683333333333394 p_1 p_21
30-Aug-2016 1022.80 1026.3999999999999 -3.599999999999909 p_2 p_12
31-Aug-2016 1040.40 1027.8166666666666 12.583333333333485 p_4 p_24
01-Sep-2016 1035.85 1033.0166666666667 2.8333333333332575 p_3 p_43
02-Sep-2016 1037.55 1037.9333333333332 -0.38333333333321207 p_3 p_33
06-Sep-2016 1031.85 1035.0833333333333 -3.2333333333333485 p_2 p_32
07-Sep-2016 1045.00 1038.1333333333332 6.866666666666788 p_3 p_23
08-Sep-2016 1054.35 1043.7333333333333 10.61666666666656 p_3 p_33
09-Sep-2016 1037.65 1045.6666666666667 -8.016666666666652 p_2 p_32
12-Sep-2016 1035.50 1042.5 -7.0 p_2 p_22
14-Sep-2016 1054.00 1042.3833333333334 11.61666666666656 p_4 p_24
15-Sep-2016 1045.60 1045.0333333333333 0.566666666666606 p_3 p_43
16-Sep-2016 1042.20 1047.2666666666667 -5.066666666666606 p_2 p_32
19-Sep-2016 1060.15 1049.3166666666668 10.833333333333258 p_3 p_23
20-Sep-2016 1061.20 1054.5166666666667 6.683333333333394 p_3 p_33
21-Sep-2016 1050.15 1057.1666666666667 -7.0166666666666515 p_2 p_32
22-Sep-2016 1055.75 1055.7 0.049999999999954525 p_3 p_23

- 23 -
23-Sep-2016 1058.80 1054.9 3.8999999999998636 p_3 p_33
26-Sep-2016 1042.55 1052.3666666666666 -9.816666666666606 p_2 p_32
27-Sep-2016 1035.90 1045.75 -9.849999999999909 p_2 p_22
28-Sep-2016 1039.75 1039.3999999999999 0.3500000000001364 p_3 p_23
29-Sep-2016 1038.95 1038.2 0.75 p_3 p_33
30-Sep-2016 1029.20 1035.9666666666667 -6.7666666666666515 p_2 p_32
03-Oct-2016 1036.05 1034.7333333333333 1.316666666666606 p_3 p_23
04-Oct-2016 1038.10 1034.4499999999998 3.650000000000091 p_3 p_33
05-Oct-2016 1049.20 1041.1166666666668 8.083333333333258 p_3 p_33
06-Oct-2016 1041.50 1042.9333333333332 -1.4333333333331666 p_2 p_32
07-Oct-2016 1027.40 1039.3666666666668 -11.966666666666697 p_2 p_22
10-Oct-2016 1012.55 1027.1499999999999 -14.599999999999909 p_1 p_21
13-Oct-2016 1029.95 1023.3000000000001 6.649999999999977 p_3 p_13
14-Oct-2016 1052.35 1031.6166666666668 20.73333333333312 p_4 p_34
17-Oct-2016 1027.15 1036.4833333333333 -9.333333333333258 p_2 p_42
18-Oct-2016 1022.40 1033.9666666666667 -11.56666666666672 p_2 p_22
19-Oct-2016 1039.05 1029.5333333333333 9.516666666666652 p_3 p_23
20-Oct-2016 1041.80 1034.4166666666667 7.383333333333212 p_3 p_33
21-Oct-2016 1036.65 1039.1666666666667 -2.5166666666666515 p_2 p_32
24-Oct-2016 1038.30 1038.9166666666667 -0.6166666666667879 p_2 p_22
25-Oct-2016 1027.10 1034.0166666666667 -6.9166666666667425 p_2 p_22
26-Oct-2016 1017.20 1027.5333333333333 -10.333333333333258 p_2 p_22
27-Oct-2016 1014.20 1019.5 -5.2999999999999545 p_2 p_22
28-Oct-2016 1003.50 1011.6333333333333 -8.133333333333326 p_2 p_22
30-Oct-2016 997.50 1005.0666666666666 -7.566666666666606 p_2 p_22
01-Nov-2016 1002.10 1001.0333333333333 1.0666666666667197 p_3 p_23
02-Nov-2016 989.45 996.35 -6.899999999999977 p_2 p_32
03-Nov-2016 981.05 990.8666666666667 -9.81666666666672 p_2 p_22
04-Nov-2016 966.85 979.1166666666668 -12.266666666666765 p_1 p_21
07-Nov-2016 971.00 972.9666666666666 -1.9666666666665833 p_2 p_12
08-Nov-2016 977.95 971.9333333333334 6.0166666666666515 p_3 p_23
09-Nov-2016 982.60 977.1833333333334 5.416666666666629 p_3 p_33
10-Nov-2016 958.30 972.9500000000002 -14.650000000000205 p_1 p_31
11-Nov-2016 939.40 960.0999999999999 -20.699999999999932 p_1 p_11
15-Nov-2016 921.55 939.75 -18.200000000000045 p_1 p_11
16-Nov-2016 923.55 928.1666666666666 -4.616666666666674 p_2 p_12
17-Nov-2016 940.90 928.6666666666666 12.233333333333348 p_4 p_24
18-Nov-2016 929.80 931.4166666666666 -1.6166666666666742 p_2 p_42

- 24 -
21-Nov-2016 920.00 930.2333333333332 -10.233333333333235 p_2 p_22
22-Nov-2016 911.10 920.2999999999998 -9.199999999999818 p_2 p_22
23-Nov-2016 914.20 915.1 -0.8999999999999773 p_2 p_22
24-Nov-2016 920.25 915.1833333333334 5.066666666666606 p_3 p_23
25-Nov-2016 930.30 921.5833333333334 8.716666666666583 p_3 p_33
28-Nov-2016 977.50 942.6833333333334 34.816666666666606 p_4 p_34
29-Nov-2016 979.75 962.5166666666668 17.233333333333235 p_4 p_44
30-Nov-2016 972.60 976.6166666666667 -4.0166666666666515 p_2 p_42
01-Dec-2016 975.55 975.9666666666667 -0.41666666666674246 p_3 p_23
02-Dec-2016 975.60 974.5833333333334 1.0166666666666515 p_3 p_33
05-Dec-2016 964.50 971.8833333333332 -7.383333333333212 p_2 p_32
06-Dec-2016 961.65 967.25 -5.600000000000023 p_2 p_22
07-Dec-2016 966.50 964.2166666666667 2.283333333333303 p_3 p_23
08-Dec-2016 966.40 964.85 1.5499999999999545 p_3 p_33
09-Dec-2016 984.65 972.5166666666668 12.133333333333212 p_4 p_34
12-Dec-2016 989.35 980.1333333333333 9.216666666666697 p_3 p_43
13-Dec-2016 977.35 983.7833333333333 -6.43333333333328 p_2 p_32
14-Dec-2016 990.20 985.6333333333333 4.56666666666672 p_3 p_23
15-Dec-2016 999.75 989.1 10.649999999999977 p_3 p_33
16-Dec-2016 992.35 994.1 -1.75 p_2 p_32
19-Dec-2016 1005.15 999.0833333333334 6.066666666666606 p_3 p_23
20-Dec-2016 1004.65 1000.7166666666667 3.9333333333332803 p_3 p_33
21-Dec-2016 1012.15 1007.3166666666666 4.833333333333371 p_3 p_33
22-Dec-2016 1001.55 1006.1166666666667 -4.56666666666672 p_2 p_32
23-Dec-2016 984.70 999.4666666666667 -14.766666666666652 p_1 p_21
26-Dec-2016 988.45 991.5666666666666 -3.1166666666665606 p_2 p_12
27-Dec-2016 982.75 985.3000000000001 -2.550000000000068 p_2 p_22
28-Dec-2016 998.95 990.0500000000001 8.45 P_3 P_23
29-Dec-2016 998.50 993.4 5.1 P_3 P_33
30-Dec-2016 992.35 996.6 -17.61666666666656 p_1 p_1

- 25 -
Table 4.3: Intervals for i=3 Opening values

Lowest Value -76.66666666666674


Highest Value 57.66666666666674
Total Interval [-76.66666666666674,57.66666666666674]
Interval I1 [-76.66666666666674,-10]
Interval I2 [-10,0.016666666]
Interval I3 [0.0166666666,10]
Interval I4 [10, 57.66666666666674]

Table 4.4: Intervals for i=3 Closing values

Lowest Value -314.5


Highest Value 622.9999999999998
Total Interval [-314.5, 622.9999999999998]
Interval I1 [-314.5,-11.966666]
Interval I2 [-11.966666,-0.4166666]
Interval I3 [-0.4166666,11.5499999]
Interval I4 [11.5499999, 622.9999999999998]

Once the intervals were created, each of the data points were labeled with the name of the
interval to which they corresponded. After the intervals were labeled, the transition from each data
point to the next, specifically, the transition of the interval from one data point to the next was
calculated and the results was tabulated above.

- 26 -
Table 4.5:Interval i=3 Opening prices count

Number of points in P1 35
Number of points in P2 86
Number of points in P3 88
Number of points in P4 34
Counting of P_11 10
Counting of P_12 13
Counting of P_13 10
Counting of P_14 2
Counting of P_21 14
Counting of P_22 36
Counting of P_23 27
Counting of P_24 9
Counting of P_31 11
Counting of P_32 29
Counting of P_33 39
Counting of P_34 9
Counting of P_41 0
Counting of P_42 8
Counting of P_43 12
Counting of P_44 14

Transition Probability Matrix for opening prises

- 27 -
Table 4.7: Interval i=3 Closing prices count

Number of points in P1 35
Number of points in P2 88
Number of points in P3 86
Number of points in P4 34
Counting of P_11 15
Counting of P_12 12
Counting of P_13 6
Counting of P_14 2
Counting of P_21 13
Counting of P_22 31
Counting of P_23 33
Counting of P_24 11
Counting of P_31 6
Counting of P_32 35
Counting of P_33 37
Counting of P_34 8
Counting of P_41 1
Counting of P_42 11
Counting of P_43 9
Counting of P_44 13

Transition Probability Matrix for closing prises

- 28 -
After the difference prices and the transitions were labeled with the appropriate intervals, the
transition matrix was built and the ensuing linear system of equations was solved to find the steady
states.
The steady states provide for us the probability that the difference price will be in any of the the
four previously established intervals. According to our work, the probability that the difference prices
for the day after our data ends is 25% for each interval. For the opening prices for the moving average
interval of 3, the probability that the difference price will be in interval I1 (also known as P1) is
Π1=14.056%. The probability that the difference price will be in interval I2 (also known as P2) is
Π2=35.34, The probability that the difference price will be in interval I3 (also known as P3) is
Π3=34.538, while the probability that the difference price will be in Π4=13.654%.

Using these percentages the following table summarizes the probabilities of the next day’s stock
prices:
Table 4.7:Results for Opening prices

Summary of Opening prices Values


14.056% Chance that next day’s price will be in this interval [916.9,997.4]
34.5387% Chance that next day’s price will be in this interval [997.4,1088.6]
35.34% Chance that next day’s price will be in this interval [1088.6,1203.9]
13.65% Chance that next day’s price will be in this interval [1203.9 – 1267]

Table 4.8:Results for Closing prices


Summary of Closing prices Values
14.056% Chance that next day’s price will be in this interval [911.1 – 992.35]
35.34% Chance that next day’s price will be in this interval [992.35 – 1085.35]
34.538% Chance that next day’s price will be in this interval [1085.35 – 1205.45]
13.654% Chance that next day’s price will be in this interval [1205.45 – 2136.1]

- 29 -
4.3 Results and Observations:

4.3.1 Output for Infosys data:

Figure 4.1:Final output for Infosys data

In the above pie chart the red color indicates getting high loss percentage, and blue color
indicates getting moderate loss percentage, and yellow indicates getting moderate profit, green
indicates getting high profit.
For Infosys there is chance of getting moderate loss in next year so the investors has to decide
whether he has to invest on Infosys or not. And we suggest to not invest on Infosys because there may
be some other companies which may will be in completely profits.

- 30 -
4.3.2 Output for CapGemini data

Figure 4.2:Final output for CapGemini Data

in above pie chart green (high profits) color has more percentage than other means there is more
chance of getting profits in next year for CapGemini.

- 31 -
Chapter 5. Summary and Conclusions

Our work thus far has implemented the use of Markov chains to predicting stock prices. Using
the difference between forecast prices and actual prices, we have calculated the possible steady state, or
probability of the future of the difference price. While much of our work was streamlined with the use
of Microsoft Excel 2010, there are some anomalies to note. For example, the dividing of the difference
prices into four intervals was completed in a rather random manner. While both low and high outliers
were grouped within their own intervals, the actual barriers of the intervals were decided upon
randomly. This was done to ensure that the results would not be compromised due any personal
preference we may have had.
From this analysis we have got a profitable prediction for Moving average and comparing to it,
our algorithm performs better than all the other algorithm. So refer that the result of our algorithm will
provide a good response in the stock market prediction. The result comparison of all the methods used
in other algorithms with the Moving Average and it shows the profitability and the success of each
method. The result we have got profitable prediction when we take Moving Average (MA), it is found
that the profitable prediction accuracy produced as 80%.
Lastly in our project our results are presented using Hidden Markov Model to find the trend of
the stock market behavior. The highest is the fitness value, the better is the performance of the
particular sequence. One day difference in close value when considered is found to give the best
optimum sequence. It is observed that at any point of time over years, if the stock market behaviour
pattern is the same then we can observe the same steady state probability values as obtained in one day
difference of close value, which clearly determines the behavioural pattern of the stock market.

- 32 -
Chapter 6. References

[1] Kavitha G, Udhayakumar A and Nagarajan D ―Stock Market Trend Analysis Using Hidden Markov
Models”
[2] xinjie Di SCPD student from Apple Inc ―Stock Trend Prediction with Technical Indicators‖
[3] Avijan Dutta and Gautam Bandopadhyay and Suchismita Sengupta ―Prediction of Stock
Performance in the Indian Stock Market Using Logistic Regression‖
[4]S.O.N. Agwuegbo, A.P. Adewole and A.N. Maduegbuna Department of Statistics,‖ A Random
Walk Model for Stock Market Prices‖ © 2010 Science Publications
[5] Graham Pentheny ―Analysis of Stock Market Investment Strategies‖ August 2009

- 33 -

Вам также может понравиться