Forecasting S&P500 Index Movement with Support Vector Machines

Similar documents
The profitability of MACD and RSI trading rules in the Australian stock market

NEURAL networks [5] are universal approximators [6]. It

MATHEMATICAL TRADING INDICATORS

Multiple Kernel Learning on the Limit Order Book

Machine Learning in FX Carry Basket Prediction

Support Vector Machines Explained

Up/Down Analysis of Stock Index by Using Bayesian Network

Tai Kam Fong, Jackie. Master of Science in E-Commerce Technology

Equity forecast: Predicting long term stock price movement using machine learning

A New Approach to Neural Network based Stock Trading Strategy

A Sarsa based Autonomous Stock Trading Agent

Pattern Recognition and Prediction in Equity Market

A Neural Network and Web-Based Decision Support System for Forex Forecasting and Trading

Knowledge Discovery from patents using KMX Text Analytics

Chapter 2.3. Technical Indicators

The Moving Average W. R. Booker II. All rights reserved forever and ever. And ever.

SAIF-2011 Report. Rami Reddy, SOA, UW_P

Understanding the market

Alerts & Filters in Power E*TRADE Pro Strategy Scanner

Disclaimer: The authors of the articles in this guide are simply offering their interpretation of the concepts. Information, charts or examples

Optimization of Intraday Trading Strategy Based on ACD Rules and Pivot Point System in Chinese Market

Hong Kong Stock Index Forecasting

Prediction of Stock Performance Using Analytical Techniques

TECHNICAL ANAYLSIS PROVIDES INPUTS FOR INVESTMENT: EVIDENCE FROM GOLD

My Techniques for making $150 a Day Trading Forex *Note for my more Advanced Strategies check out my site: Click Here

Chapter 2.3. Technical Analysis: Technical Indicators

8 Day Intensive Course Lesson 5 Stochastics & Bollinger Bands

An Empirical Comparison of Moving Average Envelopes and Bollinger Bands

atching Currency Moves with The Schaff Trend Cycle Indicator

Knowledge Discovery in Stock Market Data

International Business & Economics Research Journal September 2007 Volume 6, Number 9

A Proposed Prediction Model for Forecasting the Financial Market Value According to Diversity in Factor

How Well Do Traditional Momentum Indicators Work? Cynthia A. Kase, CMT President, Kase and Company, Inc., CTA October 10, 2006

Feature Selection for Stock Market Analysis

SHORT INTRODUCTION OF SHORT SELLING

Financial Trading System using Combination of Textual and Numerical Data

Technical Analysis. Technical Analysis. Schools of Thought. Discussion Points. Discussion Points. Schools of thought. Schools of thought

A Stock Trading Algorithm Model Proposal, based on Technical Indicators Signals

Machine Learning Techniques for Stock Prediction. Vatsal H. Shah

A Study on the Comparison of Electricity Forecasting Models: Korea and China

Prediction of Closing Stock Prices

GMMA 2.0 User Guide. August 2010 Edition PF

Highly Active Manual FX Trading Strategy. 1.Used indicators. 2. Theory Standard deviation (stddev Indicator - standard MetaTrader 4 Indicator)

A GUIDE TO WL INDICATORS

Fuzzy Candlestick Approach to Trade S&P CNX NIFTY 50 Index using Engulfing Patterns

Long-term Stock Market Forecasting using Gaussian Processes

Neural Network Stock Trading Systems Donn S. Fishbein, MD, PhD Neuroquant.com

Ph. D. thesis summary. by Aleksandra Rutkowska, M. Sc. Stock portfolio optimization in the light of Liu s credibility theory

DESCRIPTIVE STATISTICS. The purpose of statistics is to condense raw data to make it easier to answer specific questions; test hypotheses.

FOREX TRADING PREDICTION USING LINEAR REGRESSION LINE, ARTIFICIAL NEURAL NETWORK AND DYNAMIC TIME WARPING ALGORITHMS

