Skip to main content
Glama

backtest_strategy

Test a Simple Moving Average crossover strategy by simulating trades based on SMA crossovers, comparing results against buy-and-hold performance for informed investment decisions.

Instructions

Backtest a Simple Moving Average (SMA) crossover strategy. [PRO]

Tests: Buy when short SMA crosses above long SMA, sell when it crosses below. Compares strategy return vs buy-and-hold.

Args: symbol: Stock ticker (e.g., RELIANCE, AAPL, TCS) short_window: Short SMA period in days (default: 20) long_window: Long SMA period in days (default: 50) period: Backtest period: 1y, 2y, 5y (default: 2y) initial_capital: Starting capital (default: 100000)

Examples: backtest_strategy("RELIANCE") → Default 20/50 SMA backtest backtest_strategy("AAPL", 10, 30, "5y") → Custom 10/30 SMA, 5 years backtest_strategy("TCS", 50, 200, "5y", 500000) → Golden cross, 5L capital

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
symbolYes
short_windowNo
long_windowNo
periodNo2y
initial_capitalNo

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes
Behavior3/5

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

With no annotations provided, the description carries the full burden. It excellently discloses the calculation methodology (entry/exit logic, benchmark comparison) but omits operational traits: it doesn't state whether the operation is read-only, if results are cached, potential error modes (e.g., invalid symbol), or computational intensity. It implies idempotency via 'backtest' but doesn't confirm statelessness.

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?

Structure is optimally front-loaded: strategy purpose → logic explanation → parameter reference → concrete examples. Every element serves a purpose; even the [PRO] tag signals feature tier. No redundant text despite containing 5 parameter descriptions and 3 examples in a compact format.

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 5 parameters with complex financial logic and existence of an output schema (not shown), the description is complete. It defines the strategy mechanics so the agent understands what calculations occur, documents all inputs (compensating for schema gaps), and relies on the output schema for return structure. Appropriately scoped for complexity.

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 description coverage is 0% (properties lack descriptions), but the description fully compensates by documenting all 5 parameters with units (days), valid values (1y, 2y, 5y for period), purpose (starting capital), and format examples (RELIANCE, AAPL). The Args section and examples provide complete semantic meaning beyond the bare schema types.

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?

Description explicitly states the tool 'Backtest[s] a Simple Moving Average (SMA) crossover strategy' and details the specific logic (buy on cross above, sell on cross below). It distinguishes from siblings (mostly data retrieval tools like stock_quote or technical_indicators) by specifying this is a simulation/comparison tool against buy-and-hold.

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?

The description explains the specific use case (testing SMA crossover strategies) and provides three progressive examples showing default usage, custom windows, and 'golden cross' configurations. However, it lacks explicit guidance on when NOT to use it (e.g., for intraday testing) or comparison to siblings like technical_indicators.

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/finstacklabs/finstack-mcp'

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