We recommend:

  1. Home
  2. Scripts
  3. From History To File – the script records the results of the trade in the file

From History To File – the script records the results of the trade in the file

Script for writing trade results to a file

Sometimes you need to do a thorough analysis of orders with additional tools (besides the terminal), such as Microsoft Excel. It is great for filtering and sorting your trades in rows and columns, can also help build a profitability schedule, drawdown, find out the total deposit, check the warrants for the magic number, identify the weaknesses and strengths of your system.

The DaVinci From History To File script will record information about your closed orders, top-up/withdrawals, or pending orders in a .csv file. This format refers to and opens through Excel files.

Also, the script will check for you whether the trading history is fully deployed, and if not, with WinAPI it will fully display (you need to allow in the settings import DLL) to record the results correctly.

Script settings:

File Name The name of the file where the script will work.
Write Swap Write down the data about the paid swap in the file.
Write Comission Write down the broker’s commission data.
Write Comment Record orders comments
Write Magic Number Record magic numbers
Write Pending Orders Write deferred (not working) orders to file
Write Deposit/Withdrawals Write down all the information about the top-up of the account, as well as withdrawals.

An example of how the script works:

The script is transferred, as usual, by the mouse to the graph, or with the right mouse button – Execute on the graph. The EA will start the analysis, it may take some time, depending on the number of orders in your trading history. The top left screen will display information about the process as a comment. As a result, we get a record in the magazine:

Done… Wrote file name: ‘My Orders History.csv ‘to the folder …/MQL4/Files

The resulting file will be preserved in the root folder of your terminal kind: C:’\Users\’Admin’\AppData’\Roaming’\Meta’Terminal’\1FC855301\Path

We will open the file through Excel and see a table of this type:

It shows all the basic information on your trade. Now through the program you can do sorting, deleting unnecessary results, counting profits by day, months. Through the filter option, you can only display orders that interest you: in a certain direction, by magic number or by comment.

You can also add a couple of buttons to build a profit schedule by manually introducing a formula to add up the profits of each trade. We got this schedule of our adviser:

As you can see, the yield curve is flat, the drawdown EA quickly worked and again went into profit. Exactly the same schedule can be made for a different time period, or for orders from different trading advisors, if there are several on the trading account.

That’s all, we hope this script will be useful to you.

Simplicity is the key to success!

Leave a Reply

Your email address will not be published. Required fields are marked *

Fill out this field
Fill out this field
Please enter a valid email address.
You need to agree with the terms to proceed

Menu