Study on Forecasting the Stock Market Trend Based on Stochastic Analysis Method

To counter strong features of disorder and randomness of stock market fluctuation in China, we introduce a Markov process model for the stock market trend forecasting, which is a useful complement for an existing technical analysis. Meanwhile, we expound on the related properties of Markov process and establish Markov chain mathematical model of the stock market trend forecasting, furthermore, give an example of model application, finally, further investigate application of the model.


Introduction
As high-speed development of China's market economy, people's living standard and disposable incomes rapidly increase, and everyone's financial awareness and investment are increasingly growing.Finance and investment increasingly become a hot topic.Since China's capital markets are underdeveloped and choices of people's investment are relatively narrower, investment stock market become the main investment behavior.Moreover, the development of China's stock market is gradually moving towards maturity and norms after seventeen years.The history of development of foreign capital market has proven that the stock not only has provided significant long-term interests of investors in the past, but also will also provide a good investment vector in the future.However, because of the vagaries of the stock market, investors not only have to seriously study the listed company's history, performance and development prospects of such fundamentals, but also be familiar with the variety of technical analysis in order to win a huge return on investment and become a successful investor.Ideal status is that selecting stocks by fundamental analysis and confirming the timing of buying and selling stocks by technical analysis.
An efficient stock market, whose price randomly fluctuates, reflects the homogeneous distribution of market information, but we can predict possible future trend of the stock market through analysis of past information.In this paper, we analyze and forecast the stock market index with Markov properties, stock prices, as well as its state of interval in view of Markov model, which provides investors with relevant reference model in order to avoid blind and irrational behavior.

The Basic Principles of Markov Forecasting Method
The main principle of using Markov chain to predict is to build Markov forecasting model that predicts the state of an object in a certain period of time in the future by virtue of probability vector of the initial state and state transition probability matrix.Markov prediction model play an important role in the modern statistics because it has Markov properties (no after-effect properties), the weak demand on historical data and forecasting method with many advantages.The difference between Markov model and other statistics methods (such as regression analysis, time series, etc.) are that the former does not need to find mutual laws among the factors from the complex predictor, only to consider the characteristics of the evolution on the history situation of the event itself and to predict changes of the internal state by calculating the state transition probability, so Markov model has broad applicability in prediction of the stock market.

Intuitive description of Markov process
Markov process is a stochastic process with no after-effect properties.The after-effect properties mean: that state of at time t greater than m t only depend on state of at the moment m t in some process when the state is known at the moment m t in some process, but not depend on state before the moment m t in the process.
is said to be Markov chain.
(2)Transition matrix In a balanced system, if probability of the system from state i to j is ij P , then the set of transition probability vector According to this recursive formula, we achieve the forecast based on the interpretation of dynamic system.

