Optimising Your Bot

I had an interesting discussion online with another bot trader. I noticed that one of his bots places many thousands of trades per week, which is not uncommon for bot traders, but that the return on turnover is just 0.065% on over £10,000 of turnover. There are two ways of looking at the return for that bot. It could either be noise on a breakeven system or it could be a very small edge. Thankfully, looking at his charts suggests the latter rather than the former.

In financial low-latency trading and high-frequency trading (HFT) it is all about picking up pennies in front of a steamroller so there is nothing wrong with emulating the big boys. However, HFT firms have an advantage over sports traders in that the dark pools, on which HFT firms trade on, are set up specifically to aid and abet high-frequency trading. Sports exchanges are merely set up to make a profit for the owners of the exchanges who make their profits from commissions. Dark pools are set up (sometimes by HFT firms themselves) to provide rebates for HFT firms offering liquidity whilst front running everyone else. 

Exchanges do have their own trading bots too and they will always have the advantage over your bot in terms of latency. With the exception of traders working for a sports exchange there are many things that can affect the profitability of even a profitable bot. An ISP outage will prevent you from monitoring and closing out bad trades. An exchange bot will beat you to the trigger in low liquidity markets. A removed runner in a horse race can radically alter odds and trends. And, above all, poor money management can wreck a winning system.

As with all forms of trading all you need to do is win more than you lose to make a profit. In a previous article I discussed variance, in which I displayed a few equity curves. Even apparently winning systems can lose and if you are risking too much of your bankroll then you can quite easily lose bankroll after bankroll even though analysis tells you that you have a winning system.

Trading is all about optimising entries and exits. The optimal entry and exit points will maximise profit. Too late an entry and the better prices have already been snapped up. Also, too early an entry on what might be a false signal could lead to a reversal and a losing trade. Too early an exit loses you the potential for more profit and too late an exit might see profit takers eroding your profit.

The bot trader I was in discussion with has bots that trade thousands of times per week, which is a lot of valuable data to be mined. If it is combined with price data taken before, during and after the trade then optimisation is a simple task. The task doesn't even have to use any form of artificial intelligence (AI). Although I was trained in the field of AI I have never used it for my own personal trading, simply because computers are so much more powerful these days.

A simple piece of software can be written that carries out "What If?" scenarios on your data. You can then ask simple questions within your code, testing for what would happen if you waited for that signal rather than another as your entry, what size of trailing stop-loss to use, which is the best time frame to monitor a market, what is the optimal percentage profit to take or what signal is the market giving that tells you it is time to take a profit. You are limited only by your imagination as to what questions you can code. And doing it by brute force asks all of your questions to all of your data. AI, when used by the inexperienced can often find a sub-optimal local solution and not a generalised global soultion to a problem.

In answer to the question
My bot records the market data at point of entry only, so although there is a lot of data, I don’t know what happens/happened after that. Looking at optimising entry and exit is new to me but obvious now you’ve said it. Would I be looking to enter with an offset/stoploss set or would the exit point only be determined after entry and dependant on the activity following?
I would say all of the above. That is the point of optimisation, throw in any idea you can think of and test it. And yes, the before, during and after price data is important. A profit is not a profit if you could have had a bigger one.

Further Reading

Programming for Betfair
Build your own bots with this easy to read guide. No previous programming experience needed, just a logical mind that is willing to learn.

No comments:

Post a Comment