How Trades Work

Chapter 9 of 10

Why most bots lose

A backtest is a story about the past, told by someone who already knows how it ends. This chapter shows how easy it is to find a strategy that looks brilliant on old data and does nothing on new data, and how professionals try not to fool themselves.

The trap

Here is how almost every home-made trading bot is born. Someone has an idea, say a moving-average crossover. They test it on a few years of prices. The result is mediocre, so they try different settings: a 10-day average instead of 20, a 50-day instead of 200. Somewhere around the thirtieth try, a combination turns a profit that beats the market. It looks like a discovery.

It usually is not. Prices are noisy, and any fixed stretch of noisy history contains patterns that will never happen again: a dip that happened to recover, a rally that happened to stall exactly where a 15-day average crossed a 40-day one. Try enough rules and one of them will line up with that particular stretch of noise. The more you search, the better the best result looks and the less it means.

The name for this is overfitting: a strategy so closely fitted to the data it was built on that it describes the noise in that data rather than anything that repeats. The way to catch it is simple and humbling. Test the winner on data it has never seen.

Search for the best moving averages

Every pair of averages on one market, then the winner on 20 new ones. These markets have no long-run drift, so buying and holding gets no free ride.

Read the strip of gold dots. On the market it was chosen from, the winner ranked first of 82 by definition. On markets it had never seen, it scatters across the whole range and averages somewhere near the middle, which is exactly where a combination picked at random would land. The search did not find a good strategy. It found the luckiest one.

Now tick Sluggish markets and search again. These markets have a genuine pattern: news soaks in over several days, so short trends tend to continue. The winner now tends to rank somewhat better than the middle on new data, because part of what the search found was real. Only part, though: the in-sample result still overstates it. That is the honest best case for a backtest. Even when there is something there, the number you found is too high.

Multiple testing: the monkey problem

Overfitting has a cousin that needs no parameters at all. If you give 200 people a coin each and ask them to flip it ten times, someone will flip ten heads, or close to it. Nobody would hire that person as a professional coin flipper. But replace the coins with trading strategies, or fund managers, or newsletter writers, and the same arithmetic quietly produces stars.

Two hundred monkeys with trading accounts

Each bot flips a coin every day to decide whether to switch between holding the stock and holding cash. Every press is a fresh market.

Some monkeys beat buying and holding. The best one usually beats it handsomely, with a chart that would look great in an advertisement. Then, given a new market, it lands wherever the coin takes it. There was never anything behind its record but luck.

This is why a single impressive track record proves so little when you do not know how many others were tried and quietly dropped. Trading courses showcase their successful students. Bot sellers show the backtest that worked. Funds that had a bad decade close and disappear from the comparison tables. You are being shown the best monkey.

Other ways backtests lie

How professionals try not to fool themselves

None of these problems can be removed completely, but serious quantitative researchers fight them with habits like these.

Run 1 Run 2 Run 3 Run 4 EarlierLater

Gold is where the strategy is judged; the green window before it is where its settings were chosen.

What happens to real traders

Studies that follow real people trading on their own tell a consistent story. Researchers with access to every trade on the Taiwan Stock Exchange found that fewer than 1% of day traders were able to earn predictable profits after fees, year after year. A study of people in Brazil who day traded index futures on more than 300 days found that 97% of them lost money. And the scorecards S&P publishes on professional fund managers, people with research teams and decades of data, find that most actively managed funds trail a simple index of their market over long periods.

None of this says patterns never exist or that nobody beats the market; some firms clearly do, with enormous investment in data, technology and people. It says that the default outcome of trying, for an individual with a laptop and a backtest, is losing money slowly to costs and occasionally quickly to leverage. The next chapter is about the alternative, which is far less exciting and works far better.