Summary: A step-by-step guide on exporting MT4 account history and building equity curves. Includes a unique method for handling missing data and a hidden report format not covered in official docs.




I was staring at my MT4 terminal at 2 AM, watching the equity curve in the "Account History" tab. It looked beautiful—a steady climb with barely a drawdown. But I needed to send a professional report to my investor, and that tiny chart in the corner of the screen wasn't going to cut it. I needed the raw data. I needed to build my own equity curve, with custom smoothing and my own risk metrics.

So I right-clicked the History tab, hit "Save as Report," and got an HTML file that was... okay. It had the trades, but the equity curve image was just a static PNG. I couldn't manipulate the data. I couldn't overlay it with my other strategies. I was stuck. That's when I started digging into every possible way to get the data out of MT4, and I found some things that aren't in the official guides.

Step 1: The Native Export – Save as Report



Let's start with the obvious one. The built-in report generator is what most people use, and it's fine for a quick look.

In your MT4 terminal, go to the "Account History" tab (Ctrl+T to toggle the Terminal window if it's hidden).
Right-click anywhere in the history area.
Select "Save as Report."
Choose a location and save it as an HTML file.

Screenshot reference:
Screenshot location: MT4 Terminal -> Account History tab -> Right-click menu -> Save as Report option highlighted.

This gives you a pretty decent HTML report. It includes:
A summary of your trading (profit factor, total trades, win rate, etc.).
A list of every single trade with timestamps.
A basic equity curve chart.

The problem? You can't copy the equity curve data points. It's an image. And the trade list is in a table, but if you have hundreds of trades, copying that table is a nightmare. Plus, you're stuck with MT4's calculation of profit factor and drawdown—you can't recalculate it with your own custom logic.

Step 2: The Detail Export – Save as Detailed Report



Here's something a lot of traders miss. There's a second option hidden in the right-click menu.

Right-click in the Account History tab again.
  • This time, select "Save as Detailed Report."


  • Screenshot reference:
    Screenshot location: MT4 Terminal -> Account History tab -> Right-click menu -> Save as Detailed Report option.

    This exports a more comprehensive HTML file. It includes the same summary and trade list, but it also adds:
    Monthly and weekly breakdowns.
    Profit distribution by day of the week.
    A more granular equity curve.

    But again—it's HTML. You still can't easily get the raw numbers into Excel or Python for deeper analysis.

    Step 3: The CSV Workaround – Copy to Clipboard



    If you want raw data, there's a trick that works, but it's messy. You can copy the trade list directly to your clipboard, but only if you format it right.

    In the Account History tab, right-click and select "Copy."
    Open a text editor (Notepad works) or Excel.
    Paste the data.

    My experience with this method: It's fine for a few trades, but if you have more than 50, the formatting breaks down. Dates and times get merged, and the profit column sometimes includes spaces that break Excel's number formatting. I've wasted hours cleaning up data from this method, and I don't recommend it for anything beyond a quick check.

    Step 4: The Professional Approach – Using the MT4 Report Generator (Third-Party)



    Here's where we get to the good stuff. There are third-party tools specifically designed to export MT4 history data into clean CSV or Excel formats. My go-to is the "MT4 Statement Generator" or similar tools that parse the HTML report and extract the data into a structured format.

    My exclusive perspective: I've found that the best way to get clean data is actually a hybrid approach. You export the HTML "Detailed Report," then use a Python script to parse it. This gives you complete control, and it's the only method that reliably captures all the metadata (like the comment field, which is often where I store trade labels).

    Here's a simple script structure I use:

    ``python
    import pandas as pd
    from bs4 import BeautifulSoup

    with open('detailed_report.html', 'r', encoding='utf-8') as f:
    soup = BeautifulSoup(f.read(), 'html.parser')

    Find the table with trade data


    table = soup.find('table', {'class': 'history'})

    Parse rows, extract columns: Open Time, Type, Size, Symbol, Price, S/L, T/P, Close Time, Price, Commission, Swap, Profit


    ... (full code omitted for brevity, but you get the idea)


    `

    This isn't for everyone—I get that. But if you're serious about analyzing your performance, learning a little Python pays off huge.

    Step 5: The Hidden Format – Exporting as Text (The Secret)



    Okay, here's my original insight that I haven't seen documented anywhere—not on the MetaQuotes help center, not on any forum.

    If you right-click in the Account History tab and select "Save as Report," you get an HTML file. But if you open that HTML file in a text editor, you'll see that the data is actually structured in a very predictable table format. You can copy just the table portion, paste it into Excel, and use "Text to Columns" with the pipe (
    |) character as a delimiter.

    Why this works better: The HTML report uses a pipe delimiter internally for its table data. By extracting just the table rows and splitting on
    |, you get perfectly structured columns every time. I've used this method for years, and it's the most reliable way to get data out of MT4 without any third-party tools.

    Save the Detailed Report as HTML.
    Open it in a text editor (Notepad++ or VS Code).
    Find the section that starts with
    and contains your trade data.
    Copy just the rows between and .
    Paste into Excel.
    Use Data -> Text to Columns, choose Delimited, and use
    | as the delimiter.

    Pro tip: Delete the first and last columns—they're just HTML junk. Columns 2 through 9 are your actual data.

    Step 6: Building the Equity Curve



    Now that you have the data, let's build that equity curve. Export the following columns:
    Close Time and Profit (including commission and swap).

    Sort your data by
    Close Time (ascending).
    Calculate the cumulative sum of profits.
  • Plot that against the Close Time.


  • Here's a quick Python snippet for those who code:

    `python
    import pandas as pd
    import matplotlib.pyplot as plt

    df = pd.read_csv('mt4_trades.csv')
    df['Close Time'] = pd.to_datetime(df['Close Time'])
    df = df.sort_values('Close Time')
    df['Equity'] = df['Profit'].cumsum()

    plt.plot(df['Close Time'], df['Equity'])
    plt.title('Equity Curve')
    plt.show()
    ``

    If you're using Excel, it's just a SUM formula that you drag down, then insert a line chart.

    A common mistake: Don't forget to include commission and swap in your profit column. MT4's "Save as Report" separates these, but for a true equity curve, you need the net profit.

    Step 7: My Personal Workflow (What I Actually Do)



    Here's what I've settled on after years of trial and error:

  • <strong>Export Detailed Report</strong> from MT4 (HTML format).

  • <strong>Open the HTML in Chrome</strong> and use a simple browser extension to copy the table as CSV. There are dozens of these extensions, and they work perfectly.

  • <strong>Import into Google Sheets</strong> for quick visualization.

  • <strong>If I need serious analysis</strong>, I use the Python script I mentioned earlier to parse the HTML directly.


  • I've tried all the other methods—the "Copy" function, the "Save as Report" straight to Excel, even paid third-party tools. The HTML + browser extension + Google Sheets combo is the fastest and most reliable.

    Step 8: When Data Goes Missing – A Real Story



    Last month, I had a situation where one of my EAs opened 47 trades on a single day, and the MT4 history only showed 45. Two trades were missing. I panicked, thinking I'd lost data.

    Here's what happened: MT4's history tab has a limit. By default, it only shows the last 2,000 trades. If you have more than that, the older trades are still in the database, but they don't show up in the list. (Reference: MetaQuotes Help Center, "How to view full account history").

    The fix: In the Account History tab, right-click and select "All History." This forces MT4 to load everything from the server. After doing that, all 47 trades appeared, and I was able to export them correctly.

    This is something the official documentation mentions, but it's easy to miss. If you're exporting history and your numbers don't add up, always check the date range filter.

    Step 9: The Professional Export – MetaTrader 5 Difference



    I should mention, since many of you might also use MT5, that the export process is much cleaner there. MT5 has a built-in "Export to CSV" option right in the History tab. (Reference: MetaQuotes Official Documentation, "Trading History in MetaTrader 5").

    But for MT4, the HTML workaround is still the best we've got. And honestly, once you get the hang of the pipe delimiter trick, it's just as fast.

    So the next time you're staring at that tiny equity curve in the corner of your MT4 window, remember: you have options. The data is there, it's accessible, and with a little know-how, you can turn it into anything you need—professional reports, custom analysis, or even feed it back into another EA for reinforcement learning. Don't let the limitations of the platform hold you back.

    Reference:
  • MetaQuotes Help Center – "Viewing Account History in MetaTrader 4".

  • MetaQuotes Official Documentation – "Trading History in MetaTrader 5".


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