Skip to content

SVM Classification using RSI from Various Lengths

June 10, 2010

First of all, I want to apologize for the lack of posting on the blog these days. I have been insanely busy with work (still am) and had trouble squeezing full posts in.

Today, I thought I would follow up on the previous post on SVM learning. In this post I did exactly what I talked about in the post; the only input in the system is the RSI values for lengths 2 to 30 days associated with their respective results (up vs. down). The SVM algorithm is from the R package kernlab, and the parameters for the SVM itself are nu = 0.2, and C = 10. Those are arbitrarily chosen and absolutely no optimization has been performed, the idea being only to give an example. Furthermore, I by no means suggest that this is the best setup or anything of the sort, I thought this would be a good example since it was previously discussed on the blog. Anyhow, here are the equity curves and some numbers compared to classic MR with RSI 2 50/50 as a proxy and buy and hold.

Just eyeballing the chart, one can see that the SVM strategy adapt better to the the presence of a trend and outperform RSI 2 during the bull market, it also adapted fairly well to the recent turmoil, performing slightly worse than the short term MR strategy. I plan to share some code but don’t want to clutter the blog with lines and lines of code, so once I figure out the best way to do this, (I am thinking a downloadable file or something like it) I will proceed. Finally, if readers have played around with SVM I welcome suggestions and comments as always !

QF

Advertisements
11 Comments
  1. BMB permalink
    June 15, 2010 20:27

    First, great blog!

    Code share would be great. But almost as good would be a description of how the algorithm works (how it is performing the calculation).

    • June 16, 2010 16:43

      Hi BMB,

      Thank you for you comment. For the moment, I think that the inner workings of SVMs is beyond the scope I want for the blog. My goal here was to introduce the tool as a valid area of investigating for the curious reader. However I can send you some papers that explain it pretty well and I welcome any specific questions readers may have, if you are interested drop me an e-mail.

      Cheers,
      QF

  2. Digital Dude permalink
    June 16, 2010 19:11

    Hello QF,

    Nice blog dude!

    It would be great fun to have a look at your code 😉

    Here is a nice paper http://www.jstatsoft.org/v15/a09/paper

    Cordially,

    -DD-

    “Good math and small teams win.” -Alan Kay-

    • June 17, 2010 14:11

      Hello DD,

      Thank you for the paper, it was interesting. I personally always preferred kernlab’s ksvm function when using SVMs. The code is coming.

      Cheers,
      QF

  3. Costas permalink
    November 28, 2010 16:15

    Interesting post.

    What happens if you start your S&P history earlier, say 10 years or so? Do you still have these results? I’d like to see the strategy then as well. Is it robust?

    Best,
    Costas

    • November 28, 2010 20:56

      Hey Costas,

      It does not perform as well before the daily mean reversion era. Hence why I didn’t posted the results in the test. To make it more robust, I could perhaps include momentum variables like macd or EMAs to improve the performance up to the 2000s.

      Cheers,

      QF

  4. Berker permalink
    March 17, 2011 11:30

    Great post!

    Did you try taking only the high probability (say when the confidence level is > 90%) trades?

    • March 18, 2011 19:18

      Hey Berker,

      It has been a while and I don’t remember. Likely end up getting more accurate but less trades.

      Best,

      QF

  5. Ludo permalink
    April 15, 2013 13:27

    hello QF,

    Can you share your code for this example please ?

    Thanks.
    Regards

Trackbacks

  1. Support Vector Machine RSI System « Quantum Financier
  2. Trading con SVM (R) | codigoqf

Comments are closed.

%d bloggers like this: