Skip to main content
Glama

backtest_strategy

Backtest a trading strategy on historical data for any symbol, with custom parameters, fees, and slippage, to evaluate its real edge against buy-and-hold.

Instructions

Backtest one strategy on one instrument.

Args: symbol: Ticker (BTC, AAPL, BBCA). strategy: Strategy name from list_strategies. market: "crypto", "stock" or "idx". interval: Candle size (15m, 30m, 1h, 4h crypto-only, 1d, 1w). bars: Candles to test over (30-1500). params: Strategy parameter overrides, e.g. {"period": 21}. fee_bps: Round-trip fee in basis points per position change. slippage_bps: Assumed slippage in basis points per position change. include_trades: Return the full trade log as well as the metrics.

Signals are acted on at the next bar, so results contain no look-ahead. Always compare total_return_pct against buy_and_hold_return_pct — beating a flat market is not an edge.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
barsNo
marketNocrypto
paramsNo
symbolYes
fee_bpsNo
intervalNo1d
strategyYes
slippage_bpsNo
include_tradesNo

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Behavior4/5

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

With no annotations, the description carries full burden. It discloses a key behavioral trait: 'Signals are acted on at the *next* bar, so results contain no look-ahead.' It also provides interpretive guidance on comparing total_return_pct against buy_and_hold_return_pct to avoid misreading results. This exceeds the base requirement but does not cover every possible trait (e.g., cost model specifics).

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?

The description is well-structured: a one-sentence purpose, an Args list, then a behavioral note. No wasted words; every line adds value. The key information is front-loaded.

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?

Given the output schema exists, the description need not explain return values. It fully covers parameter semantics, the critical look-ahead behavior, and how to interpret results. It is complete for an agent to select and invoke correctly, and to understand the output's meaning.

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?

The input schema has zero description coverage, but the description compensates fully with an Args block that explains all 9 parameters, including valid values (e.g., interval examples, bars range, fee_bps units). This is exactly what the schema lacks.

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?

The description opens with 'Backtest one strategy on one instrument,' which is a specific verb+resource+scope. It clearly distinguishes from siblings like compare_strategies and walk_forward_backtest by emphasizing single strategy/single instrument.

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

Usage Guidelines4/5

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

It provides context that this tool is for a single strategy/instrument and references list_strategies as a source for valid strategy names. However, it does not explicitly mention alternatives like compare_strategies for multiple strategies or walk_forward_backtest for walk-forward analysis, so usage guidance is implied rather than fully explicit.

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

Install Server

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/kumaraprayoga68-sketch/market-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server