Skip to main content
Glama

Backtest Parameter Sweep

tt_backtest_sweep
Destructive

Sweep ONE strategy parameter across a grid on Tradetron's own backtest fleet — a run per value; returns a job id, and the report link comes from the status poll. Use to answer "which entry time / strike offset / SL is best?" without hand-editing and re-submitting N backtests.

SINGLE-AXIS ONLY: one search variable, N values. It is NOT a multi-parameter grid — to explore a second parameter, run a second sweep.

BILLING (when enabled server-side): a sweep is charged PER VARIANT — every value in values is one engine run debited at the per-run backtest fee from the user's Tradetron WALLET, so N values cost N x the per-run fee (e.g. 5 values = 5 x the fee). The same consent gate as tt_backtest_strategy applies: a chargeable sweep first returns {code: BT_CONFIRM_CHARGE, price, wallet_balance} with the TOTAL price for all variants and submits NOTHING — relay the exact amount and the variant count to the user, and only after they agree re-call with the SAME arguments plus confirm_charge=true. A rejected or failed sweep is auto-refunded. A successful submit carries {billing: {charged, variants, rate, wallet_balance}} — mention the total charge in one short sentence, never as a surprise.

Args: confirm_charge: set True ONLY after the user has been told the exact total fee (per-variant fee x number of values) and agreed to it. Never set it on your own initiative. template: the strategy object (with a 'sets' array), passed INLINE. Unlike tt_backtest_strategy, this tool has NO strategy_id parameter: for a strategy already saved in the user's account, call tt_get_strategy(strategy_id) first and pass its data.strategy here as template. Fetching also carries the template's id, and that id is what the fleet sweeps. A hand-built inline template has no id, so it is REFUSED uncharged ("isn't saved in your Tradetron account") — save it with tt_create_strategy, re-fetch it with tt_get_strategy, and sweep THAT object. The refusal says "backtest by strategy_id" because it is shared with the backtest tools that take one; here it means that round-trip. start, end: 'YYYY-MM-DD' window; on NSE/NFO/BFO end must be at least 35 days before today, elsewhere yesterday (BT_WINDOW_TOO_RECENT otherwise, refused before any charge). type / trade_price / capital / candle_freq / slippage_bps / tt_match: identical meaning to tt_backtest_strategy. search: a parameter of THIS strategy to vary — e.g. an entry time "0930", a strike offset, an SL number. Tradetron validates it server-side against the strategy's own parameters, and does so on the routing check, so a name the strategy does not carry is refused FREE and BEFORE the price question, quoting Tradetron's own sentence ("'X' is not a parameter of this strategy. Pick one from the list."). That arrives as {ok: False, error} — take the list it names and re-call. It is NOT a fuzzy substring match over the template JSON. values: the grid to try — 2 to 10 strings (hard limits; validated here before submit). One sequential engine run per value. oos_pct: per-variant WALK-FORWARD fold, default 30 (the service clamps 10–50), so each variant is judged in-sample vs out-of-sample — pick by IS, judge by OOS. name: optional label for the run; defaults to the template name. stop_check: 'close' (default) | 'high_low', the same as tt_backtest_strategy. Every variant is run with it. A high_low sweep runs only on Tradetron's fleet; it is never sent to the fallback engine.

TIMING: variants run SEQUENTIALLY, ~300s each, so a 10-value intraday sweep can take many minutes. This is submit-and-watch — open watch_url for progress; it is never synchronous. A sweep counts as ONE inflight job; our single source IP allows max 4 concurrent backtests total (shared across all MCP backtest tools).

RESULTS: poll with tt_backtest_status. The per-variant ranking currently renders in the HTML report (report_url in the status). A machine-readable per-variant summary is being added service-side; once live, tt_backtest_status will also carry structured per-variant results in its summary — this tool passes through whatever summary/results the status returns and does not require them to be present yet.

Returns {ok, job_id, watch_url, status_url, state, note} (+ fidelity_caveat as tt_backtest_strategy). On a bad search / validation reject: {ok: False, error, findings}.

Tool call template

Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {
      "template": "<template>",
      "start": "<start>",
      "end": "<end>",
      "search": "<search>",
      "values": "<values>"
    },
    "name": "tt_backtest_sweep"
  }
}

Input Schema

NameRequiredDescriptionDefault
endYes
nameNo
typeNo'intraday' force-closes all positions at 15:30 daily, 'positional' carries overnight. Wrong type = wrong numbers.positional
startYes
searchYes
valuesYes
capitalNo
oos_pctNo
templateYes
tt_matchNoReproduce TT-BT lot conventions — set True only for parity runs against a Tradetron backtest. Default False.
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.
trade_priceNoFill-price field per candle. Default 'Open', matching the website's Backtest dialog and tt_backtest_strategy — a 'Close' fill hands every price-triggered condition a minute of look-ahead, and it would make this sweep's baseline incomparable with a single run.Open
slippage_bpsNoSlippage in basis points applied per fill. Default 0 (no slippage modelled).
confirm_chargeNo

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observed

TDQS

A4.9/5.0
Behavior5/5

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

Far beyond the annotations: discloses per-variant billing with a consent gate flow (BT_CONFIRM_CHARGE, confirm_charge=true on re-call), auto-refund on failure, the saved-strategy id requirement and its refusal message, sequential ~300s per variant, the 4-concurrent-job IP cap, and the 35-day NSE/NFO/BFO end-date rule. Annotations (destructiveHint=true, openWorldHint=true) are consistent with the described charging/side effects.

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

Conciseness4/5

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

Well structured with labeled sections (BILLING, TIMING, RESULTS, Args) and front-loads the core purpose. Some passages are verbose — notably the RESULTS paragraph about a not-yet-live machine-readable summary — and could be tightened without losing information.

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 complex, chargeable, asynchronous 15-param tool with no output schema, the description covers the full lifecycle: prerequisite lookup, validation/refusal paths, cost consent, timing, polling, and the exact return shape {ok, job_id, watch_url, status_url, state, note}.

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?

Schema coverage is only 40% across 15 params, but the description compensates heavily: it explains that there is no strategy_id (template must come inline from tt_get_strategy), constrains values to 2–10 strings, explains search validation semantics ('NOT a fuzzy substring match'), oos_pct clamping to 10–50, stop_check fleet-only behavior for high_low, and window rules for start/end.

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?

States a specific verb and resource with scope: 'Sweep ONE strategy parameter across a grid on Tradetron's own backtest fleet — a run per value'. It explicitly separates itself from a multi-parameter grid and from single-run backtests, so an agent can distinguish it from siblings like tt_backtest_strategy without reading schemas.

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 ('which entry time / strike offset / SL is best?'), when-not ('It is NOT a multi-parameter grid — to explore a second parameter, run a second sweep'), and names the required alternatives/workflow: tt_get_strategy first, tt_create_strategy for unsaved templates, tt_backtest_status for polling.

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