How To Predict Stock Returns Using Support Vector Machines (SVM)?

In the last few posts we talked about how to predict the stock prices using the different statistical time series models. In the last post we talked about how to design algorithmic trading strategies using R. R is a powerful statistical software that is available FREE Before you start using R, you will have to learn R programming language that this software uses. Financial time series modeling using ARIMA, ARCH and GARCH models is losing popularity as the predictions made by these models are not so accurate. R is now being increasing used for Machine Learning. Machine Learning is new branch of statistical analysis that uses the vast computational power being made available by computers to analyze big data and make intelligent predictions. One area of interest that is receiving a lot of attention is stock market prediction using machine learning algorithms. Two popular algorithms are the Neural Networks and the Support Vector Machines (SVM).

In the above video lesson, you learn how to use the power of R to predict the stock market returns using Support Vector Machines (SVMs). The above video teaches you through a case study how to design an automated stock trading system that tells you when to buy and when to sell using SVMs.

Support Vector Machines (SVMs) is a new powerful machine learning algorithm that maps the original data to a higher plane using a kernel function in order to optimize the process of prediction. Read this Stanford University research paper that claims that SVMs have been able to predict stock market indices like the NASDAQ, S&P 500, DJIA etc. This is what the authors say: “In this project, we propose a new prediction algorithm that exploits the temporal correlation among global stock markets and various financial products to predict the next day stock trend with the aid of SVM. Numerical results indicate a prediction accuracy of 74.4% in NASDAQ, 76% in S&P500 and 77.6% in DJIA….”

Achieving a predictive accuracy of 70% and above on the above stock indices is a pretty remarkable achievement. So what does this means? This means that you should also learn and master SVMs and use them in predicting the stock market returns. You can easily built SVMs using R as said above. R is a powerful statistical software that has been developed by many people working in the academia all over the world. You can download all the required packages free. You just need to understand how to do the modelling correctly because if you do the modelling wrong, the results would of course be erroneous. The video below explains in simple terms how the SVM algorithm works!

This is another good video that helps you understand how SVMs work!

This is a detailed video that explains how to design SVMs using R!

Now this is what we propose. Use your mastery of technical analysis with these SVMs. Technical analysis is a very powerful proven and tested tool. Candlesticks patterns are highly reliable when it comes to predicting the market direction. Your trading system should have 2 independent analytic tools. Technical analysis and SVMs. When both these analytic tools confirm each other you can use the signal for buy/sell. When the two analytic tools negate each other, you should do more study and decide whether to take the signal or not.

As said above Machine Learning and SVMs is the new data mining frontier. The more expert you are in designing the SVM model the more accurate the predictions would be. Read the research paper by the Stanford University students above in detail a few times and you will understand how they have been able to model the stock market indices in a manner that they get highly accurate predictions.

Designing SVMs using Python

Now another powerful programming language that you can use to design these SVMs is Python. If you are interested in algorithmic trading,  then you must start learning Python. Python is being used extensively by the quants in their stock market models. Python also has got powerful library functions that can do most of the tedious statistical analysis. Unlike R which is solely used for statistical analysis, you can use Python in a host of other applications like building video games. So learning Python has got its tremendous benefits.

Whatever works in the stock market also works in other markets that include the currency market, commodity market, futures market etc. Just keep this important fact that you should first make the financial time series stationary. Stationarity is an important prerequisite for using the above machine learning methods. One way to make the financial time series stationary is to use returns.

Once again, we have used technical analysis to make very good trades. We think technical analysis works and will work always as it is based on the study of charts. Technical analysis is based on the assumption that past prices can be used to predict the future prices. This is also the premise of statistical analysis that assumes that past historical prices can be used to predict the future prices. So both these analytic tools start with the same premise but diverge in their methodology pretty soon. Technical analysis is highly graphical in nature while machine learning algorithms are highly mathematical in nature.

About The Author


I have done masters from Harvard University. I am interested in day trading currencies, options and stocks.