Run a Strategy Tester backtest
run_backtestSimulate 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
| Name | Required | Description | Default |
|---|---|---|---|
| login | No | MT5 account number; falls back to MCP_MT5_LOGIN | |
| model | No | ||
| period | Yes | e.g. M15, H1, D1 | |
| symbol | Yes | ||
| toDate | Yes | YYYY.MM.DD | |
| deposit | No | ||
| currency | No | ||
| fromDate | Yes | YYYY.MM.DD | |
| leverage | No | e.g. "1:100" | |
| timeoutMs | No | ||
| expertPath | Yes | Relative to Experts/, no extension, e.g. "Advisors/ExpertMACD" | |
| executionMode | No |