Trading Rule Optimisation

This is an ongoing project that I will come back to in due course. However, I need a rest from a busy day of optimisation so I will report a little about what I have been up to. A quantitative trader lives by trading rules, the profitability of the rule and the hope that it will live long enough to earn a sizeable profit. But what makes one rule better than another? I will show a little of my thought processes with a rule that I am working on, at present. Obviously, I am not going to say which market the rule is for or any of the underlying calculations but the method is the same for all rules I create.

The following data is from a spreadsheet (click to enlarge) in which I optimised a rule

Although my background is in artificial intelligence (AI) I have still not reached a point where I need to use machine learning techniques to build rules. That may soon change but at all points the optimisation will be human directed. Instead of using machine-generated rules, I create a rule simply by looking at data, charting it and building little 'what-if' scenarios. From there I will create many copies of the rule that have slight variations. The data above shows differences in return and volatility as I open out the rule.

You will notice that % return on investment (ROI) decreases but profit increases (with a slight dip) before steadying until the entire database is covered by the rule. The liability increases because of the increasing number of trades

If applied loosely the rule will generate £4801.16 on £217,500 turnover for an ROI of 2.21%. However, with such a low Sharpe ratio (see Sharpe Ratio for Betting for a full explanation) volatility could quite easily turn this profit into a loss, in future trading. Further up the spreadsheet, we could return 6% on £69,100 of turnover for a profit of £4146.67 and a halving of the volatility with a Sharpe ratio of 0.15. Or we could have even more security with a Sharpe ratio of 0.27 but a decreased profit of £3364.92 (12.42%) on £27,100 turnover.

Which is the better rule? Volatility is key. Risk is related to reward. The more risk you are willing to take then the more reward you can potentially receive but also the greater chance of ruin. The chart below (click to enlarge) shows the varying profitability of the rule and its variants (orange line) and its coresponding % ROI (blue line).

We can now see the three peaks of almost maximal profit and then the rise to the maximal profit peak. However, by then the % ROI has fallen to its minimum and so too the Sharpe ratio. The Sharpe ratios are all less than 1 but then this is to be expected as this is an optimisation for an unhedged lay strategy. If the rule variant at the first peak at £4000 profit is taken then we get over 8% ROI and less volatility. And that is what I have done in my rule selection. Near optimal reward with increased return on turnover and reduced volatility. Optimisation all boils down to what the trader wants in terms of risk and reward and that includes a lot of psychology too. I know that large drawdowns do not suit my trading style so I prefer to forgo some profit for added security.


The capacity of a market is its ability to take your positions. There is no point using a high turnover trading rule if there isn't the liquidity to take the positions you wish to make. Therefore any rule you are optimising must take into account the amount of capacity there is in the kind of markets you wish to trade. If your rule expects you to be placing £1000 into a market with only £500 of capacity on the other side of the trade then you are not going to get the returns you are expecting.

Betfair Points

Another thing to optimise for is Betfair points. You want to keep your points value high so that you get a good rebate on commission. I have not taken that into account in my example above but you could easily factor that in. The more turnover you have then the more rebate you get. Of course, you need to optimise turnover against profit and % ROI. That would slightly improve a trading rule that loses slightly for higher turnover than a rule with slightly less % ROI used at lower turnover.

Future Work

The future will see this work automated with some kind of mathematical optimisation methodology to speed the process up. I am currently programming software that will take selections from my database and perform an exhaustive search of all variables and return a statistical report with charts. AI won't be necessary as today's computing technology can cover an exhaustive search in reasonable time. Such a system would be superior to a sub-optimal machine learned system as every penny of profit counts. Still, it would be nice to compare something like a Genetic Algorithm against my program to see how close to an optimal value it can produce.