Sikder Huq
quant · open source · series part 1

An Agent-Friendly Charting Tool for Inspecting Backtests

A flexible, open-source charting tool I built for my own quant research: candles, trades, stops, and indicators in one HTML file, with zooming that feels like a paid trading platform, and an API simple enough for AI agents to drive.

Dec 5, 2025 · 4 min read
View on GitHub

A backtest summary tells me whether a strategy made money. It doesn't tell me whether a stop moved at the right time, whether an entry landed on the intended bar, or whether a filter behaved sensibly during a trend. Those are different questions, and the second kind is where bugs hide.

For a while my routine was to export a run, open TradingView, and hunt down each timestamp by hand. It was slow enough that inspection usually happened late, once something already looked wrong, and that order is backwards. I built backtest-charts to make inspection cheap enough to do first: bars, saved fills, and indicator values on one interactive chart.

Flexible by design

The API doesn't know what a strategy is. It takes tables and series: any OHLCV frame, any trades table, any line, band, level, marker, or background mask. If the research produces a column of numbers, an agent can put it on the chart. That neutrality is deliberate, because each experiment needs different things visualized, and the tool shouldn't have opinions about what those are.

Zooming that stays out of the way

Navigation matches what a paid trading platform trains your hands to do: scroll zooms time while the y-axis auto-fits the visible candles, dragging pans, and dragging the price scale stretches the vertical range. A default web chart does none of this, and reviewing hundreds of trades is only bearable when the chart gets out of the way.

A closer look

These examples use real NQ bars, at 15-second and 5-minute resolution, with saved backtest fills. The market data and strategies are not included in the public repository.

NQ 15-second chart composing many overlays at once: shaded trade boxes with flat periods between them, trailing stop step lines, moving averages, dashed key levels, a session strip on the time axis, volume bars, and per-trade P/L labels
Everything composed. One session at 15-second resolution with most of the overlay types on a single chart: trade boxes, trailing stops, indicator lines, levels, session shading, volume, and per-trade P/L. Each overlay is one API call, and the flat stretches between boxes are the strategy sitting out.
NQ candlestick chart with two winning trades, one losing trade, flat gaps between trades, an orange dashed stop line, and a hover tooltip showing candle, indicator, and losing-trade details
Trade review. The chart keeps the flat periods between positions. Hovering the losing exit shows OHLCV, indicator values, entry and exit prices, realized P/L, and the exit reason.
NQ chart with a right-anchored horizontal volume profile, blue value area, gold point of control, and labeled value-area high and low
Volume profile. The displayed range can include a price-by-volume profile with its point of control and value area.
NQ intraday chart zoomed from 05:45 to 13:20 Pacific with the 06:30 to 13:00 regular market session marked by a blue strip behind the time axis
Market hours. The blue strip marks 06:30 to 13:00 PT without covering the price area.

Why I use it

The clearest example was a chart that showed a consolidation filter switching on and off eighteen times during a single clean downtrend. The bug was mundane: the filter recalculated its range on every bar instead of freezing it while active. No summary metric flagged it, but on the chart it took seconds to see. Since then I split the job: statistics tell me how a strategy performed, and the chart tells me whether it behaved.

Built to be driven by agents

Most charts in my research loop aren't made by me anymore. Coding agents render them, because the API is plain Python calls an agent can compose: add an indicator line, shade a regime, place custom labels on the exact trades worth attention, and slice the window so the chart opens already zoomed to the two days that matter.

That changes what a chart review looks like. Instead of me scrolling through months of data, an agent hands me a small set of charts it selected and annotated: the biggest winners, the ugliest losses, and the trades that test the rule we're actually studying. The repository ships an agent skill file that teaches a coding agent the API and its pitfalls, so charts come back consistent no matter which agent built them. I describe how these audit sets fit into the wider research loop in the harness post.

Try it

The public package only renders. You bring an OHLCV table, a trades table, and whatever series you want to inspect:

import pandas as pd
from backtest_charts import TradeChart

bars = pd.read_csv("bars.csv")
trades = pd.read_csv("trades.csv")

chart = TradeChart(bars, title="Backtest review", symbol="NQ")
chart.add_trades(trades)
chart.add_line(stop_values, "Stop", color="#fb923c", dash="dash")
chart.add_band(upper_band, lower_band, "Volatility band")
chart.render("chart.html", include_plotlyjs="inline")

The result is a self-contained HTML file that needs no server or notebook, and whoever you send it to has nothing to install.

pip install git+https://github.com/rezwan05/backtest-charts.git
python examples/basic_usage.py && open examples/demo_chart.html

The demo runs on synthetic data, so no market data is needed. Source and documentation live at github.com/rezwan05/backtest-charts.