The Backtest page
The Backtest page (app.optalgo.com/backtest) shows every backtest on your account: runs made by your AI agent with an API key, by a chat app through the connector, and runs you start on the page yourself. Every plan includes backtests; your quota and per-run limits are shown at the top of the page (Plans and limits).
Backtests run on OptAlgo's engine on real one-minute candles. Fees and funding are those of Binance USDT-M futures. Past results do not guarantee future returns.
Backtest with your AI agent
The quickest way is to let Claude Code or Codex write the strategy:
- Under Backtest with your AI agent, click Create API key. The key gets the backtest permission only. Keep it in your terminal, never in a chat.
- Click Copy prompt, paste it into Claude Code or Codex, and replace the last line with your idea.
- The agent writes
strategy.py, checks it, runs it and reports the honesty grade before any number. Its runs appear in your list as they start.
Using Claude or ChatGPT instead? Add the connector; no key is needed.
Paste code yourself
Under Paste code manually you can run one Python strategy file without an agent:
- Paste your code into the editor, or click Load example.
- Click Check code. The check is free and marks every problem with its line.
- Under Market, pick the symbols (Binance USDT-M perpetuals; your plan sets how many per run), the timeframe and the dates. Dates are in UTC and the last day is included.
- Click Run backtest.
Strategy code may only import numpy, math and optalgo_engine.sdk. Code that tries anything forbidden is refused and counts as a strike on your account (strikes). How to write a strategy: the SDK.
Optimise parameters
Open Advanced: optimise parameters and turn on Search for the best settings. It runs the strategy many times with different settings and checks whether the best result is real or luck.
| Option | Choices |
|---|---|
| Method | Optimise: the best settings over the whole period, then a test of how fragile they are. Good for exploring; the numbers are optimistic. Walk-forward: optimises on 180 days, tests on the next 60 days it has not seen, and repeats. Closer to live trading. Needs at least 8 months of data |
| Optimise for | Sharpe ratio, return, profit factor, or return / drawdown (Calmar) |
| Trials | Up to your plan's maximum |
| Settings to search | A lowest and a highest value for each numeric setting of your strategy |
Click Run optimisation. The result shows the overfitting check verdict (Robust, Inconclusive or Likely overfit) and the best settings. See Research runs.
Cost and queue
Each run shows its estimated cost in backtest units before it starts; the cost is reserved from your quota and settled to the real run time. When the engine is busy, your run waits in a queue and shows its position and an estimated start. The page updates by itself.
A run that would exceed a limit of your plan (symbols, history, trials, runs at once, memory) is refused before it starts, with the reason and what to change.
Read the result
Read a finished run in this order:
- The honesty grade (A to D) and its findings: how far the result can be trusted. Never rely on a D.
- The search verdict: how many variants were tried on this window, and whether the result is likely luck.
- The numbers, net of fees and funding: return, drawdown, Sharpe ratio, profit factor, trades.
- The equity curve and trades.
Click Open detailed view for the price chart with every entry and exit and the strategy's indicators, the equity and drawdown, and the full trade list. You can download the result as JSON, the trades as CSV, and your code.
Your runs
- The list shows the newest runs first. You can search by name or note, sort, and filter by source: via an API key, via this page or via a chat connector.
- Star a run to keep it as a favourite. Each account keeps the charts and trade files of its newest 1,000 runs and of every favourite. An older run keeps its metrics, grade and code; run it again to rebuild its chart.
- Select runs to group them. Runs your agent tagged as one study appear together.
Run it on OptAlgo
A finished backtest of your own code, graded A to C, can run as a strategy on OptAlgo: click Run on OptAlgo on the result. It starts on paper in My Bots. See Run on OptAlgo.
Once a strategy runs, you can open its backtest next to its real trades: filled marks are your real trades, outlined marks the backtest's.