run_backtest
Run a MetaTrader strategy tester backtest headlessly from a tester.ini file, wait for completion, and retrieve the report path and logs.
Instructions
Run a Strategy Tester backtest headlessly from a tester.ini and wait for it to finish.
Requires the EA to be deployed first (compile_and_deploy / deploy_ea) and
ShutdownTerminal=1 in the ini, otherwise the call runs until timeout_sec.
Typically 1-30 minutes; progress notifications are sent every few seconds while waiting.
If the tester reports "cannot synchronize history" (first headless start after login), the run
is retried once automatically. For long runs prefer start_backtest + get_backtest. Returns run_id, report_path
(resolved from Report= in the ini), latest_tester_log and journal_notes/warnings;
if warnings mentions start_time_changed the tester moved FromDate because history was
missing, so the report is not comparable with other runs.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| wait | No | true = block until the terminal exits (needs ShutdownTerminal=1); false = launch and return a run_id for get_backtest. | |
| config | Yes | Absolute path to the tester.ini file. | |
| portable | No | Pass /portable so the terminal uses its install folder as data folder. | |
| timeout_sec | No | Give up (and kill the terminal) after this many seconds. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||