My first trading bot did exactly one thing: it traded the opening range breakout.
I didn't invent it. It's one of the best-known intraday ideas there is, simple enough to automate in a weekend and popular enough that every trading forum has an opinion on it. So instead of hunting for something clever, I automated the classic and started improving it, one piece at a time.
Twenty-five versions later, the bot had run every one of them side by side on Nifty options, mostly in paper mode. Here's what that taught me, including the surprises.
What is the opening range breakout?
Watch the first few minutes after the 9:15 open and mark the highest and lowest price. That's the opening range. If price breaks above it, buy a call. If it breaks below, buy a put. Exit at a target, a stop or the end of the day.
It's popular because it's easy to define, easy to test, and there's academic research behind it. It's also easy to change — and every change is a new version to test.
The 25 versions
Each version differed from another by one thing, so I could see exactly what each change did:
| What I changed | Examples |
|---|---|
| Length of the range | 5 minutes, 15 minutes, a custom window |
| How the break is confirmed | First move past the level, a candle close, a retest |
| Which direction to trade | Follow the break, fade it as a fake-out, trade the pullback after it |
| How to exit | One fixed target, partial profit and trail, a time limit |
| Filters | VWAP, volume, trend, the bot's own market read |
| Ideas from elsewhere | A published research paper, and open-source trading code |
How they compared
| Version | How it did |
|---|---|
| Pullback trade after a successful breakout | Standout |
| Two-way breakout with partial profit and a trailing stop | Standout |
| Breakout with a single fixed target | Strong, but less steady |
| Same breakout with extra filters stacked on | About break-even |
| Breakout on individual stocks | About break-even |
| Research-paper version | Didn't carry over to Nifty |
| Wait for a candle close before entering | Clearly worse |
| Classic mechanical 15-minute breakout | Didn't work |
A handful of versions stood out, and the rest taught me something just as useful. Here are the five lessons.
1. Win rate can fool you
Some versions won most of their trades and still ended up flat. They collected lots of small wins and handed them back in a few big losses. The version with extra filters looked brilliant by win rate and was barely break-even in reality.
Now, whenever I see a strategy's win rate, the next thing I look at is the size of its average win and average loss. That one habit has saved me from a lot of false hope.
2. The backtest was far too kind
The classic 15-minute breakout arrived with a beautiful backtest: years of data, a high win rate and a smooth rising curve. Traded forward, it lost most of the time. It became my weakest version.
The backtest had quietly assumed things real markets don't give you — stops that follow the price perfectly, tick by tick, and fills at exactly the price you wanted. This turned out to be one of the most valuable results of the whole project, because it changed how I test everything. I now replay real sessions instead of trusting a neat curve.
3. Being early beat being sure
The natural fix for false breakouts is to wait for a candle to close beyond the range. So I ran a clean head-to-head: the same strategy, one version entering on the first move past the level, the other waiting for a 5-minute close.
Entering early won comfortably. Waiting did skip a few false breaks, but on the real ones it arrived after the easy part of the move was over. In a breakout, speed is part of the edge.
4. A great paper is a starting point
In 2024, Zarattini, Barbon and Aziz published a widely cited paper showing a 5-minute opening range, traded only on unusually active stocks, performed very well on US equities. I built a version that follows it as closely as I could.
On Nifty options it didn't carry over. That isn't a knock on the paper — US stocks and Indian index options behave differently. Options lose value every minute you hold them, and the Nifty index reports no volume of its own, so I had to use futures volume instead. The paper gave me ideas worth testing, and a few of them found their way into better versions.
5. The real winners keep winning
Test enough versions of anything and a few will look great by pure chance. So I set a stricter bar: does the result hold up when you look across many different days, rather than a few lucky ones?
The two standouts passed that test. Even so, I treat them as candidates that have to keep earning on new trades before they get more responsibility. That's not pessimism. It's what makes me trust the ones that make it.
What I'd do if I started again
- Change one thing at a time. It's slower, but it's the only way each test actually teaches you something.
- Judge the average trade, not the win rate. And look at the worst trades before the best ones.
- Replay real sessions instead of trusting a smooth backtest curve.
- Raise the bar as you test more. The more versions you try, the more proof a winner needs.
Twenty-five versions of one idea sounds like a lot. But it gave my bot its foundation, and a way of testing that everything since has been built on.
Next in the story: letting two AI models help choose my entries — GPT vs Claude in a live trading bot. If you're setting up from scratch, start with algo trading in India: the rules, the cost, and what to do first.