Skip to main content
Glama
dchumari
by dchumari

Run a Strategy Tester backtest

run_backtest

Simulate a compiled Expert Advisor on historical MT5 data via Strategy Tester to return parsed performance metrics without live trading or real orders.

Instructions

Runs a compiled EA through MetaTrader's Strategy Tester (a closed historical simulation - no live connection, no real orders) and returns parsed performance metrics. Requires the EA to already be compiled (call compile first). Requires an account login: the Strategy Tester refuses to start without one. Resolution order: the login argument, then MCP_MT5_LOGIN, then whichever account is currently saved/logged into this terminal (from common.ini) - so if you're already logged into a demo/live account with 'save password' checked, no login needs to be passed at all.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
loginNoMT5 account number; falls back to MCP_MT5_LOGIN
modelNo
periodYese.g. M15, H1, D1
symbolYes
toDateYesYYYY.MM.DD
depositNo
currencyNo
fromDateYesYYYY.MM.DD
leverageNoe.g. "1:100"
timeoutMsNo
expertPathYesRelative to Experts/, no extension, e.g. "Advisors/ExpertMACD"
executionModeNo

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.0

TDQS

A4/5.0
Behavior4/5

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

With no annotations, the description carries the full burden and does well on safety-critical behavior: it explicitly says no live connection and no real orders, and it explains that the Strategy Tester refuses to start without an account login. It does not disclose whether the test mutates terminal state or the meaning of timeoutMs, leaving some behavioral gaps.

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?

Front-loads what the tool does and follows with prerequisites and the login resolution chain, with no filler sentences. The login paragraph is dense but each detail (fallback order) is actionable rather than redundant.

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

Completeness3/5

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

For a 12-parameter tool with no output schema and no annotations, the description is reasonably complete on purpose and preconditions but leaves several input capabilities unexplained and only vaguely states it 'returns parsed performance metrics' without indicating which metrics. Adequate but with clear gaps for a tool of this complexity.

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 only 50%, so the description must compensate and largely does for login: it details the full resolution order (argument, MCP_MT5_LOGIN, then the account saved in common.ini) beyond the schema's terse fallback note. However, it adds nothing for model, deposit, currency, leverage, and executionMode, which remain undocumented.

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 (runs a compiled EA through MT5's Strategy Tester) and immediately bounds the scope as a closed historical simulation with no live connection and no real orders. This cleanly separates it from siblings like compile and get_journal.

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?

Gives a concrete prerequisite and routes the agent to the needed alternative: 'Requires the EA to already be compiled (call compile first).' It also flags the account-login requirement, but does not describe when this tool is a poor choice versus other tools beyond the compile dependency.

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