Guides, manuals and platform references.
Published: October 19, 2026 · AlgoWay
A backtest can place an order with knowledge that did not exist when the order supposedly happened. Freqtrade's lookahead-analysis helps find that problem by comparing baseline results with additional restricted runs. It is a diagnostic for future-data leakage, not a certificate of profitability.
This check belongs before automated execution. If you are preparing a Python signal workflow, treat signal validity and order delivery as separate jobs. AlgoWay's backtest-versus-live guide covers the execution side of that distinction for TradingView workflows. A connector cannot make tomorrow's information available today.
Imagine three completed candles with closing prices of 100, 103 and 99. A rule that buys at the first close because the next close is higher already knows 103. At the first close, a live strategy knows only 100. This is an invented arithmetic example, not a tested trading result.
In a time-ordered pandas Series, close.shift(-1), with no frequency argument, brings the next row's value into the current row. The first row would contain 103; the second would contain 99. A positive shift of one places the preceding value on the current row instead. The pandas shift reference documents the shift parameters.
Changing a minus sign does not preserve the strategy. “Buy because the next close rises” and “buy because the last close rose” ask different questions. Write the intended decision in plain language before repairing its code.
Freqtrade requires historical data. Its diagnostic starts with a baseline backtest, checks that enough trades exist, then compares separate entry and exit runs. If the minimum trade count is not reached, widen the date range. The command below illustrates the invocation; replace the configuration, strategy and dates with your own research setup.
freqtrade lookahead-analysis -c config.json -s MyStrategy \
--timerange 20250101-20260101
Before running it, record the Freqtrade version, strategy revision, pairs, timeframe and data dates. Keep the diagnostic output beside that record. Otherwise, a later “clean” report may belong to a different rule than the one you are about to deploy.
has_bias reports the finding; the entry, exit and indicator columns help locate it. Fix entry issues before interpreting exit flags. Untriggered signal branches are untested. The tool changes execution assumptions, including forcing market orders by default, to reduce false positives. Pairlist-dependent logic and limit-order behavior can complicate interpretation. These are documented limitations in Freqtrade's lookahead-analysis guide.
Make a small review sheet for your own strategy:
Do not erase a flag merely because the original equity curve looked convincing. Reproduce the decision first. Equally, investigate a flag before declaring every line of the strategy invalid.
After repairing leakage, evaluate the revised rule on data reserved from development and then observe it with simulated execution. Record costs, entry timing and the size of losses, rather than keeping only a win-rate headline. Our worked expectancy examples show why those quantities belong together.
The useful deliverable is a dated account of what was checked, which branches remain untested, and what changed. “No detected bias in this sample” is an honest research note. “Ready to make money” is a different claim altogether.