Blog · Investing · 19 November 2026 · 2 min read
How to test an AI trading bot before you trust it with your money
Claude can build a trading bot in minutes now. Getting one that makes money is the hard part. Here are the three tests I run on an idea before a bot trades it.

The short answer
Building an AI trading bot is the easy part now. Claude can understand your idea, write the Python and connect it to your broker in minutes. The hard part is the strategy: I built a system that backtested millions of ideas, and one came back relatively strong. So test the idea before you trust the bot, three ways: write exact rules, test it against random trades, and test it on data it hasn't seen.
As you know, I use AI to help me trade. Perhaps you're doing the same. Right now my feed is full of people building trading bots in 15 seconds.
They're not lying about the speed. Speed was never the problem.
How long does it take to build an AI trading bot?
Not long at all. You have an idea, Claude works out what you mean, writes the Python scripts and connects it to your broker through its API. That's as quick as it gets.
Why do most AI trading bots never perform?
Because the idea underneath them doesn't work. The odds of finding a strategy that's better than everyone else's are very, very slim.
I know because I built a system to find out. It backtested millions of trading ideas. One came back relatively strong.
One.

So the bot is the easy bit. The test decides whether it makes money. Here are the three I run before I let anything trade.

Test 1: write the exact rules
You can't test a feeling. "Buy the dip" isn't a strategy until it says what counts as a dip, how much to buy, when to sell and what happens when it goes wrong.
Here's what exact looks like. These are the rules of the opening range breakout I tested on Nasdaq prices:
- Let the first 5 minutes after the 9:30 open play out.
- If price went up, buy. If it went down, sell.
- Get out if price hits the other end of those 5 minutes. Aim for 10 times what you risked.
- Neither by 4pm? You're out.
Every rule is something a computer can check. That's the bar.
Test 2: test it against random trades
A good backtest can still be luck. So I give the same rules to something with no skill at all, and see if my strategy beats it.
For the opening range breakout I gave 1,000 coins the same rules. Each coin picked buy or sell at random. The strategy beat 998 of them. I left costs out for everyone in that test, since costs hurt the coins more.
If your idea can't beat a coin, the bot is a faster way to flip one.
Test 3: test it on data it hasn't seen
This is the one most people skip. Build a strategy on the last five years of prices and it will look good on those five years. It was made to. That's overfitting: a strategy fitted to the past that falls apart on new data.
So keep some data back. Build on one stretch of time, then run it on a stretch it never saw. If it falls apart there, it would have fallen apart with your money.
My Mechanical Trading Machine does this for you. It tries a thousand strategies, then tests the survivors on fake data and on a period they never saw, so you can see which ones were luck.
What does a strategy that passes look like?
The opening range breakout passed all three. Over 1,962 trades from 2019 to October 2026, risking $100 a trade, it made $24,000 after costs. It lost 3 trades in 4. The big days paid for all of them.
That's a backtest, before tax, and past results don't promise future ones. It's the kind of result I'd let a bot trade. And the millions of ideas that didn't pass are the reason I test first.
Questions people ask
Can AI build a trading bot for me?
Yes. Claude can turn your idea into Python and connect it to your broker in minutes. Whether the bot makes money comes down to the idea, so test the idea first.
Is a backtest enough to trust a strategy?
No. A backtest on its own can be luck or overfitting. Before you trust it, it should beat random trades that follow the same rules and hold up on data it hasn't seen.
What is overfitting in trading?
A strategy fitted so closely to past prices that it falls apart on new ones. Testing on a period the strategy never saw is how you catch it.
Can an AI trading bot trade for me while I sleep?
Yes, once you connect your own broker key and arm it. Do it after the idea passes all three tests, start at the smallest size, and set hard limits and a kill switch the AI can't change.
Where the numbers come from
- The millions of ideas and the one strong result: my own backtesting system.
- The opening range breakout: the rules from a published research paper, written out by Claude Code and backtested on Nasdaq prices from 2019 to October 2026. 1,962 trades, risking $100 a trade, after costs. A backtest, before tax.
- The random test: 1,000 coins given the same rules, each picking buy or sell at random, with costs left out for everyone.