Trading with SVMs: Performance

December 13, 2012
By

(This article was first published on Quintuitive » R, and kindly contributed to R-bloggers)

To get a feeling of SVM performance in trading, I run different setups on the S&P 500 historical data from … the 50s. The main motif behind using this decade was to decide what parameters to vary and what to keep steady prior to running the most important tests. Treat it as an “in-sample” test to avoid (further;)) over-fitting. First the performance chart:

S&P 500 Trading Performance

Very nice! Using the 5 lagged daily returns shows similar performance to the ARMA+GARCH strategy, which I found very promising. If you wonder why I am so excited about this fact, it’s because here we are in the area where ARMA+GARCH is best, and yet, SVMs show comparable performance.

The indicators for the tested methods are: the ARMA+GARCH indicator, the SVM with statistics indicator, the SVM on the last 5 daily returns indicator and the SVM on the last 5 daily returns with greedy feature selection indicator.

The statistics are also impressive:

Buy and HoldARMA+GARCHSVM LagsSVM Lags GreedySVM Stats
Cumulative Return:95.93%260.97%218.96%284.04%274.21%
Annualized Return:15.14%30.88%27.53%32.59%31.87%
Sharpe Ratio:1.332.862.442.892.83
Winning Pct:52.37%51.4%54.77%54.93%54.13%
Annualized SD:0.11370.10780.1130.11270.1127
Max Drawdown:-14.82%-15.44%-16.18%-11.85%-10.27%
Avg Drawdown:-3.43%-1.61%-2.08%-1.77%-1.63%

While writing this post, I found another effort to use SVMs in trading by Quantum Financier. His approach uses RSI of different length as input to the SVM, but it also uses classification (maps the returns to two values, short or long) instead of regression. Since I was planning to try classification anyways, his post inspired me to implement it and run an additional comparison, regression vs classification:

S&P 500 SVM Trading – Regression vs Classification

What can I say – they both seem to work perfectly. As a reader suggested in the comments, the Classification does exhibit more consistent returns.

RegressionClassification
Cumulative Return:214.47%214.42%
Annualized Return:26.05%26.05%
Sharpe Ratio:2.322.32
Winning Pct:56.54%54.93%
Annualized SD:0.11240.1124
Max Drawdown:-16.18%-8.22%
Avg Drawdown:-2.18%-1.72%

Looking at the table, the classification cut in half the maximum drawdown, but interestingly, it didn’t improve the Sharpe ratio significantly. Nothing conclusive here though, it was a quick run of the fastest (in terms of running time) strategies.

There is still a long list of topics to explore, just to give you an idea, in no particular order:

  • Add other features. Mostly thinking of adding some Fed-related series, this data goes back to 1960, so it’s coming soon.:)
  • Try other svm parameters: other regressions, other classifications, other kerenls, etc. This is more like a stability test.
  • Try other error functions. The default is to use the mean square error, but in the case of regression, why not use Sharpe Ratio (in-sample)? The regression case is simpler, since we have the actual returns – check the input of tune.control.
  • Try longer periods instead of days. Weekly is a start, but ideally I’d like to implement two or three day periods.
  • Vary the loopback period.
  • Use more classes with classification: large days, medium days, etc.

This will take time. As always, feedback and comments are welcome.

To leave a comment for the author, please follow the link and comment on his blog: Quintuitive » R.

R-bloggers.com offers daily e-mail updates about R news and tutorials on topics such as: visualization (ggplot2, Boxplots, maps, animation), programming (RStudio, Sweave, LaTeX, SQL, Eclipse, git, hadoop, Web Scraping) statistics (regression, PCA, time series, trading) and more...



If you got this far, why not subscribe for updates from the site? Choose your flavor: e-mail, twitter, RSS, or facebook...

Comments are closed.