Wickfleet

Freqtrade backtest vs dry run: why results differ

A backtest replays stored candles. A dry run trades the live market with simulated orders. The two rarely agree, and Freqtrade's docs say it plainly: backtesting will never replace running a strategy in dry-run mode. This page lists the documented reasons, then shows what Wickfleet checks before a bot starts.

What each mode does

PartBacktestDry run
Datastored candles for the chosen time rangelive candles from the exchange
Strategyindicators and signals are calculated once per pair, over the whole rangeanalysed inside the bot loop, which runs every few seconds
Entry pricethe candle's open, unless the strategy sets a custom pricefrom entry_pricing or custom_entry_price()
Fillsevery order fills at the requested price while that price is inside the candle's high and low. No slippagea limit order fills once the price reaches its level, or times out by unfilledtimeout. A market order fills against order book volume, with at most 5% slippage
Callbacksat most once per candlemost of them once per loop, usually about every 5 seconds
Walleta starting balance from dry_run_walleta simulated wallet from dry_run_wallet
Feesthe exchange's default fee, or fee from the config

Documented reasons the results differ

ReasonWhat happensWhat Freqtrade offers
Lookahead biasthe strategy reads data a running bot does not have yet: shift(-1), a statistic over the whole column, .iloc[-1] in the populate functions, a higher timeframe joined with a plain .merge(). The backtest looks excellent and the bot does not repeat itfreqtrade lookahead-analysis
Too little startup historysome indicators are wrong until they have seen enough candles, and Freqtrade uses whatever value is in the dataframestartup_candle_count, checked with freqtrade recursive-analysis
Inside a candlea backtest sees only open, high, low and close. It evaluates stoploss before ROI within a candle and assumes the low came before the high for a stoploss, so backtests often show more stoploss exits than a dry run--timeframe-detail 5m simulates the candle from a faster timeframe
Callback timingcallbacks such as custom_exit() and custom_stoploss() run at most once per candle in a backtest. In a running bot most of them run every few seconds--timeframe-detail runs them once per detail candle
Orders that do not filla dry-run limit order can time out. In a backtest it fills whenever its price is inside the candleunfilledtimeout and the pricing settings decide what a running bot does
Dynamic pairliststhey depend on the market of today, not on the market of the backtest range, and results are not guaranteed to be reproduciblea static pairlist, for example from freqtrade test-pairlist
Exchange limitsminimum amounts and price precision in a backtest are today's values. Freqtrade has no historic limitsnothing to set. Know it when a backtest reaches far back

The docs suggest a backtest with --timeframe-detail as the last part of strategy development, to make sure the strategy does not lean on one of the candle assumptions. They add that only forward testing in dry-run mode can confirm a strategy.

A dry run is a simulation too

The docs recommend a fresh database when a bot moves from dry run to real money.

What Wickfleet does with this

In Wickfleet a replay is a Freqtrade backtest of one bot over a date range you choose. It runs on the config the hub writes for that bot, so pairs, stake currency, wallet, open trade limit and fee match the bot, and it is always paper money. A replay runs without --timeframe-detail, so the candle assumptions above apply to it as well.

After the backtest, three more results come out of the same run.

StepResult
Lookahead analysis, with a minimum of 5 tradesclean, biased or inconclusive. Biased blocks a new bot with those settings. Live trading needs clean
Recursive analysisa warning when an indicator drifts more than 0.1% at the strategy's own startup count
Robustness verdictpass or fail with reasons, from the trades of the replay

Both analyses are skipped for a FreqAI bot.

Replay summary with bias checks and robustness verdict, amounts blurred
A replay with its bias checks and robustness verdict

The robustness verdict

A backtest can be free of bias and still rest on one good month or a handful of trades. The verdict looks at that, with these default rules:

CheckPass rule
Walk-forward windowsthe range is cut into 30-day windows, counted back from its end. At least 6 full windows
Totalprofit after fees over the replay is above 0
Consistencyat least half of the windows are profitable
Worst windowno window loses more than 15%
Monte Carlothe trades are drawn again at random 10,000 times. At most 5% of the runs reach a 50% drawdown. With fewer than 20 trades the numbers are shown, not judged

The replay also shows its profit against buying and holding over the same range. That number is shown, not judged.

What gates a bot

Saving through the hubNeeds
A new botyour own replay of exactly these settings, finished in the last 7 days, in which no lookahead bias was found. An inconclusive or skipped check and a recursive warning do not block
A bot with real moneythe same, but the lookahead result must be clean (inconclusive blocks), and the robustness verdict passed. FreqAI bots cannot go live yet. The instance must also allow live trading and hold that bot's exchange key file

The new-bot gate runs only when a bot is saved through the hub. The real-money gate runs there and again before the hub creates or replaces a live container, so a bot file committed straight to the registry cannot go live without it.

Every bot is a dry run by default, and the fleet page sums dry and live bots apart. To put several strategies through the same range, Compare replays two or more bots over one window.

A passed verdict describes the replayed range. It is not a forecast, and it does not replace the dry run.

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

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.