Loading…

Tester Report Parser To CSV

The Strategy Tester's own "Save as Report" produces an HTML file and nothing else. That is fine for looking at one run, but comparing several runs, or pulling the trade list into a spreadsheet or a notebook, means someone has to turn that markup into rows and columns by hand - usually by copy-pasting out of a browser and cleaning up whatever pastes wrong. This script does that conversion directly. It does not try to work out which table is the summary block and which is the trade-by-trade list, and it does not assume a fixed column layout - MetaTrader has changed the report's exact markup across builds and will again. Instead it walks every <tr> element in the file in the order it appears and writes one CSV row per table row, with one column per <td>/<th> cell. The row count in the CSV always matches what the report shows on screen, because it is built from the same tags. Cell text is taken from between the tags with everything else stripped - formatting spans, colour markup and links inside a cell disappear, and the common HTML entities the report generator actually uses (&nbsp;, &amp;, &lt;, &gt;, &quot;, &#39;) are decoded back to plain characters. A cell that itself contains the chosen delimiter, a quote character or a line break is wrapped in quotes so the CSV stays valid, exactly as a spreadsheet expects. Notes and limitations - This is a tag-stripping parser tuned to the shape of file the terminal's own report generator writes, not a general-purpose HTML parser. A report edited by hand, or exported from a very different tool, may not parse cleanly. - Rows from every table in the file are flattened together into one CSV, in document order. If the source report has more than one table, the summary block and the trade list end up as consecutive row groups in the same file, not as separate outputs - open the CSV and look for where the column count changes to find the boundary. - Nested tables (a table inside a table cell) are not unwrapped separately; their inner rows are read like any other row, which can produce a stray extra row in rare report layouts. - The output filename carries a timestamp, so running the script twice on the same report never overwrites the first result.

Script · MT4 · v1.0 · Free

About Tester Report Parser To CSV

Tester Report Parser To CSV is a script for MetaTrader 4. It can alert you with a pop-up, sound, email or push message. It has 4 settings, such as Report filename, Delimiter and Max rows. MQL source code included.

Files in the download: TesterReportParserToCsv.ex4, TesterReportParserToCsv.mq4, TesterReportParserToCsv.txt.

Settings

SettingDefaultWhat it does
Report filenameReport file (.htm/.html) in MQL4\Files
DelimiterDelimiterCommaCSV column separator
Max rows5000Safety cap on rows written
Skip empty rowstrueSkip <tr> rows that produced no cell text

How to install

  1. Download the ZIP from your PolyMaria library and unzip it.
  2. In MetaTrader 4 open File → Open Data Folder, then go to MQL4 → Scripts.
  3. Copy the .mq4 file(s) there. Put any .mqh files in MQL4 → Include.
  4. Open the .mq4 file in MetaEditor and press Compile (F7) if MetaTrader does not show it.
  5. Drag the script onto a chart to run it once.

Download the PDF guide

Tags: Alerts · MT4 Script · MQL4 Source Code

MQL4 & MQL5 scripts · PolyMaria