The Application of SVMs Method on Exchange Rates Fluctuation

Technical indicators are very important tools in the analysis of securities investment. In this paper, considering several main technical indicators prevailed in China security market, we predict whether the price of a stock rises or falls with the support vector machines (cid:2) SVMs (cid:3) . We represent the technical indicators of current four days as input vector. If the price of next day rises, we say that the vector belongs to opposite set, if it falls, we say it belongs to negative set. Studying the samples, the SVMs construct a classiﬁcation model. Then, based on the data of today and three days before, the SVMs give a prediction of tomorrow price. The experiment shows that the predicting accuracy is all greater than 60%.


Introduction
Technical analysis is a very important tool in the analysis of securities investment.It analyzes the past and present behavior of market by mathematical and logical methods and summarizes the typical behavior, in order to forecast future trends of the foreign exchange market.Analysis of indicators is an extremely important branch of technical analysis.Shortterm operators always have their own commonly used technical indicator system, which usually based on four or five main indicators 1 , supplemented by other indicators.Each technical indicator observes on the market from a particular perspective, reflecting the underlying connotations of the market.
There are various technical indicators for foreign exchange investment analysis, taking into account almost all aspects of the market.Therefore, it is necessary to master a few more technical indicators.However, it is a very heavy work to analyze a large number of foreign exchange rates by using a variety of technical indicators.And it also needs a wealth of experience.In this paper, considering several main technical indicators prevailed in China security market, we predict whether the price of a stock rises or falls with the support vector machines SVMs .Because technical indicators have specific value and the results of the analysis only have two cases, up and down, it is entirely feasible that we transform qualitative analysis to quantitative analysis.At present, the SVMs have made great achievements in the application field, such as weather forecasting, pattern recognition, and DNA classification.In the financial sector, it also has a wide range of applications, such as financial time series forecasting 2-4 , stock selection of listed companies 5, 6 , credit rating 7 .

SVMs and Technical Indicators
SVM is a method that based on statistical learning theory.Commonly, there is a given set of training sample input vector, whose components are known as the characters, while y i ∈ {1, −1} is an output vector.Besides, we define the forecast data sets − → x l 1 , − → x l 2 , . . ., − → x m m > l , by learning the data of training sample set, we establish classification model y M − → x , then the forecast data can be classified correctly, in another word, corresponding to the − → x j l < j ≤ m , we can get the output data y j l < j ≤ m .The method of technical indicators is based on the past historical data, and with some discriminate indicators which derived by using specific mathematical formula, then predicts the trend of foreign exchange rates in the future.So, it is reasonable that we select a set of indicators of foreign exchange rates as input data.If the forecast exchange rate will rise, then we have the output data y i 1, otherwise y i −1.Taking the Granville rule, that is, the rule of MA line, for example, 1 the average line becomes even after descent, and the price line crosses average line underneath; 2 price has risen continuously and walk away from the average line, then falls suddenly, and rises again near the average line; 3 the price line is under average line, which has fallen for long time, and is far from average line.The three conditions talked above are all buying signals.Skilled operators can combine their experience and these rules, inspect the relationship between the price line and MA line of 4 or 5 days ago, and make their decision to sale, buy, or just stay.We can also use the SVMs to do this.Take the data of exchange rates and MA line of 4 or 5 days ago as input vectors, using nonlinear mapping map the input data to a high-dimensional space, then depending on the model which is adopted from the training samples, we can decide whether we sale or not.One of the basic assumptions of SVMs is that "the hand of God" will select the input data of the sample set.We believe that the selection of data sets is regular and in this case, part of the regulation is represented by the relationship of positions between the price line and the MA line .However, we cannot completely confirm this regulation.We can only learn on the training samples by experience to look into one point of the mystery.So, the operators find the Granville rule, while the support vector machine finds the classification model.
To determine whether the price of an exchange rate rises or falls, the operators need plenty of operating experiences, after studying a variety of technical indicator lines of recent, and then make decisions.However, the Support Vector Machine needs to study the historical data of exchange rate, and then establishes a classification model.It only uses the price data that a few days before, and input the recent technical indicators data which calculated by the computer program, and by then it can make the decision whether the exchange rate will rise or not.Classification model does not need to update every day, in principle, it will not need to relearn as long as there are no major changes of the exchange rate structure, but we are best to learn at intervals of every cycle of movement.It is worth pointing out that, whether the classification model of sorter can give a valuable forecast, that is, whether their classification is valid in theory?At this point, Takens theorem gives an affirmative answer.The theorem says that, under certain conditions, between the vectors composed of the past and future values of time series, there is a smooth mapping.Based on our common sense on market, this smooth mapping does not exist in the series of exchange rate, but we can input other market information, such as volume and various technical indicators, in order to study the samples, and then construct a classification model.

The Technical Indicators Model Based on SVMs
Support Vector Machine is developed from the Learning problems of statistics.Learning problems often can be expressed as follows.We already known that there is an unknown relationship F − → x, y between the output variable y and the input variable − → x .Based on l independent and identically distributed samples an optimal function f − → x, a 0 is selected from a group of functions {f − → x, a }.We say the function is best, because it can minimize the Expected Risk Prediction The function {f − → x, a } is called Learning Function Collection, a ∈ Λ Λ is generalized parameters set , while Q y, f − → x, a is called Losing function.In the classification problems, the loss function is usually defined as follows: The learning goal is to minimize the R a , known as expected risk minimization criteria.Foreign exchange technical indicators analysis can be described as a general learning problem.Firstly, we recognize that technical analysis is valid; that is, technical indicators and exchange rate trend have some intrinsic link.Supposing that the change of prices The change of the price only has two situations, up marked by 1 and down by −1.However, the selection of input variables is not that easy.As for, there are many different types of technical indicators, the market software can provide hundreds of technical indicators in general.There are mainly four kinds of indicators: the trends, the over buy and sale, the best seller, and the most potential.Because of the difficulty of collecting data, in this paper, we did not select the indicator from the kind of the most potential.Refering to 1 , we select five kinds of technical indicators appropriately which are more popular and effective in the foreign exchange market, including MA moving average line , MACD moving average convergence and divergence line , KDJ random index , RSI the relative strength index , and BIAS bias index .Their calculation formulas are as follows.
1 The trends i MA:

3.5
Of which, The Over Buy and Sale iii KDJ:

3.7
Of which, Here, H n and L n represent the highest closing price and the lowest closing price in n days, respectively, and n 9. iv RSI: Finding out the closing prices in n 1 days, including the current day, and then we can get n digits by using the daily closing price minus the closing price on the day before.Here A the sum of positive numbers in the digits, while B the sum of negative numbers × −1 ; n 6, 12, 24.
The goal of traditional statistical learning theory is to minimize the empirical risk, for example, the regression analysis.But this would result in over-fitting.Vladimir N. Vapnik's statistic learning theorem introduces the two components of real risk, the empirical risk and the regularized risk.In the process of statistic learning we try to minimize the real risk, that is,

3.11
Here, R emp a represents the empirical risk; while Φ l/h represents the regularized risk, which is depended on the number of the training sample l and the VC dimension of learning function set {f − → x, a }.The SVM is to optimize both empirical risk and regularized risk, which both have smaller errors and can avoid over-fitting.Therefore, the model will provide better generalization ability, that is, it will have good predicting ability.
To select the functional relationship, F − → x, y , by using the SVMs, is to solve the following quadratic programming problem.
2 Well choose a kernel function K − → x, − → x and a penal parameter C, then construct and solve the optimal problem min α 1 2

3.12
Find the optimal solution − → α * , where sign • is a symbol function.

Empirical Research
The change of an exchange rate depends on the government policy adjustment.Stock prices are closely related to the results of their fundamental analysis.Generally speaking, the change of an exchange rate is more close to stochastic process.We choose the historical data of the euro/dollar exchange prices for research, and the data is from the Bloomberg.The value interval is from July 10, 2007 to July 9, 2009, which includes 523 days' data.And then the six kinds of technical indicators can be calculated, respectively, by these price data.However, some of the parameters were too large, such as MA 50 .The value of first 50 days' data of MA 50 does not have practical significance.So from the 60th day, we start to select indicators data for 463 days.And then the price has a correspondence output result every day, which rise or fall differently variation ≤0.5% is seemed as no change .When the result rises y i 1, it falls y i −1, besides it has no change y i 0.
The input vector x i takes the indicators and price data of i − 4, i − 3, i − 2, i − 1 days', that is, − → x i P, MA, MCDA, K, D, J, RSV, RSI, BIAS , in which P, MA, MCDA, K, D, J, RSV, RSI, BIAS ∈ R 4 .Every indicator takes four days' data, and the meaning of words is a little different from before.Ignoring those days of data when y i 0, then we can use the Support Vector Machine to classify prices according to their rise or fall.
We choose to use Gaussian Radial Basis Function RBF as our Kerner function in which σ 2 is the parameter.When we solve the optimal problem, we choose to use the quadprog function from the optimal toolbox of MATLAB.As it does not have definite method of finding out the σ 2 and the optimal values of the punishing parameters C, we would better to use "heuristic searching method."The main ideology is to use the cross-test and the wide-area searching method.From a larger range, we found out the best cross-test results of the two parameters σ 2 and C.But from the searching process, we found that the predict accuracy is not sensitive to σ 2 and C shown in Table 1 .
In Figure 1 the dotted line shows the actual profit rate for predicted samples." " point line shows that the price rises, and "o" point line shows that the price falls.From Figure 1, the numbers of actually rising days were 23, and there are 11 days that were forecasted correctly.On the other hand, the numbers of actually falling days were 27, and there are 19 days that were forecasted correctly.If we use the forecast results to do some investment operations, the profit rate would be 28.24%.This method will be effective for other exchange rates forecasting analysis.In this paper, we have only list several main exchange rates forecasting results, which were shown in Table 3.

Results
It can be found from the results that Support Vector Machine has high correct classification rate, especially for the forecasting sample.It is encouraging that we can make this kind of prediction results, no matter how complex the financial market system is.From a practical perspective, we do not know whether the future exchanges are obviously different in this paper, i.e., whether the variation >0.5% .When we calculate the rates, it is still necessary And then the decision-making function is f − → x sign z .Obviously, the larger the absolute value of z is, the more accurate the classification is.We can set that the decision-making function f − → x is valid when the absolute value of z is more than a particular value z.In the case of EUR/USD, when the training sample set was tested by decision-making function, the scope of z was −0.8, 0.8 .So we can take z 0.1.And then the prediction accuracy of the test samples will reach 63.2% for future 50 days.In order to improve the forecasting accuracy, we can increase the value of z.For example when z 0.5, the forecasting accuracy can reach 69%.
As the value of z increases there will be more data points that cannot made predictions.It is a dilemma that whether we should give up more data points.On one side, we must give up more data points that cannot help to make a judgment to improve the accuracy.On the other side, it means lower prediction accuracy that uses more data points as much as possible.
y and technology indicator − → x have a functional relationship F − → x, y , the goal of learning is that to find a function f − → x, a 0 which minimizing the Expected Risk, by using a large number of samples.Here, the inputs are the technical indicators, and the outputs which indicate the change of the future price are derived basing on the relationship f − → x, a 0 .

Table 1 :
Accuracy rate with different parameters.

Table 2 :
Predicting results of USD/EUR.

Table 3 :
Predicting results of other exchange rate.