Combining Technical Analysis and Neural Networks in the Australian Stockmarket

Unit 9 Describing Relationships in Scatter Plots and Line Graphs

THE MACD: A COMBO OF INDICATORS FOR THE BEST OF BOTH WORLDS

THE SVM APPROACH FOR BOX JENKINS MODELS

PREDICTING STOCK PRICES USING DATA MINING TECHNIQUES

Stochastic Oscillator.

Stock Market Forecasting Using Machine Learning Algorithms

JetBlue Airways Stock Price Analysis and Prediction

Feature Selection using Integer and Binary coded Genetic Algorithm to improve the performance of SVM Classifier

6.14. Oscillators and Indicators.

An Introduction to Data Mining

Towards applying Data Mining Techniques for Talent Mangement

Recognizing Informed Option Trading

DATA MINING TECHNIQUES AND APPLICATIONS

Data Mining for Manufacturing: Preventive Maintenance, Failure Prediction, Quality Control

Trading with the Intraday Multi-View Indicator Suite

Intrusion Detection via Machine Learning for SCADA System Protection

Predicting Flight Delays

CS 2750 Machine Learning. Lecture 1. Machine Learning. CS 2750 Machine Learning.

CHARACTERISTICS IN FLIGHT DATA ESTIMATION WITH LOGISTIC REGRESSION AND SUPPORT VECTOR MACHINES

Empirical Research on Influencing Factors of Human Resources Management Outsourcing Degree *

ALGORITHMIC TRADING USING MACHINE LEARNING TECH-

Session 7 Bivariate Data and Analysis

Determine If An Equation Represents a Function

Beating the MLB Moneyline

Review of Fundamental Mathematics

A FRACTAL MARKET THEORY REVISITED THROUGH CHART ANALYSIS FOR A BETTER RISK/REWARD MANAGEMENT STRATEGY

A Primer on Forecasting Business Performance

Machine Learning and Data Mining. Regression Problem. (adapted from) Prof. Alexander Ihler

Neural Network Applications in Stock Market Predictions - A Methodology Analysis

A Practical Guide to Technical Indicators; (Part 1) Moving Averages

INCORPORATION OF LIQUIDITY RISKS INTO EQUITY PORTFOLIO RISK ESTIMATES. Dan dibartolomeo September 2010

INVESTIGATIONS INTO EFFECTIVENESS OF GAUSSIAN AND NEAREST MEAN CLASSIFIERS FOR SPAM DETECTION

SURVIVABILITY OF COMPLEX SYSTEM SUPPORT VECTOR MACHINE BASED APPROACH

Automatic Detection of PCB Defects

Forecasting stock market movement direction with support vector machine

Usefulness of Moving Average Based Trading Rules in India

Using Software Agents to Simulate How Investors Greed and Fear Emotions Explain the Behavior of a Financial Market

Online Ensembles for Financial Trading

A Quick Tutorial in MACD: Basic Concepts. By Gerald Appel and Marvin Appel

Support Vector Machines with Clustering for Training with Very Large Datasets

Data Isn't Everything

Using Bollinger Bands. by John Bollinger

One Period Binomial Model

Visualization of Breast Cancer Data by SOM Component Planes

Chapter 10. Key Ideas Correlation, Correlation Coefficient (r),

Identifying At-Risk Students Using Machine Learning Techniques: A Case Study with IS 100

Neural Network and Genetic Algorithm Based Trading Systems. Donn S. Fishbein, MD, PhD Neuroquant.com

Comparison of machine learning methods for intelligent tutoring systems

Professional Trader Series: Moving Average Formula & Strategy Guide. by John Person

Transcription:

