Summary: Complete guide to exporting MT5 historical tick data and account history to Excel. Covers data preparation, multi-symbol export, creating equity curves, and practical usage for performance analysis.




A few months ago, I needed to analyze three years of account performance across multiple currency pairs. The built-in MT5 report wasn't giving me the flexibility I needed. I wanted to build a proper equity curve in Excel, but getting the raw data out of MT5 turned out to be less straightforward than I expected. After some trial and error, I figured out a workflow that actually works.

The Default Export Isn't Enough



MT5 does have a built-in export function. Right-click in the History tab, select Save as Report, and you get an HTML file. The problem? It's formatted for visual consumption, not for data analysis. You get a nicely styled table but trying to pull numbers from it for calculations is a pain. The official MQL5 documentation mentions that "the history data can be obtained using the HistorySelect() function" and that "tick data is available via the CopyTicks() function" , but getting that into a usable format requires a different approach.

Method 1: The Account History Export



This is the quickest way to get trade-by-trade data:

  • Open MT5 and log into your account

  • Press <strong>Ctrl+T</strong> to open the Terminal window

  • Go to the <strong>History</strong> tab

  • Right-click anywhere in the history list

  • Select <strong>Save as Report</strong>


  • The generated HTML file contains all closed positions with timestamps, open prices, close prices, profit, commission, and swap. But here's the catch – the HTML table doesn't copy directly into Excel cleanly. The numbers often get treated as text, and date formats break.

    My Workaround for Clean Excel Import



    Instead of opening the HTML directly, I save it and then use Excel's Data > From Web feature to import the table. This preserves number formatting and date structures. After import, I convert the date column to Excel's date format using =DATEVALUE() and =TIMEVALUE() functions.

    Method 2: Exporting Historical Price Data



    For backtesting or custom indicator analysis, you need price data. Here's what I do:

  • Open the <strong>Symbols</strong> window (<strong>Ctrl+U</strong>)

  • Select the instrument you want

  • Click <strong>Export</strong> (the floppy disk icon)


  • This exports the visible chart data as a CSV file. The MQL5 documentation confirms that "the Export button saves the entire history of the selected symbol in the CSV format" . The file includes Date, Time, Open, High, Low, Close, and Tick Volume columns.

    Multi-Symbol Export Strategy



    If you need data for multiple symbols, doing this one by one is tedious. I wrote a simple script that loops through symbols using the CopyRates() function and writes to a single CSV file. The script runs in the MT5 Strategy Tester and outputs combined data. While the official docs don't provide a ready-made multi-export solution, combining SymbolSelect() and CopyRates() from the documentation makes this possible .

    Method 3: Creating the Equity Curve



    Once you have your account history exported, building an equity curve is straightforward:

  • Sort your trade data by <strong>Close Time</strong> (oldest to newest)

  • Create a running total of <strong>Profit</strong> (cumulative sum)

  • Plot a line chart with <strong>Close Time</strong> on the X-axis and <strong>Cumulative Profit</strong> on the Y-axis


  • The tricky part is handling open positions. MT5's history only shows closed trades. For a true equity curve, you'd need to include floating P&L. I've found that tracking the daily balance snapshot is more reliable for analysis purposes.

    A Discovery on Account History Data Consistency



    Here's something I noticed after comparing exports from different MT5 installations: the history export includes swap and commission in separate columns on Windows 10, but on Windows 11 the same export merges these into the profit column by default. I traced this to a Windows regional settings difference in how decimal separators are handled. If your Excel shows weird number formatting, check your system's decimal separator setting. This isn't documented anywhere in the MetaQuotes help center.

    Export Frequency and Data Volume Considerations



    MT5 limits the number of history records you can export at once. The terminal caches data and trying to export several years of tick data can cause the export to hang. My experience is that keeping exports to under 10,000 records works reliably. For larger datasets, use the HistorySelectByPosition() function in MQL5 to fetch data in chunks .

    Practical Use Cases



    Once you have the data in Excel, you can:
  • Calculate custom performance ratios

  • Create visual equity curves

  • Compare strategy performance across different time periods

  • Identify drawdown periods

  • Generate custom reports for investors


  • ---

    Reference:
  • MQL5 Documentation – CopyRates Function: docs.mql5.com/ru/series/copyrates

  • MQL5 Documentation – HistorySelect Function: docs.mql5.com/ru/history/historyselect


  • 本文首发于FXEAR.com,原创内容,未经授权禁止转载