Check a Freqtrade strategy for lookahead bias
A backtest with lookahead bias uses candles the bot could not have seen at the time. The result looks excellent, and the running bot never repeats it. This page covers where the bias comes from, how to find it with Freqtrade's own tools, and how Wickfleet runs those checks before a bot starts.
Where it comes from
- A negative shift such as
shift(-1), which reads the next candle - A statistic over the whole column, such as
dataframe["close"].mean(). In a backtest the column holds the future too .iloc[-1]inside the populate functions, which is the last candle of the whole backtest, not the current one- A higher timeframe merged by hand with
.merge(). Candle dates are open times, so a plain merge hands the 1h candle to the 5m rows before it has closed.merge_informative_pairaligns on the close
Freqtrade's own checks
freqtrade lookahead-analysis --strategy MyStrategy --timerange 20250101-20260101
freqtrade recursive-analysis --strategy MyStrategy --timerange 20250101-20260101
| Command | Finds |
|---|---|
lookahead-analysis | signals that change when the data after them is cut away. It needs trades to check, 10 by default (--minimum-trade-amount), so a strategy that barely trades cannot be judged |
recursive-analysis | indicator values that depend on how much history was loaded, which makes a backtest and a running bot disagree. It checks one pair, the first in the whitelist unless -p names another, and Freqtrade recommends a range of at least 5000 candles |
What Wickfleet does with them
A replay in Wickfleet is a backtest of one bot on its real config, so fees and stake match the bot. After the backtest, two more steps run on the same data.
| Check | Result |
|---|---|
| Lookahead analysis, run with a minimum of 5 trades | a bias blocks a new bot with those settings |
| Too few trades to judge | shown as a warning on a dry run. It blocks live trading |
| Recursive analysis, drift above 0.1% at the strategy's own startup | shown as a warning |

Beyond bias: the robustness verdict
A backtest without bias can still be luck. Every replay also gets a verdict from its own trades, with no extra run.
| Check | Pass rule (defaults) |
|---|---|
| Walk-forward windows | the range splits into 30-day windows. At least 6 |
| Total | net profit over the replay above 0 |
| Consistency | at least half the windows profitable |
| Worst window | no window below -15% |
| Monte Carlo | 10,000 resamples of the trades. At most 5% reach a 50% drawdown. Under 20 trades it is shown, not judged |
A failed verdict warns on a dry-run bot. It is the gate for live trading: a bot with real money needs a replay of exactly its settings from the last 7 days, with a clean lookahead result and this verdict passed. An inconclusive result blocks live trading but only warns on a dry run, and FreqAI bots cannot go live yet. The hub checks it when the bot is saved and again before it starts the live container, also for a bot file committed straight to the registry.
A clean check does not make a strategy good. It says the backtest did not cheat, nothing more.
Try it
git clone https://github.com/wickfleet/wickfleet.git
cd wickfleet
make quickstart
Needs Docker with Compose v2, git and make, on macOS or Linux. Everything runs on one machine, bound to 127.0.0.1, and a dry-run demo bot is waiting in the fleet. More in the install guide.
More on running a fleet
- Multiple bots on one serverWhat each bot needs of its own, by hand and from a registry
- One dashboard for every botFleet totals, compare and risk on top of FreqUI
- A strategy without PythonBlocks, a plain-words readback and the generated code
- Docker Compose, one addressMany bots behind one origin, and where the CORS error comes from
- Backtest against dry runWhy the two differ, and what a replay checks
- Dashboards comparedOpen-source ways to watch several Freqtrade bots
Wickfleet is software for running trading bots, not a recommendation to buy or sell anything. Backtests and replays describe the past, not the future. Every bot is a dry run on a simulated wallet by default.