Forecasting S&P500 Index Movement with Support Vector Machines R. Rosillo 1, D. de la Fuente 2, and J. A. L. Brugos 3 1 Department of Business and Administration and IT Department, University of Oviedo, Gijón, Asturias, Spain 2 Department of Business and Administration, University of Oviedo, Gijón, Asturias, Spain 3 IT Department, University of Oviedo, Gijón, Asturias, Spain Abstract - The aim of this research is to forecast the movement of SP&500 weekly. Support Vector Machine Classifier (SVMC) is used in order to examine the data. The data covers the period between 28/11/1997 and. The inputs are technical analysis indicators such as the Moving Average Convergence Divergence (MACD) and the Relative Strength Index (RSI). SVMC is used to optimize the values of the MACD and RSI in order to determine the best situations to buy or sell the index. The two SVM outputs are the movement of the index and the probability of success to each forecast move. The best result has been achieved is a hit ratio of 92,3% using the SVM Classifier. The training data covers the period between 06/03/2009 and 06/10/2010. The testing data covers the period between 07/10/2010 and. In conclusion, better results have been obtained analyzing short periods of S&P500 than using large periods. Keywords: Artificial Intelligence, Support Vector Machines, Technical Analysis. 1 Introduction Exchange decision making is a subject in constant innovation. In order to generate purchase and sale recommendations, the analysts have used mainly two kind of analysis: the Fundamental Analysis and the Technical Analysis. Nowadays, Artificial Intelligence is helping investors in their decisions making. A widely used Artificial Intelligence technique is Support Vector Machines (SVM). Technical analysis is the most used by investors [17]. This study is mainly based on the Technical Analysis and more precisely on the RSI and MACD indicators of the Quantitative Analysis. RSI and MACD are the inputs for the SVM. 2 Analysis of the state of the art 2.1 Support Vector Machines In this section, a basic theory of the Support Vector Machine Classifier model is presented. SVM originated as an implementation of Vapnik [12]. For a detailed introduction to the subject [1], [2]. SVM are a very specific way of learning algorithms characterized by the capacity control of the decision function and the use of the kernel functions [3]-[5]. The correct election of the kernel function is very important. The methods based in kernel functions suggest that instead of attaching to each element of the input domain represented by : X F (1) a function K : X X R (2) is used to calculate the similarity of each pair of objects in the input set, an example is illustrated in Figure 1 [14]. Fig. 1. An example of how a kernel function works. The rest of the paper is structures as follows. In section 2, the analysis of the state of the art relevant to SVM and technical analysis is presented. Section 3 explains the trading rule designed. Section 4 shows the empirical results of the trading rule. Section 5 provides some concluding remarks. Some examples of Kernel functions are: Polynomial Function: K ( x, x ) ( x x 1) K( xi, xj) exp( xi x Radial Basis Function: i j i j d j 2 ) (3) (4)

