mt5-robot-tester
tradermonty/claude-trading-skills
Batch-test and optimize MetaTrader 5 Expert Advisors through a 3-round pipeline to select the best performers.
What is mt5-robot-tester?
Automates screening and optimization of MT5 trading robots (Expert Advisors) by running the Strategy Tester headless through three rounds: symbol screening, best-pair analysis, and sequential parameter optimization. Use this when you need to evaluate multiple EAs across all trading pairs, optimize their inputs, and identify finalists based on profit, drawdown, and consistency metrics.
- Batch-test EAs across all configured symbols in Round 1 to screen for profitability (≥5 symbols profitable, best symbol ≥3× deposit)
- Analyze the best-performing symbol in Round 2, measuring profit %, drawdown %, positive months, LR correlation, and equity-curve stability
- Sequentially optimize 5–6 EA parameters in Round 3 (±50% range, step 5%) while learning parameter impact across runs
- Move tested bots through folders (candidates → in-testing → finalists) with checkpointing and resumable execution
- Generate leaderboards (JSON/Markdown) and learnings.json to track parameter impact and symbol priors across loops
- Support optional HTML dashboard for monitoring bot phases, verdicts, and live logs without CLI
How to install mt5-robot-tester
npx skills add https://github.com/tradermonty/claude-trading-skills --skill mt5-robot-tester- Windows OS with MetaTrader 5 installed (runs terminal64.exe headless)
- Broker tick data downloaded in MT5 (default modeling uses real ticks, Model=4)
- Three folders created under MQL5/Experts: candidates, in-testing, finalists
- Configuration file (JSON) with folder paths, common.symbols list, and optional terminal_path
- Python 3.9+ (standard library only; no external dependencies)
- MetaTrader 5 closed before running (tester requires exclusive data folder access)
How to use mt5-robot-tester
- 1.Copy assets/pipeline_config.template.json and fill in your three folder paths, symbol list (e.g., EURUSD, GBPUSD), and optional terminal_path
- 2.(Optional) Run a dry-run with --dry-run flag to verify generated Round-1 INI files without launching MT5
- 3.Execute the pipeline: python3 scripts/mt5_batch_tester.py --config my_config.json --output-dir reports/mt5_pipeline
- 4.Monitor progress via state.json and run.log; each bot advances through R1 → R2 → R3 → finalist decision
- 5.If interrupted, resume with --resume flag to skip completed bots and reuse finished rounds (fingerprint-matched)
- 6.(Optional) Launch the HTML dashboard (python3 scripts/dashboard.py) to see bot phases, verdicts, and live logs at http://127.0.0.1:8765/
- 7.Review leaderboard_<ts>.json/md for ranked finalists and learnings.json for parameter impact insights
Use cases
- Screen a folder of 10+ Expert Advisors and identify the 2–3 best performers across EURUSD, GBPUSD, USDJPY, and other pairs
- Optimize EA input parameters (e.g., period, threshold, risk %) to improve profit while keeping drawdown under 12%
- Resume an interrupted multi-day testing run without re-running completed rounds
- Compare EA performance consistency: positive months, all-years-positive, and months-to-new-high metrics
- Accumulate learnings across multiple testing loops to prioritize high-impact parameters first in future runs
- Algorithmic traders and EA developers evaluating multiple Expert Advisors
- Quantitative analysts optimizing trading bot parameters before live deployment
- MetaTrader 5 users managing a portfolio of candidate strategies
- Traders seeking data-driven selection criteria (profit, drawdown, consistency) rather than manual backtesting
mt5-robot-tester FAQ
It is moved to the in-testing folder and not advanced to Round 2 or 3. Round 1 gates require ≥5 symbols profitable and best symbol profit ≥3× deposit.
Yes. Use --resume flag; it skips completed bots and reuses finished rounds only if the execution config, EA binary, and input .set fingerprints match. Changed period, symbols, binary, or .set restarts that bot safely.
Optional. If provided, they set the baseline for Round 2 and define which inputs to optimize in Round 3. Without a .set, Round 3 is skipped and the verdict comes from Round 2 alone.
Depends on symbol count, EA count, and tick-data volume. Real ticks (Model=4) are slow; expect hours to days for 10+ EAs across 6+ symbols. Checkpointing allows resumable runs.
Round 3 result must improve on Round 2, profit ≥4× deposit, and worst drawdown ≤12%. Round 2 reference thresholds (net profit ≥300%, DD <15%, positive months >70%, LR ≥0.80) are reported but not hard gates.
Full instructions (SKILL.md)
Source of truth, from tradermonty/claude-trading-skills.
name: mt5-robot-tester description: Select the best MetaTrader 5 trading robots (Expert Advisors) that have not been backtested yet, by running the MT5 Strategy Tester from the command line through a 3-round pipeline. Use when the user wants to batch-test MT5 bots/EAs, screen robots across all symbols, optimize EA parameters, or move candidate bots to finalists based on profit, drawdown, positive months/years and equity-curve criteria. Runs terminal64.exe headless; Windows + MetaTrader 5 required at run time.
MT5 Robot Tester
Overview
Select the best MetaTrader 5 robots (Expert Advisors) from a candidates folder by driving the Strategy Tester from the command line through a 3-round pipeline, moving each bot between folders as it advances, and learning across runs to improve selection each loop. The whole run is checkpointed and resumable.
- Round 1 — screening (all pairs): backtest the EA on each symbol in the
configured
common.symbolslist (oneOptimization=0backtest per symbol — MT5 build 6061 leaves theOptimization=3XML empty, so per-symbol backtests are used). Gate: ≥5 symbols profitable AND best symbol ≥3× deposit. - Round 2 — best-pair backtest: single backtest on the best symbol; analyze net profit %, worst drawdown %, % positive months, all-years-positive, LR Correlation, months-to-new-high.
- Round 3 — sequential parameter optimization: optimize the 5–6 inputs after
MagicNumber, one at a time, range ±50% step 5%; then a final backtest. - Finalist: optimized result improves on Round 2 and profit ≥4× deposit and worst drawdown ≤12%.
Tested bots move to in-testing; finalists are also copied to finalists with
their optimized .set.
When to Use
- "Prueba robots / bots / EAs en MetaTrader 5."
- Screen a folder of MT5 Expert Advisors and pick the best across all pairs.
- Optimize EA parameters and decide finalists by profit/drawdown/consistency.
- Resume an interrupted testing run.
Prerequisites
- Windows + MetaTrader 5 installed (the tester runs
terminal64.exe). - Broker tick data downloaded (default modeling is real ticks,
Model=4). - The three folders under
MQL5\Experts: candidates, in-testing, finalists. common.symbolsset in the config — the pairs Round 1 backtests (your Market Watch symbols).- Optional per-bot
.setfiles (configsets_dir) for the Round-2 baseline and Round-3 parameter optimization. Every input is fixed during optimization except the one parameter currently being searched; without a.set, Round 3 is skipped and the verdict comes from Round 2. - Close MetaTrader 5 before running — the tester needs exclusive use of the data folder.
- Python 3.9+ (standard library only). No paid API.
Workflow
Step 1 — Configure
Copy assets/pipeline_config.template.json, fill in the three folder paths and
(optionally) terminal_path. Never commit real personal paths — pass the config
at run time. Defaults already encode the agreed settings (2020.01.01→2026.06.30,
H1, Model=4, 10000 USD, 1:100, gates and thresholds).
Step 2 — Dry-run (optional)
Verify the generated Round-1 INIs without launching MT5:
python3 skills/mt5-robot-tester/scripts/mt5_batch_tester.py \
--config my_config.json --output-dir reports/mt5_pipeline --dry-run
Step 3 — Run the pipeline
python3 skills/mt5-robot-tester/scripts/mt5_batch_tester.py \
--config my_config.json --output-dir reports/mt5_pipeline
Each bot flows R1 → R2 → R3 → finalist decision. Progress is written to
state.json and run.log after every step.
Step 4 — Resume if interrupted
python3 skills/mt5-robot-tester/scripts/mt5_batch_tester.py \
--config my_config.json --output-dir reports/mt5_pipeline --resume
--resume skips completed bots and reuses finished rounds only while the
execution config, EA binary, and input .set fingerprints still match. A
changed period, symbol list, binary, or .set restarts that bot safely.
Optional — HTML control panel
Launch a local dashboard to see the bots in each folder, each bot's phase and verdict, and a Launch button — no CLI needed after starting it:
python3 skills/mt5-robot-tester/scripts/dashboard.py \
--config my_config.json --output-dir reports/mt5_pipeline
It serves http://127.0.0.1:8765/ (opens automatically, localhost only). The
page auto-refreshes every 3 s: folder contents, per-bot phase (R1/R2/R3/done),
pass/fail verdicts, summary counts, and the live run.log. Start/stop requests
are limited to the exact local origin and require the per-server CSRF token.
Step 5 — Read the results
leaderboard_<ts>.md/.json— ranking with verdict and key metrics.learnings.json/learnings.md— what the skill learned this loop (parameter impact and symbol priors) under the configured output directory.mt5_reports/andmt5_ini/— raw MT5 reports and configs per bot/round.
Round details
Round 1 gate (both required)
count_positive_profit(passes) ≥ round1_min_positive(default 5).best_symbol_profit ≥ round1_min_profit_multiple × deposit(default 3×).
Fail → bot rejected (moved to in-testing).
Round 2 quality profile (reference thresholds)
Net profit ≥300%, worst DD <15% (larger of balance/equity %), positive months
70%, all years positive, LR Correlation ≥0.80, months-to-new-high ≤3. Reported per bot; the hard finalist gate is Round 3.
Round 3 sequential optimization
For each of the 5–6 inputs after MagicNumber (learned order first), optimize
that single parameter over [V×0.5, V×1.5] step V×0.05 (Optimization=1)
while fixing every other .set input, fix its best value, then continue. Run a
final backtest with the exact complete input set saved for a finalist.
Finalist
evaluate_finalist: improved on Round 2 and profit ≥4× deposit and worst
DD ≤12%. → copied to finalists with <bot>.set.
Self-learning across loops
learnings.json accumulates, per run: parameter average profit improvement
(reorders Round-3 optimization so the most impactful parameters are tried first),
symbol priors (how often each is a best pair), and per-bot verdicts. This makes
selection converge faster each loop. Deterministic — plain aggregate statistics.
Output Format
leaderboard_<ts>.json— list of{name, verdict, best_symbol, r2_profit, final_profit, final_dd_pct, lr, reason}sorted finalists-first by profit.leaderboard_<ts>.md— same as a table.state.json— resumable per-bot/per-round checkpoint.
Resources
scripts/mt5_batch_tester.py— pipeline orchestrator + INI builders (CLI).scripts/parse_mt5_optimization.py— optimization report (XML/HTML) parser + Round-1 gate.scripts/parse_mt5_report.py— backtest report parser + balance-series metrics.scripts/mt5_learnings.py— cross-run learning store.scripts/mt5_common.py— shared parsing helpers (EN/ES headers, numbers).references/mt5-cli-reference.md— MT5[Tester]/[TesterInputs]keys, enums, report formats and caveats.assets/pipeline_config.template.json— config template with placeholders.
Key Principles
- Never commit personal paths — folders/terminal come from config/ENV/args.
- Relative
Report=names because build 6061 ignores absolute report paths; collect completed reports from the terminal data directory. - Real ticks (
Model=4) need broker tick data; it is slow — expect long runs. - Resumable: every round checkpoints;
--resumereuses only fingerprint- matching work and retries execution errors. - Fail closed: incomplete, timed-out, stale, or unparsable reports never reject, promote, or move a candidate. Every unique Round-1 symbol must finish.
- Single MT5 owner: an OS lock is held for the process lifetime for each
shared MT5 data folder. If child termination cannot be confirmed, the whole
run stops and writes a
.blockedmarker; verify the recorded PID/process tree has exited before removing that marker manually. - Full-period metrics: months without deals at the start, end, or across a full year remain part of the configured test period.
- Learn each loop: parameter/symbol statistics bias future runs toward wins.
- Verify against your build: report layout (esp. the deals table) and the 32 ms delay mapping can differ — see the reference's (verify) notes.
Related skills
More from tradermonty/claude-trading-skills and the wider catalog.

news-reaction-failure-analyzer
Confirm whether a crowded market failed to react to favorable news using statistically validated drift analysis.

options-strategy-advisor
Analyze options strategies with Black-Scholes pricing, Greeks, and P/L simulation for education and risk management.

pair-trade-screener
Identify statistical arbitrage opportunities by detecting cointegrated stock pairs and analyzing mean-reversion spreads.

parabolic-short-trade-planner
Screen US equities for parabolic exhaustion patterns and generate conditional pre-market short plans with intraday trigger detection.

pead-screener
Screen post-earnings gap-up stocks for PEAD patterns using weekly candle analysis.

portfolio-manager
Analyze and rebalance investment portfolios using real-time Alpaca brokerage data.