The basic properties of Markov chain
(1) No after-effect property.We can see that the state of random variables ( with Markov properties only depends on state of a random variable through Eq. , but not depends on the early state of random variables. (2) Stationary distribution.That is, state probability distribution Where ij P is the state transition matrix of the random process of, I is a set of state space.
(3) Ergodic property.That is, no matter what the system starting from whatever state, the system is in the probability of state j must stabilize in ( ) , 0,1, , j j S after a sufficiently long time.We express it as ( ) lim ij j n P From another perspective to understand Eq. , no matter how stochastic process system start from where the state, when the transfer step number is sufficiently large, probability of transfer to a state j approach to a constant ( ) j .According to this property, we can obtain that state transition probability ( ) j is an unique solution when equation set satisfy the condition (4) Interlinked property of state.That is, process with Markov property will be able to reach the same status through a limited transfer step whatever the initial state is.Stochastic process can reach a state k regardless of their initial state being either i or j after a certain steps 1 and 2 , only are transfer directions and step numbers different.

Construction of Markov chain forecasting model
Analysis of the moving changes on Markov chain is mainly on state and relationship of limited Markov process in chain, then to predict the future situation of chain.According to the characteristics of the composition of process of Markov chain, we may make the following assumptions in order to apply Markov chain forecasting model to stock market analysis.
(1) The operation of the stock market only is impacted by random factors such as the global or regional economic, politics, and society and so on, and macro policy of securities management department is stable and manipulated impact of investors is negligible.
(2) Up or down of the stock market in a given day just depended on state before the closing day, but it had little to do with the past, so the market over the past was negligible.
(3) The probability which stock market from one state i skips to another state j by the same time interval has nothing with moment of the state i .
When analyzing and forecasting process by Markov Chain, we have the following steps: (1) To construct state and to determine the corresponding state probability; (2) to write a state transition probability matrix by the state transfer; (3) To derive all kinds of the state vector by the transition probability matrix; (4) to analyze, predict and make decision in a stable condition.

Regarding the closing state of the Shanghai and Shenzhen Composite as the object to predict
Stock index, that is, stock price index is a indicators for reference edited by the stock exchange or financial services institutions, which shows that change of stock market.It mainly denotes the general trend of stock prices and change range for the entire market, so that it can provide investors with real-time to reflect the movements of the stock market.Therefore, to analyze and forecast it is very practical for investors.
To cite the total 27 trading days closing price changes of Shanghai Composite Index from October 1, 2007 to November 16,2007 as an example, each day's closing prices that are divided into three states: up, down and zero-plus by up and down five points, are analyzed and forecasted.To see Table I on raw data.
Now we analyze and forecast the above information by using Markov Chain.
( (4) Analysis, forecasting and decision-making in a stable condition From the above calculations we can see that closing price trends of the Shanghai Composite Index: with increasing in trading days, that is, i is large enough, as long as the state transition matrix is unchanged (i.e.stable conditions), then state probability tend to the value that is independent of the initial state and more or less stabilized.That is, the stock market eventually is up about the possibility of 50 percent, zero-plus about 20 percent and down about 30 percent.The outcome of predicting is consistent in the actual situation.Therefore, the Shanghai stock market should be optimistic for the near future.The calculation of derivation of the above step is larger to predict the final closing price.According to system stable condition equations of Markov chain, we can use one-step method to predict the state of the closing price.By stable conditions of Markov chain system: .We can see that state probability value of the closing price calculated under the steady-state is the same as conclusions derived by recursive formula.

Regarding the closing price on the stock status as the object to predict
We cite closing price changes of total 27 trading days of China Merchants Bank shares in Shanghai from January 5, 2007 to February 12,2007 as an example, each day's closing price was divided into three states: up, zero-plus, down by plus or minus 20 cents and analyze and predict it.
See Table 3 for raw data.
Using the previous methods of case study, we process the data: the closing price is We calculate the subsequent closing state probability by the transfer matrix and obtain the initial state vector (0) (1, 0, 0) .We can obtain state probability vector (1) (0.5, 0.1, 0.4) of closing price on 28th day, (0.443,0.078,0.478)o f c l o s i n g p r i c e o n 2 9 t h d a y (3) (0.431,0.078,0.489) of closing price on 30th day.We may calculate state probability value of the closing price under the steady-state as follows: 1 2 3 0.528 0.500 0.081 0.100 0.391 0.400 This shows that China Merchants Bank is eventually up about the possibility of 50 percent, zero-plus about 10 percent and down about 40 percent.Therefore, this share should be optimistic for the near future.
We cite the closing price of 24 trading days of Sinopec shares of Shenzhen on January 31 -March, 12, 2007 as an example, original data see Table 4.
The 24 trading day closing prices are divided into six price intervals form low to high in Table 4, where the length of each interval is 0.25 units, so we obtain interval state (see Table 5) According to the data in Table 4 and Table 5, we can obtain 24 state transition situations of closing price (see 0 1.000 0 0 0 0 0.400 0.200 0.400 0 0 0 0.125 0.125 0.500 0.125 0.125 0 0 1.000 0 0 0 0 0 0 0 0 0 1.000 0 0 0.500 0 0.250 0.250 . According to the raw data, we can obtain that the closing price of the 24th trading day is 8.90,which belongs to state interval S3.So the initial state vector can be identified as (0) (0,0,1,0,0,0) .The closing price state probability vector of the 25th trading day state probability vector by Markov chain prediction is as follows: (1) (0) * (0.125, 0.125, 0.500, 0.125, 0.125, 0) P , the closing price state probability vector of the 26 trading day is as follows: (1) (1) * (0.113, 0.338, 0.300, 0.063, 0.063, 0.125) P .That is, State probability that the closing prices of the 25th and 26th trading day locate in S3 and S2, respectively, are maximum, and they are the same as the actual situation of 8.89 and 8.66.The above method is to forecast the subsequent day's closing price based on the raw data from the closing price of 24 trading days.So the state interval vector formula to predict the closing price of the i th trading day is ( ) ( 1) , 25, 26, i i P i . After the calculation, we know that the closing price state interval after each day predicted by the above formula is basically consistent with the actual situation.

Conclusion
As the Markov chain has no after-effect, using this method to analyze and predict the stock market index and closing stock price is more effective under the market mechanism.However, Markov chain prediction method is only a probability forecasting methods, the predicted results is simply expressed probability of a certain state of stock prices in the future, rather than be in a absolute state.The operational status of the stock market is subject to the influence of various factors from market, for example, the multiple market forces from both sides, the fundamentals state of the stock itself, macroeconomic policy, trade and economic degrees and psychological factors of investors.Therefore, no single method can accurately predict changes in the stock market every day, Markov chain prediction method is no exception.But we can combine the results of forecasts from using Markov chain to predict with other factors and see it as a basis for decision-making.In this paper, we only explore application of Markov chain in the stock market, and achieve relatively good results.Markov chain can also be spread and applied to other fields, such as the futures market, the bond market and so on.
divided into three states by each c l o s i n g d a y a s d i s c r e t e u n i t o f t i m e : u p , z e r o -p l u s a n d d o w n , a n d c a l c u l a t i n g t h e probability of each state are as follows: 1) Constructing the state process and determining the state probability If we take each closing day as discrete time units in table I, the closing prices are divided into three states: up, zero-plus , and state the vector (0) (0.444,0.296,0.259) ,d initial state vector.(2)TheEstablishment of State Transition Probability Matrix Since the state of the last day is up while there is no state transition in Table1, the up total number should be recorded a s 1 2 -1 = 1 1 t i m e s , w h e r e t h e n u m b e r o f s t a t e f r o m u p t o u p i s 5 , s o t r a n s i t i o nWe can obtain the closed state transition matrix of Shanghai Composite Index by Table2., where P is state transition matrix.According to Table1, because the stock price is up on the 27th day but no follow-up information, it is regarded as the initial state vector.(0) (1, 0, 0) .By virtue of the vector and state transition matrix to predict state probability of various closing date in the future.And hence we can obtain state probability vector of closing price on 28th day 3x =7, so the probability of each state are as follows:.where each row of matrix P is state transition probability of various situations.So .

Table 1 .
The closing price changes of Shanghai Composite Index inOctober 1, 2007 and November 16, 2007

Table 2 .
The state transition of the closing price changes of Shanghai Composite Index from October 1,2007to

Table 3 .
The closing price changes of China Merchants Bank shares in Shanghai onJanuary 5, 2007 -February 12,  2007

Table 4 .
The closing price of 24 trading days of Sinopec shares of Shenzhen from January 31 toMarch, 12, 2007

Table 5 .
The closing price interval states of 24 trading days of Sinopec shares of Shenzhen on January31-March, 12,  2007

Table 6 .
The closing price state transition of 24 trading days of Sinopec shares of Shenzhen from January 31 to March,