Export History To HTML Report
A trading review wants one document: the headline numbers, the curve, the month-by-month table and the trades behind them, in something you can open anywhere and send to anyone. This script writes that document straight from the terminal - one HTML file with everything inline. There is no JavaScript, no chart library, no font or image fetched from anywhere; the equity curve is an SVG polyline generated into the page. Mail the file, archive it, open it on a machine with no internet - it renders identically. The summary table: closed trades split into wins, losses and flats; net result; gross profit and loss; profit factor; win rate; expectancy per trade; average and largest win and loss; longest winning and losing streaks; and maximum drawdown. Every net figure includes swap and commission - a review over raw price profits flatters carry-negative strategies and hides commission drag exactly where it hurts. Drawdown is computed from the reconstructed sequence of closed trades, not from the balance line, so a deposit cannot fake a recovery and a withdrawal cannot fake a crash. It is reported in money rather than percent on purpose: without knowing the account balance at every point in the past - which deposits and withdrawals make unknowable from trade history alone - a percent figure would be an invention. The report says what it measures directly under the table. The equity curve plots cumulative net result per closed trade, trade number on the X axis rather than time. With time on the axis every weekend draws a flat shelf and a burst of scalps compresses into a vertical smear; per-trade spacing shows the sequence a review actually cares about. Zero is marked with a dashed reference line whenever the curve crosses it. The trade list carries every trade with ISO 8601 times, prices at the symbol's own digits, pips (3/5-digit aware, blank for symbols the broker no longer quotes), the net result coloured win/loss, and the running equity after each trade. Trade comments - the only user-controlled text on the page - are HTML-escaped, so a stray angle bracket in a broker comment cannot break the document. The report title carries the account number masked to its last three digits and the date. Masking is not optional here: a report file exists to be shared, and the last three digits are enough for anyone entitled to know. Notes and limitations - Read-only. Nothing is traded, modified or deleted. - Balance operations are excluded by type; the statistics are trading only. - The curve and drawdown are built from closed trades in close-time order. Floating P/L of currently open positions is not part of this report. - Expectancy is the plain average net per trade, not a model. - A report over zero trades is still written (header, account block, note) - proof the script ran against an empty range. - Very large histories produce large files (roughly 1 MB per 4000 trades); browsers handle it, mail attachments may grumble. - The HTML targets any modern browser; there is nothing in it newer than SVG 1.1 and CSS 2.1.
Script · MT4 · v1.0 · Free
About Export History To HTML Report
Export History To HTML Report is a script for MetaTrader 4. It can alert you with a pop-up, sound, email or push message. It has 2 settings, such as From date and To date. MQL source code included.
Files in the download: ExportHtmlReport.ex4, ExportHtmlReport.mq4, ExportHtmlReport.txt.
Settings
| Setting | Default | What it does |
|---|---|---|
| From date | 0 | From close time (1970.01.01 = no lower bound) |
| To date | 0 | To close time (1970.01.01 = up to now) |
How to install
- Download the ZIP from your PolyMaria library and unzip it.
- In MetaTrader 4 open File → Open Data Folder, then go to MQL4 → Scripts.
- Copy the .mq4 file(s) there. Put any .mqh files in MQL4 → Include.
- Open the .mq4 file in MetaEditor and press Compile (F7) if MetaTrader does not show it.
- Drag the script onto a chart to run it once.
Tags: Alerts · MT4 Script · MQL4 Source Code