Run Backtest
tt_backtest_strategySubmit a backtest of a strategy on real historical option prices; returns a job id to poll.
Runs the SAME template object tt_create_strategy produces on Tradetron's own backtest fleet, which uses Tradetron's fill model and keyword library on historical data. Submits the job and returns {job_id, watch_url, status_url}. The deliverable is the RUN'S REPORT: poll tt_backtest_status and present its report_url (public, per-run). watch_url is a secondary "watch it in your account" link (on fleet runs it opens the user's logged-in Backtests page, not a page for this run alone) — offer it alongside, never instead of, the report.
Pass exactly one of template / strategy_id:
strategy_id: an existing template id (or deployed SID — auto-resolved) from the user's connected Tradetron account. Fetched, then backtested.
template: the strategy object (with a 'sets' array) — from tt_create_strategy or a Tradetron v2 export (the service translates v2).
a plain-English description: NOT an argument — create the strategy FIRST (tt_create_strategy, which is free), then backtest the created template.
a strategy NAME ("backtest CASH ON Nifty new"): also not an argument — resolve it to an id with tt_list_my_strategies(q=) first; only ask the user for the template id / edit URL if that lookup finds nothing.
BILLING (when enabled server-side): creating strategies is FREE; each backtest beyond the daily free allowance debits a flat fee from the user's Tradetron WALLET (not AI tokens). A rejected or failed run is auto-refunded. Possible billing responses — relay them faithfully: {billing_required, price, wallet_balance} means the balance doesn't cover the run — say so, and if the response carries topup_url share it as a clickable link; when it doesn't, note that wallet balance can be managed from the user's Tradetron account on the website. A successful submit may carry {billing: {charged, wallet_balance, refund_policy}} — mention the charge in one short sentence, never as a surprise.
Args:
template: the strategy object (with a 'sets' array); omit when passing strategy_id.
strategy_id: existing template id / SID in the user's account (requires connected
account); omit when passing template.
start, end: 'YYYY-MM-DD' backtest window (end is exclusive, matching TT-BT).
DATA RULE (exchange, 13 Oct 2026): NSE/NFO/BFO backtests may only use data
at least 35 days old, so end must be on or before today minus 35 days
(MCX, crypto and US: yesterday, as on the website). An empty end
defaults to that date (the response carries window_note); a later end is
refused free with code BT_WINDOW_TOO_RECENT and latest_allowed_end —
explain the rule and offer that date. Never promise a backtest on recent
data or 'up to yesterday'.
WINDOW SIZE: one run covers any window up to 5 years (60 months); a longer
window is refused uncharged. Data starts Jan 2020 (Sensex/Bankex options
Aug 2023, single-stock options Jun 2024). To look at more than 5 years, run
two windows; never promise 'the full history' in one run.
LOT SIZE: a run uses today's lot size for the whole window by default.
Historical lot sizes are opt-in on the website's Backtest dialog ("Lot at
each expiry"); this tool has no such switch, so say which one applied.
type: 'auto' (default) | 'positional' | 'intraday'. 'auto' self-detects from the
strategy's structure; when the structure gives no STRONG signal — or when an
explicit type CONTRADICTS a strong signal — the tool returns
{confirmation_required, code: BT_TYPE_CONFIRMATION_REQUIRED, question, evidence}
and submits NOTHING. Ask the user that one question (the wrong type makes the
engine force-close positions at 15:30 daily, so every number would be wrong),
then re-call with type= and bt_type_confirmed=True — the user's
answer is FINAL and supersedes the classifier.
bt_type_confirmed: set True ONLY after the user has answered the intraday-vs-
positional question; honors their type verbatim, never re-asks.
confirm_charge: set True ONLY after the user has been told the exact fee and
agreed to it. When a run is chargeable, the tool first returns
{code: BT_CONFIRM_CHARGE, price, wallet_balance, refund_policy,
confirmation_token, retry_call} and submits nothing. That one response
carries everything the user needs to decide — price, balance, and that a
failed run is auto-refunded — so ask ALL of it in ONE message, wait for a
yes or no, and do not go looking anything else up. Never set it on your
own initiative.
confirmation_token: the token from that response. After the user says yes,
the confirmed call is just {confirmation_token, confirm_charge: True} —
no template, no dates. The quoted run is replayed exactly, so nothing can
drift between the price the user agreed to and the run they get. The
token expires in 15 minutes and works once; if it is rejected, re-send the
full arguments with confirm_charge=True. It authorises nothing on its own.
trade_price: 'Open' (default) | 'Close' | 'Avg of Open and Close' | 'Best price' |
'Worst price' | 'Avg of Bid/Ask' (candle-based execution bounds: the bar's most / least
favourable price for the leg's side, or its (high+low)/2 mid; trades and
timestamps do not change, only fill prices, and % slippage still applies on
top) — the fill price field. The default was 'Close' until 2026-09-05 while the website's
Backtest dialog defaulted to 'Open', so the same template over the same
window returned -₹81,749.98 here against -₹86,830.01 on the website — a
5.9% difference the user never chose — passing Open explicitly
reproduced the website result to the paisa on all 165 days, so only the
default differed, never the engine. 'Close' is also the WRONG default on
the merits: a condition that triggers intra-bar then fills at that bar's
close has seen the whole minute first.
stop_check: 'close' (default) | 'high_low' — see the parameter description. Echoed
in applied_params; a high_low run is served only by Tradetron's fleet.
capital: starting capital (₹) for ROI/drawdown denominators.
candle_freq: candle cadence in MINUTES (e.g. 1, 5, 60).
tt_match: reproduce TT-BT lot conventions — use when comparing against a TT backtest.
oos_pct: IGNORED on a single run (a value other than 0 is reported back in
params_not_applied). Walk-forward comes with a parameter SWEEP, exactly as the
website offers it: use tt_backtest_sweep, whose oos_pct (default 30) gives every
variant an in-sample vs out-of-sample verdict.
Returns {ok, job_id, watch_url, status_url, note} (+ fidelity_caveat for strategy classes
still being parity-validated, e.g. repair/martingale; + billing when a charge applied).
A confirmation response's applied_params holds ONLY the settings this run applies —
read the run's settings to the user from that block alone. params_not_applied, when
present, names accepted knobs that have no effect; never quote one as a run setting.
On a validation/RCE-gate reject: {ok: False, error, findings} (any charge auto-refunded).
Tool call template
This tool declares no required parameters. Add optional parameters from the input schema as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {},
"name": "tt_backtest_strategy"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| end | No | YYYY-MM-DD. | |
| type | No | 'auto' (default) self-detects intraday vs positional; 'intraday' force-closes all positions at 15:30 daily, 'positional' carries overnight. Wrong type = wrong numbers. | auto |
| start | No | YYYY-MM-DD. | |
| capital | No | IGNORED since 2026-08-28 — this backtest runs on Tradetron's own engine with exactly the settings the website's Backtest form offers, and that form has no such field. Still accepted so open sessions do not fault; it has no effect. It never affected a fill in any case — it was only an ROI denominator. | |
| oos_pct | No | IGNORED since 2026-08-28 — this backtest runs on Tradetron's own engine with exactly the settings the website's Backtest form offers, and that form has no such field. Still accepted so open sessions do not fault; it has no effect. Walk-forward is offered on a parameter SWEEP, exactly as the website form offers it — use tt_backtest_sweep for it. | |
| template | No | ||
| tt_match | No | IGNORED since 2026-08-28 — this backtest runs on Tradetron's own engine with exactly the settings the website's Backtest form offers, and that form has no such field. Still accepted so open sessions do not fault; it has no effect. It asked the MCP's own engine to imitate Tradetron's fills; the run now executes ON Tradetron, which is the thing itself. | |
| stop_check | No | How Entry, Exit, Universal Exit and Repair conditions that compare a price with a fixed level (stop losses, targets, breakout entries) are checked on each candle. 'close' (default, the website's default too) checks the candle's close only, so a level the price wicked through inside the minute but closed back from does not fire. 'high_low' checks the candle's high and low: a stop or an entry on that instrument fills at its level (or at the open on a gap through it), and when one candle reaches both the stop and the target the stop is taken. A Stoploss keyword inside a repair still reads the close. Use 'high_low' when the user asks for stops, targets or breakout entries to respect intrabar highs and lows. | close |
| candle_freq | No | Candle cadence in MINUTES (e.g. 1, 5, 60). Default 1. | |
| strategy_id | No | ||
| trade_price | No | Fill-price field per candle. Default 'Open', which is what the website's Backtest dialog defaults to AND the honest choice: filling at a bar's CLOSE hands every price-triggered condition a full minute of look-ahead. Execution bounds (candle-based; no bid/ask history exists): 'Best price' fills each leg at the bar's most favourable price for its side (buy at the low, sell at the high), 'Worst price' at the least favourable, 'Avg of Bid/Ask' at the bar's mid (high+low)/2. Trades and timestamps are the same in every mode; only fill prices move. | Open |
| slippage_bps | No | IGNORED since 2026-08-28 — this backtest runs on Tradetron's own engine with exactly the settings the website's Backtest form offers, and that form has no such field. Still accepted so open sessions do not fault; it has no effect. Set brokerage and slippage in the cost lab on the report page instead — they apply there without re-running the backtest. | |
| confirm_charge | No | ||
| bt_type_confirmed | No | ||
| confirmation_token | No |