Welcome Forex EA downloads & MT4/MT5 auto-trading resources — EAs, Gold EAs, quant tools and real-world automation.
Sign In Sign Up

History Dump CSV with Heatmap for Excel Analysis - MetaTrader 4 Script - MT4/MT5 Resource

author EAcpu | 6 reads | 0 comments |

History Dump CSV with heat map for Excel analysis - script for MetaTrader 4

History Dump CSV with heat map for Excel analysis - script for MetaTrader 4

History Dump CSV with heat map for Excel analysis - script for MetaTrader 4

History Dump CSV with heat map for Excel analysis - script for MetaTrader 4

History Dump CSV with heat map for Excel analysis - script for MetaTrader 4

History Dump CSV with heat map for Excel analysis - script for MetaTrader 4

History Dump CSV with heat map for Excel analysis - script for MetaTrader 4

Do you need to know at which times of the day you win or lose compared to other times or times of day? This script creates a .CSV file of order history so that you can import it into Excel and analyze it.

It extracts all order information. Date/time information in native MetaTrader format (fields ending with _MT) and Excel format.

It also supports aggregate analysis by calculating "heat map" dates and time periods. The number of days is 0-6, and the period is 0-95.

The heat map defaults to 4 time periods per hour, which is 15 minutes, and there are 96 time periods per 24 hours. This means that transactions within the same session will have the same session number. This can make your Excel analysis and creating useful pivot tables much easier.

The script saves the output file in /MQL4/Files directory. If you define one in the terminal, it will also upload files to the FTP server you specify.

Note that if you have filtered your account history to the past 3 months, this is all the data that will be extracted. If you want all history, remove the history filter.

Some documentation:

All available MT4 trading properties are collected from the available history and output to a CSV file.

Additionally, some calculated values ​​are output. These are:

Using transaction attributes and calculated values ​​in Excel Pivot Reports can help you better understand your transaction profile and therefore ways to optimize it.

The data is available for 4-digit and 5-digit brokers and uses the correct pip and digit values ​​for each currency pair analyzed.

Times are based on the broker's server, so take this into consideration when comparing data from brokers in different time zones.

The script is designed to be self-contained and does not require confirmation. If you need to customize it, the section below lists the 4 most likely customizations you might need:

string reportfilename=StringConcatenate("HistoryDumpCSV_",AccountID,".CSV"); // FileOpen has the FILE_COMMON flag, which means it is saved to the Common/Files folder.

uchar DELIM='\t'; // The delimiter is the '\t' tab character. Other options are ";" semicolon and "," comma. The "\t" delimiter is the default delimiter for Excel CSV import.

int SLOTSPERHOUR=4; // This divides trading hours into 15 minute buckets to aggregate the data. 2=30 minutes, 3=20 minutes, 1=1 hour period.

Boolean SendFileByFTP=true; // Set this to false if not required.

Adapt these to suit your needs.

The script includes FTP functionality so that the generated report files are also sent via FTP to the configuration directory on the remote FTP server.

In my case, this is a central NAS drive that holds all reporting data for all my demo accounts. This allows me to run multiple MT4 terminals on any PC but collect reporting data from one place.

Drag the script onto any chart to launch it. This script confirms the generated files:

History Dump CSV with heat map for Excel analysis - script for MetaTrader 4

You can then find the file and analyze it if necessary.

History Dump CSV with heat map for Excel analysis - script for MetaTrader 4

If you want to use Excel and create a pivot report, you must first convert the text into columns:

History Dump CSV with heat map for Excel analysis - script for MetaTrader 4

Convert to columns so they can be used in Excel:

History Dump CSV with heat map for Excel analysis - script for MetaTrader 4

Pivot reports and historical charts are now available:

History Dump CSV with heat map for Excel analysis - script for MetaTrader 4

Use the Insert Perspective Wizard:

History Dump CSV with heat map for Excel analysis - script for MetaTrader 4

Select your desired data attributes to create any report:

History Dump CSV with heat map for Excel analysis - script for MetaTrader 4

A complete screenshot of the conversion of the .CSV file into an Excel Pivot Report is attached in the .zip file.


Attachment download

📎 historydumpcsv.mq4 (26.58 KB)

Source: MQL5 #13885

Verification code Refresh