[MT4] Introducing Script to export account history information

Have you ever wondered what kind of trading MT4 users are doing to study trading?

For such people, we would like to introduce a Script that exports account history information.
It is also possible to have a person who is good at trading export the trade history, import the information into your MT4 and display it on the Chart.
※The order ticket number is not output in the export information.(Instead, it prints a 0-based index.)

Contents

Script to export account history information

1. specification

The following is the specification of Script that exports account history information.

  1. Account history export function
    1. Output file
      1. Output file name can be specified
      2. The extension will be “.csv”.
      3. file format
        1. The first line shows the header of the output information.
        2. Account history information is output on the second and subsequent lines.
        3. The output account history is for the information displayed on the “Account history” tab of MT4.
        4. The output information is as follows
          1. 0-based index (ID) instead of order ticket in account history
          2. Symbol name (If the symbol name has additional information such as “.oj5k” separated by dots, it will be deleted and output.)
          3. Trade type (As for the meaning of the value, the value of Value of this Order properties is output.)
          4. Number of Lots
          5. OPEN time(Outputs the number of seconds elapsed since January 1, 1970)
          6. OPEN time
          7. OPEN Price
          8. CLOSE time(Outputs the number of seconds elapsed since January 1, 1970)
          9. CLOSE time
          10. CLOSE Price
          11. Take profit
          12. Stop loss
          13. Profit
      4. Output file path
        1. It is stored in “MQL4”-> “Files” under the MT4 folder.
  2. Ability to import the exported account history and display it on the chart
    1. It can be displayed by using the indicator that imports the exported account history and displays it on the Chart of MT4.

2. How to use

2-1. Download the LU_exportAccountHistry.ex4 file

Download the Script from the download page of the LU_exportAccountHistry.ex4 file.

2-2. Execute the LU_exportAccountHistry.ex4 file

Next is the execution of Script, but before that, please filter to the period of account history you want to export in the “Account history” tab of MT4.
Only the information (row) displayed on the “Account History” tab will be exported.

Next, once you have set the period for downloading and exporting the Script file, proceed with the execution procedure by referring to the execution method of the Script file.

At that time, you can specify the output file name on the “Parameters” screen.If you do not specify it, you can leave it as “account History” without changing it.
※The output file will be automatically given the extension “.csv” in the end, so you do not need to enter the extension.

Parameters for output file name

After setting the parameters, click the “OK” button to execute the script.

2-3. Obtaining the export file of account history

After executing Script, you can get the export result of account history by the following procedure.

  1. Click “File”-> “Open Data Folder” on the MT4 screen
  2. The MT4 directory will open, and move to the “MQL4”-> “Files” folder.
  3. After moving to the folder, you can find the file with the file name specified on the “Parameters”.

The above export file can be opened with a text editor or Excel.

NOTE:Output file example

ID,Symbol,Type,Lots,OPEN time(elapsed time),OPEN time,OPEN price,CLOSE time(elapsed time),CLOSE time,CLOSE price,TP,SL,Profit
0,USDJPY,0,0.1,1615568911,2021.03.12 17:08:31,109.01,1615570072,2021.03.12 17:27:52,109.12,110,109.12,1100

2-4. To display the exported account history on the MT4 Chart

It is possible to display the exported account history using the indicator that is displayed on the Chart of MT4.