Skip to main content
Glama

Run Backtest

tt_backtest_strategy
Destructive

Submit 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

NameRequiredDescriptionDefault
endNoYYYY-MM-DD.
typeNo'auto' (default) self-detects intraday vs positional; 'intraday' force-closes all positions at 15:30 daily, 'positional' carries overnight. Wrong type = wrong numbers.auto
startNoYYYY-MM-DD.
capitalNoIGNORED 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_pctNoIGNORED 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.
templateNo
tt_matchNoIGNORED 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_checkNoHow 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_freqNoCandle cadence in MINUTES (e.g. 1, 5, 60). Default 1.
strategy_idNo
trade_priceNoFill-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_bpsNoIGNORED 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_chargeNo
bt_type_confirmedNo
confirmation_tokenNo

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observed

TDQS

A4.8/5.0
Behavior5/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

Annotations declare destructiveHint=true and openWorldHint=true, but the description supplies the operational detail behind that: wallet debiting, per-run auto-refund on failure, one-time 15-minute confirmation tokens, and typed refusal codes (BT_WINDOW_TOO_RECENT, BT_TYPE_CONFIRMATION_REQUIRED, BT_CONFIRM_CHARGE) with the exact response shape for each. It also documents the 35-day data lag and 5-year window cap, which the annotations cannot express.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness3/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Front-loading is good — purpose and return shape land in sentence one, and labelled BILLING/Args/Returns sections aid scanning. But it runs very long, restates schema-level ignores (capital, oos_pct, slippage_bps, tt_match) that the input schema already explains in near-identical wording, and spends a full digression on the -₹81,749.98 vs -₹86,830.01 default discrepancy that could be one clause. Several sentences earn their place; several are duplication.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness5/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a 15-parameter, chargeable, destructive submission tool with no output schema, it covers everything an agent needs: return fields {ok, job_id, watch_url, status_url, note}, how to present report_url vs watch_url, applied_params vs params_not_applied handling, and the failure shape {ok: False, error, findings}. Nothing material is left for the agent to infer.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters5/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Well past the schema's 67% coverage: it states the exactly-one-of template/strategy_id contract, the end-is-exclusive and 35-day/5-year rules, the type confirmation protocol with bt_type_confirmed semantics, the confirmation_token replay behavior, and which knobs (capital, oos_pct, tt_match, slippage_bps) are accepted but inert with params_not_applied reporting. The schema alone would leave several of these ambiguous.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

Opens with a specific verb+resource+scope: 'Submit a backtest of a strategy on real historical option prices; returns a job id to poll.' It explicitly distinguishes itself from tt_create_strategy (create first), tt_backtest_status (poll the job), tt_list_my_strategies (resolve a name), and tt_backtest_sweep (walk-forward). An agent can route without opening any schema.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines5/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Gives explicit when-to-use routing for every ambiguous input: a plain-English description is not an argument (call tt_create_strategy first), a strategy name must be resolved via tt_list_my_strategies(q=<name>), and oos_pct belongs to tt_backtest_sweep. It also states when NOT to submit (type confirmation pending, charge not confirmed) and what to ask the user rather than guessing.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Try in Browser

Glama MCP Gateway

Add one secure layer between your agents and this server.

Resources