Skip to main content
Glama
btanaji

TradingView MCP

by btanaji

backtest_strategy

Read-only

Backtest trading strategies on historical data to generate institutional-grade metrics like trade logs and equity curves. Supports RSI, MACD, and more for stocks, crypto, forex.

Instructions

Backtest a trading strategy on historical data with institutional-grade metrics.

Args: symbol: Yahoo Finance symbol (AAPL, BTC-USD, THYAO.IS, ^GSPC) strategy: rsi | bollinger | macd | ema_cross | supertrend | donchian | rsi_pullback | keltner_breakout | triple_ema (rsi_pullback and triple_ema need period >= '1y' for SMA200 warmup) period: '1mo', '3mo', '6mo', '1y', '2y' initial_capital: Starting capital in USD (default $10,000) commission_pct: Per-trade commission % (default 0.1%) slippage_pct: Per-trade slippage % (default 0.05%) interval: '1d' (daily) or '1h' (hourly) include_trade_log: Include full per-trade log (default False) include_equity_curve: Include equity curve data points (default False)

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
periodNo1y
symbolYes
intervalNo1d
strategyYes
slippage_pctNo
commission_pctNo
initial_capitalNo
include_trade_logNo
include_equity_curveNo
Behavior4/5

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

Annotations already declare readOnlyHint=true and destructiveHint=false, so the safety profile is covered. The description adds valuable behavioral context: it lists strategy options, notes warmup requirements for specific strategies, and explains that include_trade_log and include_equity_curve control additional outputs. This goes beyond the schema and annotations.

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 efficiently structured: a one-sentence purpose statement followed by a clean list of arguments with defaults and inline constraints. Every line adds useful information, and the format is front-loaded with the tool's purpose.

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?

With 9 parameters and no output schema, the description covers all parameters and includes important constraints and examples. It mentions 'institutional-grade metrics' as the primary output, and the optional trade log/equity curve flags imply the default return shape. Missing return format details are a minor gap, but overall the description is complete enough for an agent to invoke the tool correctly.

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%, so the description must compensate. It does so by explaining every parameter: symbol format examples, allowed strategy values, period options, interval options, and the meaning of commission_pct, slippage_pct, and booleans for additional outputs. This adds meaning well beyond the schema's bare property listings.

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 states the tool's function clearly: 'Backtest a trading strategy on historical data with institutional-grade metrics.' It uses a specific verb (backtest) and resource (strategy on historical data). It distinguishes from siblings like compare_strategies and walk_forward_backtest_strategy primarily by the singular focus on one strategy, though it doesn't explicitly name alternatives.

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 performing a single-strategy backtest but provides no explicit guidance on when to choose this tool versus alternatives like compare_strategies or walk_forward_backtest_strategy. It does include parameter-level constraints (e.g., rsi_pullback and triple_ema need period >= '1y' for SMA200 warmup), which gives some context but not tool-selection guidance.

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/btanaji/tradingview-mcp'

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