How to Export MT4 Account History to Excel and Reconcile Trading Costs
To move MT4 account history into Excel, export the desktop history as an HTML report, bring the relevant table into a workbook, and check its field meanings before calculating results. The standard MT4 report command does not provide a native CSV export. Renaming the downloaded HTML file with a .csv extension will not convert its contents.
This guide covers MT4 on desktop and an Excel workflow. If you mainly use your phone, keep the MT4 Android trading guide for the mobile interface and use the desktop report for this procedure. The goal is a traceable set of closed records whose costs agree with your source.

1. Choose the account and history period
Confirm the account, currency and source timezone you intend to analyse. Open Terminal from the View menu, or use Ctrl+T, then select Account History. MetaQuotes lists that shortcut in its desktop View menu documentation.
Right-click within the history and select Custom Period for your dates. MT4 requests this history by close time. A position opened earlier can therefore belong in the selected closed-record period. Check the visible first and last relevant records before proceeding.
In the same context menu, choose Save as Report or Save as Detailed Report and save the HTML file. The detailed version adds statistics. These options and the close-time filtering are documented in MT4 Account History help.
Use a filename that identifies the account and date range, and keep the original unchanged. If you are examining one week, capture enough source information to check the period boundaries. A report's availability alone does not prove that every record you expected is present.
2. Bring the closed records into Excel
Open the saved report locally in a browser. Locate its Closed Transactions table and keep Open Trades and Working Orders separate. Create an Excel workbook with a Raw sheet for the original table and a Working sheet for your cleaned records.
Copy the relevant table with its headings into Raw. Microsoft documents HTML as a supported Excel clipboard format. Paste behaviour depends on the application version and source layout, so check the resulting columns instead of assuming that every value was interpreted correctly.
Preserve ticket identifiers as text during the transfer. Preformat the destination identifier column as Text and use a paste option that retains that destination format, then compare sample IDs with the HTML. If leading zeros or long digits have already changed, return to the original source and repeat the import with explicit text handling; changing the damaged cell's display format cannot recover lost characters.
Check an early record, a late record and one with a charge or credit. Confirm both timestamps, decimal separators, negative signs, lots and identifier characters. Keep timestamps as actual spreadsheet date-time values in Working. Retain the source timezone in a note rather than allowing an unexplained local-time conversion. Save the file as XLSX.
3. Map the columns before adding costs
Use the actual report headings and their definitions. The following is a mapping checklist for the free MT4 trading journal template, not a claim that every statement uses an identical layout.
| Source information | Journal treatment |
|---|---|
| Ticket and original row | Preserve Ticket ID as text; assign a unique Record ID and retain a source reference. |
| Opening and closing timestamps | Map both deliberately. Use close time for this weekly realised-result review. |
| Instrument, direction and closed volume | Map to Symbol, Buy or Sell, and Closed lots. |
| Reported profit | Establish whether it includes the separately listed charges before using Profit excl fees. |
| Commission and swap | Enter charges as negative and credits as positive, exactly once. |
| Other trade-linked charges or credits | Use Other trade adj signed when supported by the source; retain the explanation. |
| Deposits, withdrawals and other account flows | Keep outside Trades and use separately in the balance reconciliation. |
MetaQuotes defines OrderProfit() as excluding commission and swap. Commission and swap also have their own OrderCommission() and OrderSwap() accessors. Treat that as a reason to check the accounting basis, not permission to assume that every field labelled “net” or “profit” means the same thing.
The journal requires net P/L = profit excluding mapped fees + signed commission + signed swap + signed other trade adjustments. If a source presents charges as positive expenses, normalise their signs in Working and document that mapping. Keep the original values in Raw.
For a synthetic example, 50 + (−3) + (−1) + 0 = 46. If the source profit already equals the inclusive 46, reconstruct the exclusive amount by subtracting the signed charges from 46, giving 50. Adding those charges to the inclusive figure again would produce an incorrect 42.
Do not invent a separate realised spread or slippage deduction when its price effect is already in the recorded fills. If you want to examine execution quality against a reference price, record that as a separate analysis with its own evidence.
4. Check the record count and reconcile the period
Keep only actual closed trading records in the realised trade set. In particular, an export from a script may contain more than completed trades: the official OrderSelect documentation explains that the history pool also includes cancelled pending orders. Inspect the record type rather than counting every historical row as a trade.
Preserve each partial close as a closed record. Check related portions using their dates, volume and source details; do not automatically remove records because they look similar. Conversely, importing the same reporting period twice can duplicate the same economic result. A unique worksheet ID helps track records, but matching the original source remains necessary.
Compare the cleaned row count and net P/L with an independent statement total covering the same account, dates and fee basis. Then check:
Closing balance = opening balance + realised net P/L + signed cash flows + other balance movements.
Use balances, not equity containing open-position results. Enter verified zeros for absent cash flows. If a charge is already in trade P/L, do not repeat it among other balance movements. An unexplained difference may point to a missing record, different period, incorrect sign or inconsistent fee treatment. Keep it visible until you can account for it from the source.
This comparison assumes that trade costs and balance entries belong to the same posting period. If a fee was booked earlier or later, the close-date journal and balance movements need a separate timing reconciliation. The template does not calculate that bridge automatically; its Other balance movements input is for actual period entries, not an unexplained adjustment.
5. Save a reusable working file
Retain the original HTML, the Raw table, your mapping note and the reconciled Working data together. The companion trading journal and weekly review guide explains how to transfer those inputs while preserving its calculated columns. Initial risk requires its own original evidence; a report's later stop value or realised loss is not a reliable substitute for a missing plan.
If you also need CSV, export a separate cleaned sheet from Excel using Save As after the data has been checked. Microsoft explains that CSV saves one worksheet and loses workbook features. Keep XLSX as the version containing the review and formulas.
When reopening CSV, use Data > From Text/CSV where available, inspect the delimiter and set identifier fields to text before loading. Confirm dates and number formats for your locale. A final comparison with the original HTML makes the exported file a dependable input for analysis rather than another unverified copy.
Documentation reviewed: 13 October 2026. The workflow follows official MetaQuotes and Microsoft documentation. Its arithmetic example is synthetic; no particular broker account export or Excel desktop installation was tested for this article.
Continue with MetaTrader Guides for related lessons.
No comments