feat: keep MT5 open after backtest; pass config to running instance
Default behavior change: - ShutdownTerminal=0: MT5 stays open after backtest completes - Report detected via file watching (poll every 5s) instead of waiting for process exit — decouples completion from shutdown - Running MT5 instance: launch a second terminal64.exe with /config: (Windows single-instance passthrough delivers config to running window without killing it, then second instance exits) New flags (script + MCP tool): - --shutdown / shutdown:true — ShutdownTerminal=1, synchronous wait, kills running instance first (CI/headless use case) - --kill-existing / kill_existing:true — explicit opt-in to SIGTERM existing MT5 before launch (fallback if passthrough fails) Progress reporting during file-watch poll (elapsed counter printed every 5s); timeout error now includes actionable hints. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -334,6 +334,14 @@ async def list_tools() -> list[types.Tool]:
|
||||
"type": "integer",
|
||||
"description": "Backtest timeout in seconds (default: 900)"
|
||||
},
|
||||
"shutdown": {
|
||||
"type": "boolean",
|
||||
"description": "Close MT5 after backtest completes. Default: false — MT5 stays open and report is detected via file watching. Set true for CI/headless environments."
|
||||
},
|
||||
"kill_existing": {
|
||||
"type": "boolean",
|
||||
"description": "Kill a running MT5 instance before launching. Default: false — passes config to the running instance (MT5 single-instance passthrough). Set true if passthrough does not work on your Wine setup."
|
||||
},
|
||||
},
|
||||
},
|
||||
),
|
||||
@@ -1090,6 +1098,10 @@ async def handle_run_backtest(args: dict) -> dict:
|
||||
cmd.append('--deep')
|
||||
if args.get('gui'):
|
||||
cmd.append('--gui')
|
||||
if args.get('shutdown'):
|
||||
cmd.append('--shutdown')
|
||||
if args.get('kill_existing'):
|
||||
cmd.append('--kill-existing')
|
||||
|
||||
timeout = args.get('timeout', 900)
|
||||
success, output = run_script(cmd, timeout=timeout)
|
||||
|
||||
Reference in New Issue
Block a user