Research Article | Open Access
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 (SVMs). 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 classification 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%.
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. Short-term operators always have their own commonly used technical indicator system, which usually based on four or five main indicators , 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 .
2. SVMs and Technical Indicators
SVM is a method that based on statistical learning theory. Commonly, there is a given set of training sample , in which is an -dimensional input vector, whose components are known as the characters, while is an output vector. Besides, we define the forecast data sets , by learning the data of training sample set, we establish classification model , then the forecast data can be classified correctly, in another word, corresponding to the , we can get the output data . 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 , otherwise . Taking the Granville rule, that is, the rule of MA line, for example, () the average line becomes even after descent, and the price line crosses average line underneath; () price has risen continuously and walk away from the average line, then falls suddenly, and rises again near the average line; () 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.
3. 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 between the output variable and the input variable . Based on independent and identically distributed samples an optimal function is selected from a group of functions . We say the function is best, because it can minimize the Expected Risk Prediction The function is called Learning Function Collection, ( is generalized parameters set), while is called Losing function. In the classification problems, the loss function is usually defined as follows: The learning goal is to minimize the , 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 and technology indicator have a functional relationship , the goal of learning is that to find a function 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 .
The change of the price only has two situations, up marked by and down by . 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 , 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.()The trends(i)MA: in which, is the stock price on the current day, is the number of days, means time; .(ii)MACD Of which, ()The Over Buy and Sale(iii)KDJ: Of which, Here, and represent the highest closing price and the lowest closing price in days, respectively, and .(iv)RSI: Finding out the closing prices in days, including the current day, and then we can get digits by using the daily closing price minus the closing price on the day before. Here the sum of positive numbers in the digits, while the sum of negative numbers ; .(v)BIAS: = 5, 10, 20, 50.
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, Here, represents the empirical risk; while represents the regularized risk, which is depended on the number of the training sample and the VC dimension of learning function set . 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, , by using the SVMs, is to solve the following quadratic programming problem.()Given a training sample, where , , .()Well choose a kernel function and a penal parameter , then construct and solve the optimal problem Find the optimal solution .()Choose a positive in , satisfying . And according to it work out .()Construct the decision-making function , where is a symbol function.
4. 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 , it falls , besides (it has no change) .
The input vector takes the indicators and price data of days’, that is, , in which . Every indicator takes four days’ data, and the meaning of words is a little different from before. Ignoring those days of data when , 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 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 and the optimal values of the punishing parameters , 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 and . But from the searching process, we found that the predict accuracy is not sensitive to and (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.
It can be found from the results that Support Vector Machine has high correct classification rate, especially for theforecasting sample. It is encouraging that we canmake 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 to modify the decision-making function according to the actual situation. Regardless of how the future exchange rates change, we can always use Support Vector Machine to forecast.
Set And then the decision-making function is . Obviously, the larger the absolute value of is, the more accurate the classification is. We can set that the decision-making function is valid when the absolute value of is more than a particular value . In the case of EUR/USD, when the training sample set was tested by decision-making function, the scope of was . So we can take . 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 . For example when , the forecasting accuracy can reach 69. As the value of 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.
- W. Xiaoqiu, Security Investment Analysis, Renmin University of China Press, Beijing, China, 2001.
- Y. Yiwen and Y. Zhaojun, “Financial time series forecasting based on support vector machine,” System Engineering Theorem Methodology Applications, vol. 14, no. 2, pp. 176–181, 2005.
- F. E. H. Tay and L. Cao, “Application of support vector machines in financial time series forecasting,” Omega, vol. 29, no. 4, pp. 309–317, 2001.
- W. Huang, Y. Nakamori, and S.-Y. Wang, “Forecasting stock market movement direction with support vector machine,” Computers & Operations Research, vol. 32, no. 10, pp. 2513–2522, 2005.
- L. Po and H. Jianmin, “Application of SVM in company financing difficulty analysis,” Modern Management Science, vol. 12, pp. 12–14, 2004.
- A. Fan and M. Palaniswami, “Stock selection using support vector machines,” in Proceedings of the International Joint Conference on Neural Networks (IJCNN '01), vol. 3, pp. 1793–1798, Washington, DC, USA, July 2001.
- L. Jianping et al., “Support vector machine approach to credit evaluation,” System Engineering, vol. 22, no. 10, pp. 35–39, 2004.
Copyright © 2009 Zuoquan Zhang and Qin Zhao. This is an open access article distributed under the Creative Commons Attribution License, which permits unrestricted use, distribution, and reproduction in any medium, provided the original work is properly cited.