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.

Capacity

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.

Sharpe Ratio for Betting

David Edelman's The Compleat Horseplayer gives a betting equivalent for the Sharpe Ratio (pages 27 & 28). The Sharpe Ratio (aka Information Ratio) is used as a measure of effectiveness for a strategy.

In finance, the Sharpe Ratio is defined "as the excess return (or risk premium) per unit of deviation in an investment asset or a trading strategy, typically referred to as risk (and is a deviation risk measure), named after William Forsyth Sharpe." The ratio measures how well the return of an asset compensates the investor for the risk taken.

In sports betting the Sharpe Ratio is a measure of how much a trader is rewarded for any particular system they devise.

The ratio is given by the excess returns divided by standard deviation (aka volatility) and can be computed in Excel with the formula

=average(a1:a10) / stdev(a1:a10)

where a1:10 is your array of returns from any single strategy.

To the right you can see a sample of returns for which I have created a Sharpe Ratio. Play around with the returns (percentage or absolute) in cells A1 to A10. Put in some negative values to denote losses and also widely differing positive and negative returns to get a feel for what the Sharpe Ratio measures.

For example, you only have to change one of the values to -1.0 and the standard deviation will increase thus dramatically lowering the ratio.

In finance a good ratio is regarded as being greater than 2. In other words, your average return for any trading strategy should be twice that of the standard deviation of the returns. A Sharpe Ratio of 1 means that the return is equal to the risk being taken and less than 1 means that more risk is being taken than the reward in return. The higher the Sharpe Ratio then the lower the deviation of returns compared with the average. In other words, no sudden big losses that can wipe out your bankroll. Slow and steady wins the race.

For sports trading I have tried to calculate a Sharpe Ratio after every trade but that produces very low figures. Instead, I calculate a figure for total yield at the end of the day and produce a Sharpe Ratio based on daily yields. Generally, the longer the period the larger the ratio. You could calculate a weekly or monthly yield and base your ratio on that. However, if your trading models are short lived then the daily ratio is probably the best.

I use Sharpe Ratio as one of many fitness measures when developing new trading models. See GA Optimisation of Entries and Exits.

Scalping on Betfair for Profit

Let's get straight to the point. The best way to make a profit from scalping is by writing your own scalping software and licensing it to other people. Doing so will guarantee a regular income above and beyond whatever you could imagine from scalping itself. The selling of software to aid punters is in itself a form of scalping.

Yes, there are people adept at rapidly clicking buy and sell positions on horse races but what are the majority of them really doing? Following the herd, that is all. And since when did anyone make serious profit from following others? A move starts and a scalper jumps onto the bandwagon in the hope that the move continues and they get a tick or two's profit. Fine, if you like picking up pennies in front of a steamroller.

It is possible to scalp the market so long as you have the best technology and can get in and out of a trade before the herd. Scalping is in many ways a form of Ponzi Scheme. The fastest in and out of the market gets the profit. However, the Johnny-Come-Latelys are lucky to get anything more than a loss. But who is really the clever one? The scalper jumping on a move or the originator of the move? You must ask yourself the following questions. Does the move always continue? Is the move a false one? Can you always get in and out of a trade to make a profit? What is the strike rate for success? Can scalpers predict anything or are they just sheep, flocking together?

There are two situations where a scalper will enter the market; when new information enters the market or on a false signal. New information will affect the odds on a particular horse. As information filters into a market the price on a horse will gather momentum as it moves to its new price. Prices on other horses will move depending on the tightness of the overround.

A false signal can be created by scalpers acting on false or spurious information or just a hunch about the current state of the market. It only takes a few of the faster scalpers to create a self-fufilling prophecy that the price is moving so that the rest of the scalpers move in a tick or two later. The faster scalpers get those one or two ticks of profit from the late arriving scalpers. The late scalpers may get a smaller profit if the move continues, scratch if it doesn't move or lose if the value traders move in to arbitrage the price back to its original value.

If you are interested in becoming a scalper then you must research the subject very carefully. Be wary of all the videos that you see on YouTube. "But everyone I see on YouTube is making money," you say.

I say, "Where are all the videos of failed attempts at scalping? The ones that never got published. The ones that are supposed to show you how not to scalp. Which successful take are you watching, the first or the tenth?" I don't see any difference between scalping and roulette Martingale videos and we know how successful the Martingale system is, don't we? Scalping videos show the task to be like taking money from a baby but it is far from being like that.

