Wednesday, 8 November 2017

How I Create Algos that Make Me Money!

The question to ask is: " Do algos make money"? Nothing else matters. Either algos make money or they are just another computer game!

This post will show the steps I take to create a profitable algo. Subsequent posts will go on to talk about taking a number of algos and making them into a portfolio as I have indicated in a previous post.

My starting point is to download data for use in one of the applications that can mine the data and create automated trading algorithms without me needing to be a programmer. These programs can take the granular data and create bar sizes through which it sorts to find the optimum bar sizes.

Next, I take my algo creation program and configure it to find the results I want. It's like reverse engineering an algo. I specify the profitability, draw down, percentage profitability, profit factor and a host of other metrics. The Program then mines the data and come up with a few thousand algos from which to choose.


The chart above shows the results of one such equity curve from a data mining effort. The chart breaks the result into 3 sections. 60% of the data was used to train the algo - to find what is profitable. The second section is the result of testing that algo against data that was NOT used in training it. Finally, the third part of the chart shows what would have happened if I had then run that algo in the market.

I pick the equity curves that look the best. The one below is one of the best I've ever created.


The big issue with data mining is curve fitting. Curve fitting is the process of constructing a curve, or mathematical function, that has the best fit to a series of data points

Looking at the metrics that the data mining application puts out allows me to avoid a lot of the curve fitting. I then also run a Monte Carlo Analysis that changes many of the metrics that a selected algo has output so that I can see whether it is too curve fitted and whether it is likely to be robust. The Monte Carlo analysis provides a report as below.


This alone could be enough. However, I also have a program that can do a FURTHER walk forward analysis. The picture below shows a set of results I like of that WFA.


The bottom lines of the chart above show the ongoing re optimization schedule.


As you can see, changing inputs and then looking at the results on unseen data afterwards shows that the algo was pretty robust and profitable. Of course there is an important disclaimer that you should read at the bottom of the blog page. However, my aspiration is that in live trading I achieve between 25% and 50% of the results shown.

1 comment:

  1. As a discretionary executor of a systematic pattern (heuristic execution of a high probability pattern)in several markets, I look at these posts with both curiousness and gratefulness.

    Curious because, i do not share your inclination towards algos as you do. And grateful because you present things in a lovely, simple and undramatic fashion.

    Since 2008, while I have expected discretionary trading to die...something to the contrary has happened - not just to me but 3 other folks that I know of. Our trading, has remained as straightforward as pre - 2008, while remaining completely discretionary.

    While patterns have surely changed, it doesn't seem to be less profitable....just different.

    What you say is quite interesting to read though, once again thank you for your efforts in making these posts public. They are very illuminating and thoughtful.

    ReplyDelete