Работа завершена
Техническое задание
Summary
This function will extract a snapshot of the data needed to identify the drawdown of individual EA’s.
The idea is to use the standard Metatrader toolbox trade data to obtain a snapshot of the open profit or loss for each open position along with the magic number associated with the position.
Building up a series of these over time will give an idea of the drawdown experienced by individual EA’s.
The function will create a regularly produced CSV files and place them in the existing MLQ5 Shared Projects folder.
Requirements
Changing the frequency of how often the extract is run
The frequency of the intervals for creating the file should be a parameter that can be altered.
Initially, this may be five minutes but could change. A user interface is not required on the assumption that it will be pretty easy to edit that item in whatever code is provided. Just show me where it is located in the code.
Timing of when the extract run
The extract should run at regular intervals based on a parameter that I can access e.g. 5 minutes.
The standard time periods for Metatrader should be possible; M1, M5, M15, H1, H4, D1
Using five minuets, say, each run should start on the next exact five minute mark, the opening of the next M5 candle. If the run is set up at 13.06 then the next extract should be at 13.10.
M15 should start at the next quarter hour. If the run is set up at 13.06 then the next extract should be at the beginning of the next M15 candle - 13.15.
H1 should start on the next hour. If the run is set up at 13.06 then the next extract should be at the beginning of the next H1 candle - 14.00.
H4 should start at the beginning of the next H4 candle etc.
File Name
Each file created should have a unique file name made up of Metatrader logon (Account number of the account, Date (format yyyymmdd), Broker time that the extract was performed (24 hour format hhmm)
An example of a file name
50796986 Account number | 20230309 Date | 1605 Broker time |
|
|
|
The filename would look like this:
50796986202303091605
File content
File to contain values under the column headings from the trade tab of the toolbox. The required columns are listed below and See example at the end of this section.
Note that there are two additional columns required:
A column should be added with the time of the file creation (Timestamp). This column allows a time based analysis of the individual open positions.
A column should be added for the terminal login (not the hashed number created by MT5 for the data folder)
I will be combining different files from different accounts, so I need to know where the transactions originated!
File columns
ticket
time[Entry]
type
volume
price[entry]
SL
TP
Price [at the time of the extract]
Value
Swap,
Profit
Magic
Comment
Terminal Login
Timestamp of report
The order of the columns or rows is not important if an existing function provides it in a different sequence.
e.g. Copied from a trade terminal but with the new time created column added. (see zip file attached)
File location
Write each file to an standard Metatrader folder for the terminal: MLQ5/shared projects. Using the naming requirement will mean that every file has a unique name.
Conclusion
Let me know what else you need or if you think there is a different way to do this.
Ian Fraser