explain_barExplain what happened on a single backtest bar — whether an entry fired and the per-condition state.
Area
Diagnostics
Group
Diagnostics
Access
Read
Risk
Read-only
Details
Full description
Details
Explain what happened on a single bar — whether an entry fired or not. Use this whenever you want to know what happened (or didn't happen) on a specific bar; pair with get_condition_timeline for proximity over a range.
When an entry fired — returns had_entry: true with the full entry-explanation payload (trade index, signal/entry bars, prices, PnL, exit reason, and a per-condition state snapshot at the signal bar).
When no entry fired — returns had_entry: false with the per-condition state showing which entry conditions failed and how close they were to firing.
Selecting the bar — pass exactly one of bar_id (zero-based index) or timestamp (ISO, resolved via bar_times).
Context window — context_bars (default 0, max 200) attaches a context: [...] field: a ±N-bar window of condition states (entry/exit/gate) and position info, clamped to the backtest's bar range. If unavailable, context_error is set instead.
Per-sleeve runs — sleeve_id is required on portfolio/universe (per_sleeve) runs; omit it to get the list of available sleeve_ids. Omit on single-symbol runs.
explain_bar(backtest_id, bar_id=42, context_bars=5)
Operates on
Builder objects this tool reads or produces, linked to their reference pages.
Capabilities
Bounded options and operating modes surfaced above the full JSON schema.
Required Inputs
backtest_idstringBacktest document IDOptional Inputs
bar_idanyOf (2 variants)Zero-based bar index. Exactly one of bar_id or timestamp is required.context_barsintegerOptional ±N-bar window. When >0, response includes `context: [...]` — per-bar condition states (all groups: entry/exit/gate) and position info, clamped to [0, n_bars). Default 0 returns the single-bar payload. Max 200.sleeve_idanyOf (2 variants)Sleeve to inspect on portfolio/universe (per_sleeve) backtests. REQUIRED for per_sleeve runs; omit on single-symbol runs. Omit on a per_sleeve run to receive the list of available sleeve_ids.timestampanyOf (2 variants)ISO timestamp of the bar to inspect. Resolved to bar_id via the backtest's bar_times index. Exactly one of bar_id or timestamp is required.