The biggest difference between SVM and other traditional methods of learning is that SVM does not focus on constructing hypotheses that make few errors like other techniques. SVM try to make forecasts in which the user can be very confident that the results will be correct, although it can have a lot of errors for a specific period. Traditionally, most learning algorithms have focused on minimizing errors generated by the model. They are based on what is called the principle of Empirical Risk Minimization (ERM, Empirical Risk Minimization). The focus of SVM are different. It does not seek to reduce the empirical risk making a few mistakes, but pretend to build reliable models. This principle is called Structural Risk Minimization. The SVM search a structural model that has little risk of making mistakes with future data. The main idea of SVM is to construct a hyperplane as the decision surface such that the margin of separation between positive and negative examples is maximized [13]. SVM can be used in different ways: regression or classification. Some applications of SVM to financial forecasting problems have been reported recently [6-11]. In this study Support Vector Machine Classifier has been utilized. 2.2 Technical analysis Type the title approximately 2.5 centimeters (1 inch) from the top of the first page and use 20 points type-font size in bold. Center the title (horizontally) on the page. Leave approximately 1 centimeter (0.4- inches) between the title and the name and address of yourself (and of your coauthors, if any.) Type name(s) and address(s) in 11 points and center them (horizontally) on the page. Note that authors are advised not to include their email addresses. The major literature survey on technical analysis is [16]. Technical analysis is defined how the prediction of future exchange rate (or other asset-price) movements from an inductive analysis of past movements, using either qualitative methods (e. g. recognition of certain patterns in the data for visual inspection of a time-series plot) or quantitative techniques (e.g. based on analysis of moving averages), or a combination of both [16]. Before starting to explain the evaluated articles, it is important to highlight the following statement: Technical Analysis is much more used than the Fundamental Analysis; according to [17], 90% of the polled investors use it. inception: the knowledge of Technical Analysis can really generate capital gains. If the Trading rules in the Technical Analysis of values serve for the generation of capital gains, it implies that the hypothesis of the efficient market (which establishes that the price quoted in a period of time reflects all the available information) is not sustainable. Studies can be grouped according to the literature in two ways of thinking: those whose position is different to the application of the Technical Analysis of values, and those that show that the use of the Technical Analysis and some indicators are able to generate greater returns than the passive strategies, for example the buy and hold strategy. Fama [18] discovered that the study of the historical prices is not able to predict future prices and he explained the efficient market hypothesis (E.M.H.) in [19]. Neftçi [20] stated that when the economical and temporal series are assumed as Gaussians, the market indicators are not able to help to predict future prices, but when the prices are not lineal, they can show some prediction. It is also worth noting that [21] proved that the moving average used as trading systems did not always generate a greater profitability than the buy and hold strategy. On the other hand, there are another great number of more recent studies than the previous ones which do recommend the use of the trading rules in the Technical Analysis of values like [22] who supported that when the information was not discounted on the price, the historical prices can help to achieve higher profitability. In another article [23] proved that the use of the moving averages and the use of the supports and resistances like trading tools for the Technical Analysis of values of the Dow-Jones Index from 1897-1986 generated better profitability than the buy and hold strategy in the same index. In [24] explained a similar result to the one considered in the mentioned article, but for FT30 index. Also [25] documented that the technical rules achieved a better profitability than the buy and hold strategy in the NYSE. And lastly, in [15], the oscillators RSI and MACD are evaluated in FT-30 index, and it is shown that the use of both oscillators generate a greater profitability than the buy and hold strategy. So, RSI and MACD are the inputs of the SVM in this study. 3 Trading rule designed The Following sections explain how the design of the trading rule has been developed. An outline of it is shown in Figure 1. The software used is MATLAB 7.8.0(R2009a). The use of the Technical Analysis for the generation of trading rules is widely used nowadays. However there is something that continues to raise questioning since its

3.1.1 The data It was designed by J. Welles Wilder Jr. and it is explained in [25]. The main equation of the RSI is shown below: n1 ( Pt i Pt i i0 RSI t ( n) n1 P i0 1 ti )1{ P P ti ti1 P t i1 } 100 ; (5) Fig. 2. Design of the trading rule. The data base used in this study has been obtained free of charge from http://www.megabolsa.com. This data base has all the necessary information of S&P500 index. The data covers the period between 28/11/1997 and. SVM is trained with different periods of time with this data base in order to get different results and compare them. In Table I, some examples of training and testing tests are shown. TABLE I TEST EXAMPLES Colour Training Period Testing Period Red 21/12/2009-11/11/2010 Green 22/12/2008-06/10/2010 Blue 26/12/2006-04/03/2010 Black 29/12/1998-08/10/2009 19/11/2010-07/10/2010-05/03/2010-09/10/2009- Hit ratio (%) with C=50 64.3% 92.3% 69.6% 58.5% Some examples of training and testing tests are shown in this table. 3.1.2 The inputs The inputs of the SVM are the Relative Strength Index (RSI) and the Moving Average Convergence Divergence (MACD) indicators. These indicators have been chosen because they are the most known in quantitative analysis. The running of the RSI and MACD indicators is summarized in [15]. -- RSI. RSI is an indicator of the Quantitative Analysis. It is an oscillator that shows the strength or speed of the exchange rate of the price by means of the comparison of the individual upward or downward movements of the consecutive closing prices. Where RSI is Relative Strength Index at time t, Pt is the value of index at time t, n is the number of RSI periods, 1{_} is an indicator function which equals one when the statement inside the bracket is true and equals zero otherwise, x is the absolute value of x. The 14-day RSI, a popular length of time utilized by traders, is used in this study. The RSI ranges from 0 to 100 however the range has been reduced from -1 to +1 in order to place it in the SVM. -- MACD. MACD is an indicator of the Quantitative Analysis. It is designed mainly to identify the tendency changes. The MACD is constructed based on the moving averages. It is calculated by subtracting the longer exponential moving average (EMA) from the shorter EMA. The EMA is defined as: EMA t 2 ( Pt EMA n ) EMA t 1 t1 Where EMAt is the exponential moving average at time t, n is the number of periods for EMA. The initial EMA is the n- day simple moving average of the series. In this article, we focus our attention on the 12 and 26-day EMAs, which are the most commonly used in order to calculate MACD[26]. The range of MACD has been reduced from -1 to +1 in order to place it in the SVM. 3.1.3 The trading rule ; (6) The trading rule is managed by the SVM Classifier: First, the SVMC analyses the inputs RSI and MACD. Second, SVMC classifies the different prices of the S&P500 in two classes: buying and selling situation. The prediction made by the SVM is weekly. Third, SVM also plot the conditions of purchases and sales, shows the likelihood that the prediction will be fulfilled. Thus, the very risk averse investor will choose a

