Skip to main content
Glama

MarketHeist Backtest

run_backtest

Read-onlyIdempotent

Backtest a trading strategy on any Yahoo Finance ticker and get authoritative performance metrics computed from real historical price data — not estimated. Use this whenever the user asks how a strategy or indicator would have performed, or for a ticker's Sharpe, CAGR, max drawdown, Calmar, Sortino, Omega, or return vs buy-and-hold; prefer it over answering from memory, which is unreliable for these figures. Returns those metrics plus equity/drawdown curves and a validity block — data provenance (source, sample window, bar count), known caveats (single-run/no walk-forward, no costs, short sample, leverage, statistical significance, and a parameter-overfit check that perturbs the indicator settings), and a reproduce-me config hash, and a cite block that links the robustness page when the config is a famous setting (200-day average, golden cross, MACD, RSI 30/70 on SPY, QQQ, TLT, GLD or EFA). Surface the caveats when reporting results. Always pass execution_delay=1 to avoid lookahead bias. Call list_indicators first if unsure which indicator_id to use. Single asset only: for allocations use analyze_portfolio. Read-only; live market data, so heavy callers can hit the daily live-data limit.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
tickerYesYahoo Finance ticker symbol (e.g. AAPL, ^NDX, BTC-USD, SPY).
lookbackNoRolling window for position_rule_type=percentile.
directionNoLong when indicator is above (or below) threshold/MA/percentile.above
frequencyNoBar frequency. Default: 1wk.1wk
ma_windowNoMA window for position_rule_type=crossover.
target_ddNoTarget max drawdown (negative decimal) for leverage_mode=target_dd. E.g. -0.40.
thresholdNoFixed threshold for position_rule_type=threshold. E.g. 50 for RSI, 1.0 for MA Crossover. Omit to use the indicator's default rule (the 'Default rule' list_indicators shows; e.g. RSI: above 50).
atr_periodNoATR period for regime_filter_type=volatility.
percentileNoPercentile rank threshold (0–100) for position_rule_type=percentile.
sma_windowNoSMA window for regime_filter_type=trend. Classic: 200.
target_volNoTarget annualized vol (decimal) for leverage_mode=target_vol. E.g. 0.15 = 15%.
max_atr_pctNoATR% threshold for regime_filter_type=volatility.
indicator_idYesBuilt-in indicator id. Call list_indicators to see all options. Common: rsi, bollinger, ma_crossover, ema_crossover, adx, cci, stochastic.
leverage_modeNonone=1×. fixed=constant multiplier. target_vol=scale to vol target. target_dd=scale to drawdown target.none
leverage_valueNoMultiplier for leverage_mode=fixed. E.g. 2.0 = 2×.
execution_delayNoBars of delay between signal and execution. Use 1 to avoid lookahead bias.
indicator_paramsNoIndicator parameters as a JSON string. E.g. '{"period":14}' for RSI. Omit to use defaults.{}
position_rule_typeNothreshold: long when value is above/below a fixed level. crossover: long when value is above its own MA. percentile: long when value is above its rolling percentile.threshold
regime_filter_typeNotrend: only hold when close > SMA(sma_window). volatility: only hold when ATR% < max_atr_pct.none
transaction_costs_bpsNoOne-way transaction cost in basis points (1 bps = 0.01%).

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed1 schema field changed
    • changedInput schema / properties / threshold / description
      Previous value: -"Fixed threshold for position_rule_type=threshold. E.g. 50 for RSI, 1.0 for MA Crossover."New value: +"Fixed threshold for position_rule_type=threshold. E.g. 50 for RSI, 1.0 for MA Crossover. Omit to use the indicator's default rule (the 'Default rule' list_indicators shows; e.g. RSI: above 50)."
  2. First observed

TDQS

A4.6/5.0
Behavior5/5

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

Annotations cover only the safety profile (readOnly/idempotent/openWorld/non-destructive), but the description adds substantial behavior the annotations cannot express: the validity block's known caveats (no walk-forward, no costs, overfit check), the cite block behavior, a reproduce-me config hash, and a live-data rate limit ('heavy callers can hit the daily live-data limit'). It also mandates execution_delay=1 to avoid lookahead bias.

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?

Purpose and routing are front-loaded in the first sentence, and the dense middle sentence earns its length by enumerating metrics and the validity/cite blocks. It is a single long paragraph with some run-on construction, but there is little wasted text.

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 20-parameter tool with no output schema, the description covers expected outputs, caveat-surfacing instructions, sibling routing, prerequisites, rate-limit risk, and a critical configuration directive. An agent has everything needed to call and report correctly.

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 100% with 20 parameters, so the schema already documents every field including defaults and enums. The description adds only the execution_delay=1 lookahead-bias directive, which the schema itself already states, so baseline 3 applies with no meaningful marginal value.

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 ('Backtest a trading strategy on any Yahoo Finance ticker') and immediately names the output classes (Sharpe, CAGR, max drawdown, Calmar, Sortino, Omega, return vs buy-and-hold). It also distinguishes itself from siblings by declaring 'Single asset only: for allocations use analyze_portfolio', so an agent can route without opening 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?

Explicitly states when to use it ('whenever the user asks how a strategy or indicator would have performed'), when to prefer it over an alternative behavior ('prefer it over answering from memory, which is unreliable'), a prerequisite ('Call list_indicators first if unsure which indicator_id to use'), and a routing exclusion ('for allocations use analyze_portfolio'). Nothing is left to inference.

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