8 Backtest Biases: A Checklist With a Command for Each One

Leader ●1 ●14 ●36
calendar_today • schedule2 min read
— Originally published at guetaquant.com

A backtest bias is not a philosophical problem. Each one has a check you can run in an
afternoon. Here are eight biases with the specific test that falsifies or clears each.

Eight backtest biases: mechanism, symptom and detection

Educational content: methodology only, no signals, no return claims.
Spanish source: 8 sesgos que mienten en tu backtest.


1. Look-ahead

verify: shift the signal one bar later and re-run.

import numpy as np
shifted = np.roll(signal, 1)      # execute one bar later
# If performance collapses, the signal depended on the future.

In Pine Script v6 the canonical fix is close[1] plus
request.security(..., lookahead = barmerge.lookahead_off).

2. Survivorship

verify: name the assets that traded in your window but no longer trade. If you cannot
list them, your universe is curated by hindsight.

No command clears this. It is a data-provenance question, and the honest output is a
declared limitation.

3. Selection (data snooping)

verify: count every variant you ran, including the ones you deleted.

n_trials = len(trial_log)         # must be the real number, not 1
assert n_trials == len(set(trial_log)), "duplicate trial entries"

If your trial log has one row, you did not run one test — you ran one test you kept.

4. Execution assumptions

verify: double the spread, add half a tick of slippage, add full commission, re-run.

net = gross - (2 * spread_cost + commission + half_tick_slippage)

Profitable before and unprofitable after means the edge was an accounting artefact.

5. Repainting

verify: compare the live value of the last closed bar against the same bar reloaded
from history. If they differ, the indicator repaints.

In TradingView, bar replay exposes this directly: step forward and watch whether history
changes.

6. Data quality

verify: two vendors, same asset, same window. Any difference in bars is a difference in
results.

Also check the broker timezone. A "daily" bar from one broker is not another broker's daily
bar, and a session-dependent strategy inherits that error.

7. Small sample

verify: the confidence interval of your expectancy.

import numpy as np
mu = trades.mean()
se = trades.std(ddof=1) / np.sqrt(len(trades))
print(f"{mu:.4f} +/- {1.96*se:.4f}")

If the interval crosses zero, the edge is not demonstrated — regardless of how smooth the
curve looks.

8. Outcome conditioning

verify: reconstruct the strategy as it existed before you saw the results. If you
cannot produce that version, you have a narrative, not an experiment.

Practical form: freeze the strategy in a commit, and never edit that commit after reading
the equity curve. Every later change goes in a new commit with a reason.


The gate that matters

A strategy passes only if every check above has an answer you can show, not a memory you can
recount. In our own research pipeline, 65 pre-registered tests produced zero survivors
across five markets — and the funnel counts, including the failures, are published.


Study material under Colombia SFC Decreto 2555 de 2010 — financial-engineering education,
not investment advice. No signals, no managed accounts. Related:
pre-registered kill protocol (DSR/PBO) ·
Monte Carlo permutation testing.

Want more #python & #trading deep dives?

Join 6,099+ developers sharing real benchmarks, code breakdowns, and projects. Free forever.

More Posts

When One Python Process Fails, You Need to See All of Them

Tom Smithverified - Nov 23

SEO-Friendly Web Design Checklist: Architecture Before Aesthetics

floxolab - Aug 30

Dashboard Operasional Armada Rental Mobil dengan Python + FastAPI

Masbadar - Mar 12

Stop invoking the whole graph to test one node: unit tests and checkpoints for my LangGraph agent

VEACESLAV - Nov 10

A Textile Mill's Dyehouse Ramp Curve: Get One Step Wrong and the Sheet Belongs to the Master

aiomniu - Oct 18
chevron_left
1.7k Points • 51 Badges
Bogotá, Colombia • guetaquant.com
16Posts
2Comments
15Connections
Founder & Lead Quantitative Engineer at Gueta Quant (https://guetaquant.com).

I design open-source... Show more

Related Jobs

View all jobs →

Commenters (This Week)

2 comments
1 comment
1 comment

Contribute meaningful comments to climb the leaderboard and earn badges!