Machine Learning and Mechanical Trading with Genotick

Screen Shot 2015-12-10 at 8.35.32 AM

I’ve recently been experimenting with Genotick, which is open-source java software that attempts to discover mechanical trading systems through the use of machine learning. You can run it on just about any Mac/Windows/Linux system (although you may have additional hurdles to get java8 working at the command-line level on a Mac). Thousands of tiny programs create random rules to predict the next day’s market move. The ones that have a better success rate are kept, and the ones that suck are booted to the curb. Every day the ‘robots’ all take a vote for up or down, and the majority wins. The process repeats each day, and the good ones evolve and the bad ones die out. Every time you do a new run, the robots evolve differently and you get different results.

Because it’s open source software (and is still at the very early stage of development), there’s a fair amount of heavy lifting on the user’s part to get this to work. I’m still wrapping my head around the Linux command-line interface and grepping the data I need out of the reports the software generates. Serves me right for just clicking on icons all these years I suppose. No matter, I’ve been able to get some results out of it. Not results I would trade, mind you, but this is more about the intellectual exercise at this point. The software does hold promise though!

The lead image shows an equity curve of IBM stock from 2004-2006 inclusive, vs. buy-and-hold of the same stock. No commissions deducted (which would be substantial, since this is a daily trade), and the total account is invested each trade. I fed Genotick the open/high/low/close/volume (OHLCV) data for each period and let it go to work. About an hour later, I had results.

As you can see, where owning IBM through this period would have left your account roughly where you started, the Genotick system would have been up about 18%. The bad news is that it would have been in drawdown from over 40%. It appears as if the software was no longer able to exploit an ‘edge’ after about the half way point.

The funny thing about human nature is that if you don’t know why something like this works, it would be very difficult to keep trading when the results started to go poorly. Would Genotick have turned things around? No idea. One part of any trading plan using (a future version of) Genotick would be a method to check whether your trading system was still working.

As a simple measure of ‘system health’ I tried computing a 10-day moving average of the system’s ‘hit rate’. It varies quite a bit, but there’s a definite downward trend in the success rate over the run.

Screen Shot 2015-12-10 at 8.37.13 AM

The next run could have a completely different equity curve, and a correspondingly different hit-rate profile. As I move forward, I’ll be comparing multiple runs and incorporating more data besides OHLCV data for the ticker. But it’s a fun first step.

6 thoughts on “Machine Learning and Mechanical Trading with Genotick”

  1. Interesting experiment. When you run it over 2 years on IBM how much data does it “train” on? I’m assuming it knew nothing about the 2004-2006 time period and you fed it some training period before that. Also does it take Dividend Adjustments into account?

    1. Hi Martin and thanks for your comment. You can read more about the software (it’s open source!) by clicking the link in the post. Hopefully I can explain it properly. It doesn’t require a training period as it’s always training. Several thousand simple programs create random guesses about the market based on the data it has seen before, and vote up or down. The majority wins. The ones who continually guess wrong are replaced by new programs, and the process repeats.

      I used free yahoo data for this test, which I think is adjusted for dividends but I’m not sure. It’s more for getting my feet wet. I also wanted to pick a ticker that didn’t exhibit such a strong a trend as for example the S&P 500 (as the program’s author has used on the site).

  2. Are you using the Java code within an IDE or the standalone version? I’ve never looked at Java before but hope to run it through in Intellij IDEA on debug so I can follow the whole process through. Intuitively the program makes a great deal of sense. I am inherently extremely sceptical about forecasting these days so perhaps this random approach to system building has an appeal.

    1. I was using it at the command line, although this is awhile ago so I’m sure it’s changed. I agree that the concept seems reasonable. What I didn’t like though was that genotick would seem to latch on to a winning system and then lose it later through evolution (or regime change perhaps). Without knowing what was going on under the hood, I would always worry that the robots had lost their way without telling me.

Leave a Reply

Your email address will not be published. Required fields are marked *