I had a big need for a way to follow up correct behaviour of EA' at my >10 demo accounts. Therefore I created an EA that will send new screenshots (or any other files desired), which are created in the MQL4\Files folder by EA's, together with a tail of the Empty4 experts or journal log.
The EA uses robocopy which is integrated since windows 7 / Server 2008 R2 (the only tool that can get files that are in use by other processes).
Also it requires an external tool to send a mail as Empty4 can not send attachments. The default inputs MailApp & MailParams are set for the free program blat.
These are the inputs: Some info on the maybe not obvious inputs:
- EmailCc carbon copy recipient list. NOTE: it is not added as parameter -cc at default MailParams add -cc %EmailCc% if you want to use it.
- MailParams Here you can find the other inputs beeing inserted to the command line for the mail app to be passed by. Additionally there is %LogFile% which is a file path to be used as body content of the mail but also %Attachments% which will be filled with the attachements seperated by comma.
- copyCmdToClipboard is good for testing the command if the mail sending does not work for you.
- NumOfLastLines means how many lines from the bottom of the log should be added to the mail body. If the log is smaller than this all available lines will be added.
- AttachmentFileFilter is the filter for the files to be added to the mail. It can be .csv or anything else.
- IgnoreFIlesOnFirstRun will not care about files to be picked up when the expert was started. Only new files will trigger a mail.
- AttachmentDeleteOnceSend will delete files once they are processed. Attention. If the mail sending by the external tool failes for what ever reason, the files are deleted anyhow as the expert does not know if the mail was send fine.
- runOnlyAtHourOfDayVal Run only at a specific day of the week (0 means Sunday,1,2,3,4,5,6). Set to -1 to disable
- runOnlyAtDayOfWeekVal Run only at a specific hour of the day. Set to -1 to disable
Code: Select all
int AwaitTimeRoboCopy = 1500; //Milli seconds to wait for robocopy execution (needed to get the log from Empty4)
int AppExecutionWait = 5000; //MSeconds to wait for the send process
int AttachmentWait = 1000; //MSeconds in addition per attached screenshot
To make Empty4 to update the log file, requires to open the log folder once (it will be close directly again). This should happen very quickly, however you might recognize that a explorer window get closed.
Subscribe this thread if you want to get notified for updates.
Cheers
Biobier