high probability of success, while a little risk averse investor will choose a lower probability of success. Fourth, the hit ratio is calculated with the probabilities selected. Finally, SVM optimize the buying and selling values of input variables (RSI and MACD). That is, given a value of RSI and a value of MACD, SVM predict the upward or downward movement every week and the probability that this occurs. 3.1.4 The trading outputs The outputs of SVM are the movement that made the index next week, and the probability that this movement is accomplished. - Movement to make the index. The movement that the outputs of the SVM indicate it will be bullish or bearish. - The probability that this movement is accomplished. The investor can set the SVM to do the trading on a given probability. This allows the trading rule is used by all investors, both risk averse as they are not. Fig. 3. Comparison between long testing period and short testing period. Figure 4 shows the testing period for training data between 22/12/2008 and 06/10/2010. The value of C parameter is 50.C=50. 4 Results There have been various types of tests with the SVM, and the most relevant are displayed below. In Figure 3, a comparison of results obtained in 4 tests performed is shown. The study period in Figure 3 are described in Table 1. As can be seen, the best results are produced with a short training period. On the other hand, the worst results are produced with long training period. The vertical axis shows the hit ratio in% obtained by the SVM in the test period and the horizontal axis shows the value of the parameter C of SVM. Better results are produced with a lower value of the C parameter. It has been taken into consideration that the investor is risk averse and only run commands that have a higher probability than 90% accuracy. The HTRBF (Heavy Tailed Radial Basis Function) kernel function has been utilized in the SVM algorithm. Fig. 4. Testing period for training data between 22/12/2008 and 06/10/2010. Black squares indicate the desired response of the SVM. The blue line impinges for each day of testing the value of the probability of success of that particular day. The red dots indicate the action taken by the SVM, since for this case only takes into consideration the results with a probability of success greater than 90%, the SVM gives 13 recommendations, of which there are 12 hits and 1 error in prediction.

