Efficient way to extract results from strategy tester? - page 2

 

This was something that bothered me too, so I decided to create a small Python script.

Script Name: extract_mt4_full_test_results.py
Purpose: Extracts test results and parameter settings from a MetaTrader 4 backtest HTML report and exports them to Excel.

📄 What It Does:

  • Parses the correct results table from the HTML file.
  • Uses the first row as column headers (real metric names).
  • Extracts parameter values from the title attribute in each row.
  • Converts numeric values properly.
  • Exports everything to OptimizationFullReport.xlsx.

▶️ How to Use:

  1. Save the MT4 report HTM as OptimizationReport.htm in the folder where the script is
  2. Run the script:

python extract_mt4_full_test_results.py

  1. Output will be saved as OptimizationFullReport.xlsx.

Note: Make sure OptimizationFullReport.xlsx is closed before running.
Dependencies: beautifulsoup4, pandas, openpyxl (install with pip install).

Attaching the script.