Skip to main content
Glama

Backtest a strategy

backtest

Execute a strategy over historical data to generate performance metrics, trade list, and equity curve, along with model assumptions, for data-driven trading decisions.

Instructions

Runs a strategy over the history and returns metrics, the trade list and the equity curve. Signals fill at the next bar's open, costs are charged both sides, and a bar touching both stop and target counts as a stop. The assumptions come back with the result.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
barsNoHow many of the most recent bars to use.
symbolYesInstrument symbol, for example XAUUSD. Case-insensitive.
strategyYesStrategy definition.
timeframeNoBar size. Defaults to 1d.
riskPercentNoEquity risked per trade. Defaults to 1.
slippageBpsNo
commissionBpsNo
stopAtrMultipleNo
targetRMultipleNo

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv1.0.0

TDQS

A3.8/5.0
Behavior4/5

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

No annotations are provided, so the description carries the full disclosure burden. It discloses key execution assumptions: fills at next bar's open, costs charged both sides, a bar touching both stop and target counts as a stop, and assumptions returned with results. This goes beyond a generic 'runs a backtest.' It does not mention potential rate limits or data source details, but the essential behavioral traits are covered.

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

Conciseness5/5

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

Three sentences, each carrying distinct value: purpose/outputs, execution assumptions, and result contents. The most important information is front-loaded and there is no filler. This is an appropriate size for the tool's complexity.

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

Completeness4/5

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

For a tool with 9 parameters and a nested strategy object, the description plus schema cover the essentials: inputs are defined by the schema, and behavioral assumptions are clearly stated. Since there is no output schema, the mention of metrics, trade list, equity curve, and assumptions is valuable. Minor gaps remain around strategy variants, default values, and error behavior, but these are either in the schema or not critical for invocation.

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

Parameters3/5

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

Schema description coverage is 56%, leaving slippageBps, commissionBps, stopAtrMultiple, and targetRMultiple undocumented. The description partially compensates by explaining cost behavior ('costs are charged both sides') and stop/target ambiguity, which gives those parameters context. However, it does not map each parameter to its effect or indicate which are optional, so the gap is not fully closed.

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

Purpose4/5

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

The description opens with a specific verb and resource: 'Runs a strategy over the history' and enumerates concrete outputs (metrics, trade list, equity curve). This clearly distinguishes it from siblings like list_symbols or get_ohlc, though it does not explicitly name an alternative. The purpose is unambiguous.

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

Usage Guidelines3/5

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

The description implies usage for backtesting a strategy but provides no explicit when-to-use guidance or exclusions. It does not mention alternative tools or conditions where backtest would be inappropriate. With sibling tools serving clearly different purposes, the omission is minor but still leaves selection to inference.

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

Deploy Server

Other Tools