Export Deals History script for MetaTrader 5

The script exports history of deals from MT5 retail hedging account selected between two dates. The resulting file is CSV that can be opened/imported with any spreadsheet software.

To export the entire trading history, keep Start date and End date at their default values.

Export Deals History script for MetaTrader 5

The CSV file is located at: Terminal > File > Open data folder > MQL5\Files\<Filename>

Following data columns are exported:

  • Open Time
  • Position ID
  • Symbol
  • Type
  • Volume
  • Open Price
  • S/L
  • T/P
  • Close Time
  • Close Price
  • Commission
  • Swap
  • Profit
  • Profit Points
  • Balance, this includes the running sum of all profits, swaps and commissions from previous trades
  • Magic Number
  • Duration, this includes duration of the trade expressed in (hh:mm:ss) format
  • Open Reason, this includes reason of opening the trade (client, mobile, web, expert)
  • Close Reason, this includes reason of closing the trade (client, mobile, web, expert, sl, tp, so, …)
  • Open Comment
  • Close Comment
  • Deal In Ticket
  • Deal Out Ticket

Note that the history of deals (data rows) is ordered by Close Time to calculate the running Balance, correctly.

Free Download

Set Color Fibo Levels script for MetaTrader 5

MT5 Forex Script Characteristics

Platform: Metatrader 5

Type: Script

Time frames: any.

How to install Screenshot Script in MetaTrader 5 / MT5:

Copy and paste the Export Deals History script for MetaTrader 5.zip files into the MQL5 Scripts folder of the Metatrader 4 trading platform.

Restart your MetaTrader 5 application (assuming it’s currently open) … or Launch your MetaTrader 4 application

You can access this folder from the top menu as follows:

File > Open Data Folder > MQL5 > Script (paste here)

On the left hand side, look for the “Navigator” window and under the “Common” tab, look into the “Scripts” section

Locate the indicator which you have just downloaded into the folder stated in Step 1

Drag (Click and drag) the Script onto the chart (when you want the task to be performed)

your task should now be executed…

Leave a Comment