On 18 November 2026 at 09:35:50 Asia/Shanghai, the official Freqtrade lookahead-analysis page (HTTP 200) stated that backtesting loads the whole dataframe into memory and calculates all indicators at once, so looking into future candles falsifies a backtest, because the process populates all candle timestamps at the outset. Official docs do not specify a replay harness or a negative test for an LLM trading agent. This article designs that harness as an information barrier: freeze visible market data at the close of candle t, and include a test that candle t+1 cannot be read. A synthetic, offline eight-candle fixture froze at t=3 (visible close 103.5); a read of candle 4 (close 104.5) was rejected. This is not an executed paid-LLM test, not a Freqtrade lookahead-analysis run, and not a profit result.

Calculation and worked example. AI-assisted drafting. Educational information; no individual financial advice.

The official lookahead problem, applied to a frozen window

The official Freqtrade lookahead-analysis page, re-read at 09:35:50 Asia/Shanghai on 18 November 2026 (HTTP 200), is written for Freqtrade strategies, not for large language model agents. It still states the information-barrier problem this article needs. In the introduction it says:

> Backtesting initializes all timestamps (loads the whole dataframe into memory) and calculates all indicators at once. This means that if your indicators or entry/exit signals look into future candles, this will falsify your backtest.

And later:

> The reason why strategies can "cheat" is because the freqtrade backtesting process populates the full dataframe including all candle timestamps at the outset. If the programmer is not careful or oblivious how things work internally (which sometimes can be really hard to find out) then the strategy will look into the future.

An LLM trading agent can be put in the same position. If you hand it a series that already includes candle t+1 while you ask it to decide at the close of candle t, it can read a close it would not have in a live bar-close setting. Official lookahead-analysis docs do not specify a replay harness for that agent, and they do not publish a negative test that the agent cannot read the next candle. This article is a harness design and a checklist built from that official problem statement, plus a synthetic, offline sketch that implements the barrier. It is not an executed test of a paid or live LLM, not a Freqtrade lookahead-analysis run, and not a profit result.

A 17 November TradeBotBench draft already walks the official lookahead-analysis *results table* and its false-positive and false-negative caveats. Another 17 November draft already specifies a tool-call log with a client order id and the last closed candle. This article does not retell either of those. It is only about freezing the market data the agent is allowed to see.

Harness design

Keep the full historic series inside the harness, not inside the prompt. The official page says the command "requires historic data to be available." That requirement is about having candles to run the official tool. For a replay harness, historic data is also the series you will slice. You do not have to use Freqtrade's data downloader to do the slice, and this article did not.

At the close of candle t:

  • Freeze the visible market-data window at candles 0 through t inclusive.
  • Give the agent only that window, plus whatever non-price state you have already decided is legitimate at that close (for example, fills that occurred at or before t).
  • Do not include candle t+1 in the window, in a preview, in a feature cache, or in a tool the agent can call.
  • Include a negative test: a request to read candle t+1 is rejected.
  • Advance the clock only after the agent has answered, then freeze again at t+1.

The official page's examples of lookahead bias are still useful as a warning list, even though they are written for strategy code: shift(-10) looks 10 candles into the future; iloc[] can reach a specific future row; aggregation functions such as .mean(), .min() and .max() without a rolling window "will calculate the value over the whole dataframe, so the signal candle will 'see' a value including future candles." If your harness computes indicators on the full series and then shows the agent the value that was computed with t+1 in the window, you have rebuilt the official problem. Compute any indicator the agent is allowed to see on the frozen visible window only, or recompute it at each freeze from data at or before t.

The official caveats also matter so this checklist is not oversold. The lookahead-analysis command "can only verify / falsify the trades it calculated and verified," and unverified signals can produce a false-negative. A passing bar-close harness test is the same kind of limited result: it only shows that, in the cases you ran, candle t+1 was not readable. It does not show that the agent is unbiased in some other channel (for example a news tool, a cached feature store, or a quote of tomorrow's close in the prompt preamble). The official page also notes that FreqAI target indicators defined in set_freqai_targets() can be falsely flagged in the results table and "are not biased and can safely be ignored" *in that official column*. That caveat is about the official command's results table. It is not permission to hand an LLM the future target column at time t.

For a general evaluation frame, see how to evaluate a trading bot and the backtest statistics tool. Freqtrade dry-run versus backtest fill behaviour, and TradingAgents dry-run versus backtest, are separate questions already covered in dry-run versus backtest fills and TradingAgents strategy-lab dry-run versus backtest.

A synthetic, offline negative test

An eight-candle synthetic OHLCV series was built, with unique closes 100.5, 101.5, …, 107.5. Those are not market prices. The harness held the full series privately, froze at t = 3 (visible close 103.5), and exposed only indices 0, 1, 2 and 3. A read of candle 3 succeeded. A read of candle 4, whose close is 104.5, raised FutureCandleError with the message that candle 4 is after the frozen close and is not visible. A control that hands the agent the unfrozen eight-candle series does include candle 4, which is the situation the official page describes when a full dataframe is loaded at the outset.

All six checks passed. The saved results are in this batch's evidence/fx/ folder and are labeled synthetic/offline. This is a harness sketch, not an executed LLM test. No paid API was called. A checklist or planned simulation is not an executed test of an agent, and a passing fixture is not a finding that any agent makes money, loses money, or trades well.

Checklist

  • Freeze visible market data at the close of candle t. The last visible close is the close of t, not the close of t+1.
  • Put a negative test in the harness: reading t+1 must fail, and the failure must be asserted, not only hoped for.
  • Do not pre-compute indicators, labels, or "current" marks on the full series and then serve those values at time t.
  • If the agent has tools, every tool that can return market data must respect the same freeze. A hidden read_candle(t+1) path fails the test even if the prompt looks clean.
  • Record the freeze point, the visible window, and the rejected read. That log is about information barriers. It is not a performance report.
  • Do not describe this design as official Freqtrade lookahead-analysis output. The official command remains the tool documented on the page cited above, it requires historic data, and it was not run for this article.

TradeBotBench carries exchange affiliate links elsewhere; this post contains none.

Sources & method

What this article adds

A dated harness design and checklist, drawn from official Freqtrade lookahead-analysis wording as it stood on 18 November 2026 at 09:35:50 Asia/Shanghai, plus a labeled synthetic/offline negative test. Official docs state the full-dataframe lookahead problem and do not specify an LLM replay harness; this article does not claim they do. The fixture froze a private eight-candle series at t=3, exposed only indices 0-3 (last visible close 103.5), and rejected a read of candle 4 (close 104.5). No paid LLM was called. A passing fixture is not a performance result and is not an official lookahead-analysis run.

How it was prepared

The official Freqtrade lookahead-analysis page was fetched with curl at 09:35:50 Asia/Shanghai on 18 November 2026 (HTTP 200). The quoted problem statement is from that page. A local synthetic harness sketch was then run; results are saved in evidence/fx/ and labeled synthetic/offline. No paid LLM or paid API was called, and the official freqtrade lookahead-analysis command was not run for this article. Times are Asia/Shanghai.

Official lookahead-analysis caveats (unverified signals can be false-negatives; FreqAI targets can be falsely flagged in the official results table) are quoted as limits on overselling a passing check. They are not used here as a claim about any live agent. This article is distinct from the 17 November results-table draft and the 17 November tool-call-log draft; those slugs were still HTTP 404 on 18 November 2026 and are not linked.

For corrections, contact the publisher. Editorial policy · Affiliate disclosure

Put it into practice