XXUANTIFYInvite a friend

Does a flawless backtest prove a strategy works?

A common belief: if a strategy's backtest shows a smooth, rising equity curve, the strategy works. It sounds right because a backtest feels like evidence: real prices, real rules, real trades. But a backtest only proves what the code was allowed to see. When code can peek at bars that had not closed yet, the past looks better than any trader could have lived it.

Candlesticks of light ending at the right, with faint ghost candles beyond; a smooth glowing line runs ahead and touches the ghost candles before they exist
Look-ahead in one picture: a line that touches candles which have not formed yet.

Key takeaways

Look-ahead in the code shows up in about 7% of the scripts we measured; repaint risk of any kind in about one in three.

alexgrover's Bilateral Stochastic Oscillator Strategy reproduces 1:1 on all four charts, with no repainting.

Its honest backtest is modest: 62 trades on BTC hourly (2025–2026), βˆ’4.1% after 5 bp costs, against βˆ’13.4% for buy-and-hold.

On the daily charts it trailed buy-and-hold by far, on only 9 trades each.

What the data says

We measured thousands of scripts on BTC and ETH perpetuals, on daily and hourly charts, each with its author's default settings, and checked what their code reads. Look-ahead, meaning code that uses values from a bar that had not finished yet, turned up in about 7% of them. Code that can see the future of the very bar it draws on came to about 5%. Cases where that leak showed up as a real difference against the original script were very few.

Look-ahead is only one way the past gets flattered. About one in three scripts (32%) carries some repaint risk: about 16% redraw earlier drawings once new bars arrive, so history looks cleaner than it did live.

Horizontal bars: any repaint risk 32%, redraws earlier drawings 16%, look-ahead in the code 7%, sees the future of its own bar 5%
Look-ahead itself is rare; the wider family of hindsight effects is not.

Now the positive example. The Bilateral Stochastic Oscillator Strategy by alexgrover buys when its bull line crosses over its bear line and sells on the reverse, closing when either line drops under a signal line. Our reproduction matched the original's plots and trades exactly on all four charts, its code reads no higher timeframe, and its repaint risk is none. Its backtest is one you can believe.

And what does a believable backtest look like? Ordinary. On BTC hourly (January 2025 to October 2026) it made 62 trades with a 50% win rate: +2.0% before costs, βˆ’4.1% at 5 basis points per side, while buy-and-hold lost 13.4%. On ETH hourly over the same period, 63 trades: +0.2% before costs, βˆ’6.0% at 5 bp, against βˆ’28.2% for holding. So it lost less than holding in a falling market, which is a real but small result. On the daily charts (2019 to October 2026) it made only 9 trades per market: βˆ’57% on BTC and βˆ’78% on ETH at 5 bp, while holding gained 684% and 1,475%. Nine trades is an anecdote, not a verdict, but it clearly is not a daily trend-holding tool.

Why it happens

A backtest replays history one bar at a time and asks: what would the rules have done here? That only works if, at each bar, the code sees nothing a live trader could not have seen. Look-ahead breaks that rule quietly. A common route is asking for a higher timeframe's value in a way that returns the finished bar, say today's daily close, while the strategy is still trading inside that day. Another is drawing a signal on a past bar once later bars have confirmed it.

Either way, the strategy enters at prices it could only know in hindsight. The result is a curve that is smoother and steeper than reality, with high win rates and shallow drawdowns. Live, the same rules see only what has happened, and the edge disappears.

That is why a flawless backtest should raise a question, not end one. Markets are noisy; honest rules, run honestly, produce lumpy results with losing streaks. The Bilateral Stochastic strategy shows that pattern: on BTC hourly its winners and losers were the same in number, and the gains were spread over many trades rather than a lucky few.

What to do instead

Check what the code is allowed to see

Look for higher-timeframe requests and drawings placed on past bars. A script that reads only closed bars of its own chart, like this one, cannot borrow from the future.

Compare history with live behaviour

Watch the signals form on live bars for a few weeks. If arrows appear, move or vanish after the fact, the backtest is flattered.

Add costs and set it beside buy-and-hold

The original's defaults charge no commission or slippage. At 5 bp per side BTC hourly turned from +2.0% to βˆ’4.1%; its break-even cost was 1.6 bp per side.

Count the trades

Nine trades over seven years cannot prove much either way. Ask for dozens before you trust a result.

The bottom line

A perfect backtest proves only that the code fits the past it could see. Check first that it saw nothing it should not have; then expect the honest result to look modest. alexgrover's strategy is a good model of the first part: faithful, non-repainting and transparent. The author's own description is equally candid, sharing mixed results across several currency pairs and advising against stacking a martingale on top. What would make it stronger is a cost-aware exit or a trend filter, so the hourly edge survives fees; that is a suggestion, not something we measured.

For more on hindsight effects, read our earlier pieces on higher-timeframe repainting and on whether trading costs matter, or browse the latest reports.

All of this was measured with the authors' default settings on BTC and ETH; your own settings or market may behave differently.

This article is education, not investment advice.

Every test here counts trading costs, runs on many markets and compares the result with just holding the same market. A result is a starting point, not a verdict. How we test

Newsletter

New tests, now and then.

Only for this newsletter; we send a mail to confirm first, and every mail has a link to stop. Privacy