Do you need to know at what times of the day you are winning or losing compared to other times or the day? This script creates a .CSV file of your order history so you can import it into Excel and analyse it.
It extracts all order information. Date / time information in both native MetaTrader format (fields ending _MT) and Excel format.
It also supports aggregate analysis by calculating a 'Heat map' day and time slot. Days are 0-6 and slots are 0-95.
The heat map default is 4 slots per hour, i.e. 15 minutes, giving you 96 slots per 24 hours. This means trades within that same slot will have the same slot number. This can make your Excel analysis and creation of useful pivot tables a lot easier.
The script saves the output file in the <terminal_data_folder>/MQL4/Files directory. It will also upload the file to your specified FTP server, if you have defined one in your terminal.
Beware that if you have filtered your account history to, say, the last 3 months, then this is all the data that will be extracted. If you want ALL your history, then remove your history filter.
A Little Documentation:
All the available MT4 trading attributes are collected from the available history and output to the CSV file.
In addition, some calculated values are output as well. These are:
Use the trading attributes and calculated values in your Excel pivot reports to help you better understand your trading profile and therefore learn ways to optimise it.
The data is appropriate for 4 and 5 digit brokers and uses the correct point and digits values for each pair being analysed.
Times are as per the broker's server, so take this into account when comparing data from brokers in different timezones.
The script is designed to be self contained and not ask for confirmation. If you need to customise it then there is a section below that identifes 4 most likely customisations you may want:
string reportfilename=StringConcatenate("HistoryDumpCSV_",AccountID,".CSV"); // the FileOpen has the FILE_COMMON flag meaning it is saved to the Commong/Files folder.
uchar DELIM='\t'; // Delimiter is '\t' tab. Other options are ';' semicolon and ',' comma. The '\t' delimiter is the default for Excel CSV imports.
int SLOTSPERHOUR=4; // This divides the trading time into 15 minute slots for aggregating data. 2=30 minutes, 3=20 minutes, 1=1hour slots.
bool SendFileByFTP=true; // If not needed, set this to false.
Adjust these to suit your needs.
The script includes FTP functionality so that the report file generated is also sent by FTP to the configured directory on the remote FTP server.
In my case, this is a central NAS drive that holds all my reporting data for all my demo accounts. This allows me to run multiple MT4 terminals on any PC but collect the report data from a single place.
Drag the script onto any chart to initiate it. The script confirms the file generated:
You can then locate the file and analyse as you require.
If you want to use Excel and create pivot reports, then the text has to be converted to columns first:
Converted to columns makes it usable in Excel:
Pivot reports and graphs of your history are now possible:
Use the Insert Pivot wizard:
Select your desired data attributes to create any report:
The full set of screen shots for the transformation of the .CSV file into an Excel pivot report is attached in the .zip file.
This version of CCI indicator uses median line of the Step Channel indicator.Master Tools
Money Management / Pivot / Daily Open / Support-Resistance / Grid / Information of all kind / Tendency indicator.
Bollinger Bands with customizable moving average method and applied price.Authenticate into an MT4 account from MQL4 (tested in build 880)
MQL4 library that allows authenticating into a MetaTrader 4 account programmatically in release 880+.