5 Conclusions This study shows that SVM produces better results using shorter training periods than long training periods. This may be caused by overtraining. It has managed to achieve good results for trading, the best situation it is a 92.3% of hit ratio. Moreover, the developed software allows the user to determine their level of risk aversion, which lets the user distinguish the study for each type of investor. 6 Acknowledgment Financial support given by Government of the Principality of Asturias is acknowledged. 7 References [1] C. Burges. A tutorial on support vector machines for patter recognition. Data Mining and Knowledge Discovery, 1998, vol. 2, pp. 121-167. [2] T. Evgeniou, M. Pontil, T. Poggio. Regularization networks and support vector machines. Advances in Computational Mathematics, 2000, vol. 13, pp.1-50. [3] V. N. Vapnik. Statistical learning theory. New York: Wiley, 1998. [4] V. N. Vapnik. An overview of statistical learning theory. IEEE Transactions of Neural Networks, 1999, vol. 10, pp. 988-999. [5] N. Cristianini, JS. Taylor. An introduction to support vector machines and other kernel-based learning methods. New York: Cambridge University Press, 2000. [6] L. J. Cao, F. E. H. Tay. Financial forecasting using support vector machines. Neural Computing Applications, 2001, vol. 10, pp. 184-192. [7] F. E. H. Tay, L. J. Cao, Application of support vector machines in financial time series forecasting. Omega, 2001, vol. 29, pp. 309-317. [8] F. E. H. Tay, L. J. Cao. A comparative study of saliency analysis and genetic algorithm for features selection in support vector machines. Intelligent Data Analysis. 2001, vol. 5, pp. 191-209. [9] F. E. H Tay, L. J. Cao. Improved financial time series forecasting by combining support vector machines with selforganizing feature map. Intelligent Data Analysis. 2001, vol. 5, pp. 339-354. [10] F. E. H. Tay, LJ. Cao. Modifies support vector machines in financial time series forecasting. Neurocomputing. 2002, vol.48, pp. 847-861. [11] W. Huang, Y. Nakamori, S.Y. Wang. Forecasting stock market movement direction with support vector machine. Computers & Operations Research. 2005, vol. 32, pp. 2513-2522. [12] V.N. Vapnik. The nature of statical learning theory. New York. Springer. [13] X. Xu, C. Zhou, Z. Wang. Credit scoring algorithm based on link analysis ranking with support vector machine. Expert Systems with Applications, 2009, vol. 36, pp. 2625 2632. [14] S. Huang, Z. Sun. Support vector machine approach for protein subcellular localization prediction. Bioinformatics. 2001, vol. 17(8), pp. 721-728. [15] Terence Tai-Leung Chong, Wing-Kam Ng ing-kam. Technical analysis and the London stock exchange: testing the MACD and RSI rules using the FT30. Applied Economics Letters. 2008, vol. 15:14, pp. 1111 1114. [16] L. Menkhoff, M.P. Taylor. The obstinate passion of foreign exchange professionals: technical analysis. Journal of Economic Literature. 2007, vol: 45, pp. 936 972. [17] M.P. Taylor, H. Allen. The use of technical analysis in the foreign exchange market. Journal of International Money and Finance. 1992, vol. 11, pp. 304-314. [18] E.F. Fama. The behavior of stock-market prices. Journal of Business. 1965, vol. 38, pp. 34-105. [19] E.F. Fama. Efficient capital markets: Review of theory and empirical work. Journal of Finance. 1970, vol. 25, pp. 383-423. [20] S.N. Neftçi. Naïve trading rules in financial markets and Wiener-Kolmogorov prediction theory: A study of technical analysis. Journal of Business. 1991, vol. 64, pp. 549-571. [21] R. Hudson, M. Dempsey, K. Keasey. A note on the weak form efficiency of capital markets: the application of simple technical trading rules to UK stock prices 1935 to 1994. Journal of Banking and Finance. 1996, vol. 20, pp. 1121 1132. [22] J.L. Treynor, R. Ferguson. In defense of technical analysis. Journal of Finance. 1985, vol. 3, pp. 757-773.

[23] W. Brock, J. Lakonishok, B. LeBaron. Simple technical trading rules and the stochastic properties of stock returns. Journal of Finance. 1992, vol. 47, pp. 1731 1764. [24] T.C. Mills. Technical analysis and the London Stock Exchange: Testing trading rules using the FT30. International Journal of Finance and Economics. 1997, vol. 2, pp. 319 331. [25] J. Jr., Welles. New Concepts in Technical Trading Systems. 1978. [26] J.J. Murphy. Technical Analysis of the Financial Markets. New York Institute of Finance. 1999