To profit from scalping requires that your strike rate is sufficient to cover all the scratched and losing trades and there will be a lot of them. And that your ticks of profit outnumber your ticks of losses. It has been shown that a buy and hold stock holder always outperforms the day trader. The same is true for sports exchange betting, although the time scales are somewhat different. Also, it is hard to pin a scalper down to how they trade. You will get a different answer depending on whether they are winning or losing but it will nearly always involve the word "feeling". My trading rules are based on a solid base of statistics and never on a feeling. A feeling can change depending on your health and emotions. Trading on a rule that is never the same twice is a fast route to bankruptcy.

If a scalper is working to a set of rules then those rules should be quantifiable and can be automated by coding them into a bot. However, if scalpers are not working to a set of rules (no matter how fuzzy) then they are just guessing. In financial scalping there will always be some fundamental reason for jumping on the bandwagon; Bloomberg announces an interest rate rise or Reuters downgrades a company following a profit report etc. What do you have to go on in horse racing? Unless you have connections within the horse's yard then you won't know why a price is moving (steaming or drifting) and cannot justify your position.

Prospective scalpers point out to me the number of blogs and websites set up by scalpers. However, many of these websites are usually short lived and were set up by people who initially got lucky and then got burned. Some people are quick to trumpet their successes but not their failures. Check the date of the last posting and then wonder why they have not posted for many months. Why have they stopped blogging about scalping?

There are a lot of blogs by people who started scalping and initially got lucky only to stop blogging when it all went wrong. Only considering a few successful winners like this whilst ignoring the multitude of losers is known as survivorship bias and is to be avoided. Learn from long lasting truly successful scalpers who have survived beyond any perceivable level of luck. It is a male trait to boast about being good at something only to be sheepish and quiet when things head south.

On researching how to be a scalper, I don't think that the successful scalpers are going to teach you much as it is in their interest not to. It's rather like online poker, the sharks used to make a lot of profit from the fish but now the pool of fish is drying up and online poker is not as popular as it was. Poker games have toughened up since the early days and the sharks find it harder to make the profits they once made. This is due to bad poker players either learning how to play poker properly or giving up the game.

The same can be thought of scalping. Many scalping movements in the market are the result of false signals but that doesn't matter to the sharks (who are the fastest and most experienced scalpers) so long as they get in first they will make a tick or two's profit from those who follow later and push the price up or down. If the pool of bad scalpers dries up then making money from false signals will stop and profit will only be made from true market movements. Indeed, as I write this article experienced scalpers say that their profits are down. Is this because of a levelling of the playing field with fewer mug scalpers adding to the profits of the experienced?

I know of one trading software vendor who started out as a scalper, realised that there were more profitable ways of earning money from sports trading and is now looking at other methods such as swing trading. Other vendors still churn out the tenth video take of "How I Scored at Scalping". It doesn't really matter to a vendor what you use your software for as they've already made their profit but how you use your software does matter to you. Scalping is not easy, I have done it. Hardware and time requirements are exacting. However, computers were invented so that you can program them and leave them to work for you whilst you do something else. It is more productive to design bots to trade many markets than to sit and trade one market yourself.

Scalping is a lot of hard work for not much in return considering time, technology and effort. For a larger return on investment you need to find scaleable methods for growing your wealth. Sitting at your computer and trading one market at a time is not scalable. To scale up your operation you need bots trading all markets simultaneously and then scalping will never be necessary. 

If you want to learn more about scalping then I suggest that you treat the forums of the third party trading software vendors with a pinch of salt. You will hear lots of positive but rarely any negative comments about scalping. This is due to vendor employees participating on forums who would not last long in their job if they said anything negative about scalping. Vendor employees have access to very fast and dedicated technology for scalping with so they will always be at the front of the queue, in the same fashion that HFT bots front run financial markets. Also the quickest scalpers with fast access to the markets want newcomers to try scalping so they can feed off the mistakes of the beginners and the inept. Scalping sports markets is not a level playing field no matter what you might hear about everyone having an equal chance.

Pros

1 - If you are as equally skilled and equipped as the best traders then you will turn a profit. However, the work put in and the profit may be less than your current work.

Cons

1 - Trading is a zero sum game, every winner needs a loser to support them. The top scalpers want you to scalp so as to create liquidity for their trades. You could end up losing your money to them.

2 - Not all scalpers are equal. The most successful scalpers have fast connections and can front run the market.

3 - Software vendors want you to scalp because it means that you will have to buy specialist software. The best software has to be rented monthly though some is free it is generally of inferior quality.

4 - You can only trade one market at a time. It is more profitable to trade all markets simultaneously through bots using algorithmic trading techniques.

Further Reading