MCP: Build 6140: tester_run_backtest ignores Report= in the tester .ini - page 2

jacek_mql #:
[W]hen backtests are run via MCP, the logs in Tester\logs and Tester\agent-..\logs are empty files.

Whoa. That was unexpected.

As Alain subsequently replied, I'm sure that the MQ Developers will deem it a bug to be fixed.

Thank you Alain.  Looking forward to having it being addressed by MQ.

Two more .ini-related things from the same MCP path, in case they help
others. The first one is verifiable; the second I can only report, not
prove, and I say which is which.

1. THE RUN USES WHATEVER .SET FILE IT FINDS ON DISK, AS IS.

My first MCP-driven backtest silently started from an existing
<EAname>.set left in MQL5\Profiles\Tester from an earlier session. That
file still had a filter enabled which I had tested and rejected weeks
before, so the run measured a configuration I had not asked for.

Nothing in the MCP response says which parameter file was used, and the
report looks completely normal. I only noticed because the number of
operations did not match what I expected.

What I do now: state every parameter explicitly in the request instead of
letting it pick the file up, and ask the assistant to echo back the values
the tester actually applied. If the echo does not match the request, the
run is discarded.

2. CHECK THE LEVERAGE IN THE GENERATED .INI - reported, not proven.

On my first run the leverage in the generated .ini was not the one my
account uses, and margin during the test was therefore far more optimistic
than reality. I no longer have that file - it was overwritten by the
corrected run - so I am reporting this as something worth checking rather
than as a finding. If someone else sees the same thing with the file still
on disk, that would settle it.

It is worth checking because leverage decides margin, margin decides
whether the account is stopped out during the run, and none of that shows
up as an error anywhere: the report just comes out different.
Update on build 6182.

"Report=" is still ignored on MCP-launched runs. Nothing is written, and tester_get_report still returns the summary only - 42 fields, no deal table.

Two things did improve:

run_id is now returned as a quoted string rather than a bare JSON number. Above 2^53 that used to lose precision in any JavaScript client, so the MCP Inspector could not drive these tools at all. It can now.

get_tester_journal (new in 6180) reads both the main tester and the agent journals over MCP, with a substring filter and a time range. That turns out to be a usable workaround for the missing deals:

    filter "deal #" -> every execution, with time, side, volume, symbol, price and order id
    filter "received for order" -> the INFO[340036] line, which appears only when a position is created, so entries can be told from exits

Between those two you can reconstruct the deal sequence and group it into baskets without touching the filesystem. What is still missing per deal is profit, swap and commission - derivable from prices and the symbol spec, but not free.

So the data exists and is now reachable. It is a partial workaround rather than a fix - profit, swap and commission are still missing per deal.

Honoring Report= on MCP-launched runs, writing the same report the command line produces, would still be worth doing. The report carries a richer dataset than the journal: per-deal profit, swap, commission and balance, the orders table, the full input list, and history quality, some pngs. Reconstructing those from journal lines is possible for some and guesswork for others.
Roki Indra Putra #:

Thanks for the clear write-up — this matches what several people are seeing on build 6140 with the built-in MCP server.

1. Is Report= expected to be ignored on MCP-launched runs?
Yes, currently it appears to be. When the tester is started via tester_run_backtest, the terminal runs the test and exposes results only through the MCP tools (tester_get_status / tester_get_report). The classic HTML report generation (and the “writing report” dialog) is skipped. The rest of the [Tester] section is still respected, which is why everything else works. This looks like intentional design for the MCP path rather than a pure bug, but MetaQuotes hasn’t published a formal statement on it yet.

2. Is there another way to get the deals from a run started via MCP?
Not cleanly at the moment.

  • tester_get_report only returns the short summary (no deal table).
  • get_trading_history_positions / history tools still point at the live account, not the tester context.
  • The tester journal sometimes contains deal lines, but parsing it is fragile and incomplete.

The practical workarounds right now are:

  • Launch the same .ini via command line (terminal64.exe /portable /config:...) when you need the full HTML report + Deals table.
  • Or keep using MCP for quick iteration/summary, then re-run the final configuration via CLI for the detailed report.

3. Is a tester deals/history tool planned?
No public roadmap has been shared. Given how new the built-in MCP is (and that build 6140 already added a few tester-related improvements), it’s reasonable to hope for a tester_get_deals / richer report tool in a later build, but nothing is confirmed.

Until then the most reliable way to get the full Deals table remains the classic command-line launch with Report= + ReplaceReport=1.

Would be useful if others can confirm whether they see the same behaviour on non-portable installs or on different builds.

Cheers.

Personally I have hopes you implement at some point the possibility to define a path where to store the .html backtest report for automation purposes, I highly would appreciate it.
jacek_mql #:

Thank you Alain.  Looking forward to having it being addressed by MQ.

The issue has been fixed from build 6215.
Alain Verleyen #:
The issue has been fixed from build 6215.

Confirmed on v6230.

Thank you Alain for looking into this — the report data itself is now available over MCP (via tester_get_report) and matches what CLI's Report= produces (deals, commission, inputs, all consistent). Appreciated.

One minor thing still missing: the PNGs that a CLI-launched run produces (holding time, hst and MFE/MAE) aren't generated on MCP-launched runs. The balance chart mechanism is already there (on both CLI and MCP paths) — the deal data already carries a running Balance per deal chart — so this looks like it's just not switched on for MCP-launched runs yet, not something that needs building from scratch. Could those charts be enabled the same way?

If that's done, and we save tester_get_report's as xlsx/html, we'd have an exact match for everything Report= is giving us via CLI. So this isn't really about getting Report= to work on MCP-launched runs — it's that tester_get_report plus saving it already gets us there.

Lastly, the main chart currently (as always) shows Balance only. Would it be possible to plot Balance and Equity together, like the Chart tab does live during a test? That'd be more useful than what's there now.

Again, really appreciate you helping to get it done.

jacek_mql #:

Confirmed on v6230.

Thank you Alain for looking into this — the report data itself is now available over MCP (via tester_get_report) and matches what CLI's Report= produces (deals, commission, inputs, all consistent). Appreciated.

One minor thing still missing: the PNGs that a CLI-launched run produces (holding time, hst and MFE/MAE) aren't generated on MCP-launched runs. The balance chart mechanism is already there (on both CLI and MCP paths) — the deal data already carries a running Balance per deal chart — so this looks like it's just not switched on for MCP-launched runs yet, not something that needs building from scratch. Could those charts be enabled the same way?

If that's done, and we save tester_get_report's as xlsx/html, we'd have an exact match for everything Report= is giving us via CLI. So this isn't really about getting Report= to work on MCP-launched runs — it's that tester_get_report plus saving it already gets us there.

Lastly, the main chart currently (as always) shows Balance only. Would it be possible to plot Balance and Equity together, like the Chart tab does live during a test? That'd be more useful than what's there now.

Again, really appreciate you helping to get it done.

While checking I got the exact same report.
Alain Verleyen #:
While checking I got the exact same report.
You mean, you got all 4 PNGs in tester_get_reports response?  I will check it tomorrow, as maybe I missed it.