◆ New — Strategy Validator, Code Fixer & Prop Compliance Checker are live. Try one free →
Home / Python Backtest Validator
New · beyond Pine — the correctness layer for Python

Python Backtest Validator

The #1 way a Python backtest lies is look-ahead bias— code that acts on data it couldn't have known yet. Paste your pandas · backtrader · freqtrade · vectorbtstrategy and we flag it: negative shifts, centered windows, backtrader's future indices, same-bar execution, higher-timeframe leakage, in-sample overfitting, and missing cost/risk modeling — each with the exact fix. Correctness, not profitability.

Deterministic static analysis — runs on the server, code isn't stored. Correctness only, not profitability.

What it catches
Look-ahead bias

Negative .shift(), centered rolling windows, backtrader positive indices ([1] = a future bar), and .iloc[i+1] future access.

Same-bar execution

vectorbt from_signals with unshifted entries — filling on the close of the bar that produced the signal.

Higher-timeframe leakage

freqtrade informative-pair merges that reference a still-forming HTF candle — the request.security repaint problem, in Python.

Leakage & overfitting

Global-statistic normalization, and model .fit() with no out-of-sample split (data snooping).

Cost & risk modeling

Missing commission/slippage, no stop-loss, no position sizing — the assumptions that flatter a backtest.

Reproducibility

Unseeded randomness and error-swallowing bare except: blocks.

Already have a backtest report? Run the Backtest Health Check → — recompute-vs-claimed, Monte Carlo and overfitting on the results themselves.
FAQ
How do I check my Python backtest for look-ahead bias?

Paste your strategy here. The validator statically scans for the patterns that leak the future into the present — negative .shift(), centered rolling windows, backtrader positive indices ([1] is a FUTURE bar), global-statistic normalization, same-bar execution in vectorbt, and higher-timeframe merges in freqtrade — and shows the exact line and fix for each. It's deterministic and doesn't run your code.

Which frameworks are supported?

pandas, backtrader, freqtrade and vectorbt. The validator auto-detects the framework and applies both generic look-ahead checks and framework-specific ones (e.g. backtrader's [1]-is-future indexing, freqtrade's informative-pair merges, vectorbt's from_signals same-bar execution).

Does a high score mean my strategy is profitable?

No. The score measures code CORRECTNESS — whether your backtest could have known what it's acting on and whether it models costs and risk. It says nothing about profitability, and nothing here is a prediction or trading advice.

Do you run or store my code?

No. The analysis is deterministic static pattern-matching that runs on the server and returns the report — your code is not executed and not stored.

Catch the bug that compiles.Run auditGet Pro