EA log & Screenshot Mailer

Post Reply
biobier
Trader
Posts: 72
Joined: Mon Mar 18, 2019 7:24 am

EA log & Screenshot Mailer

Post by biobier »

Hi,

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:
mailer_Input.png
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
If you have a super loaded machine you might need to adjust the wait times for the external commands:

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
At your MQL4\Files folder a log of the mail program is stored. Usefull to check if you think mails got not send.
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
You do not have the required permissions to view the files attached to this post.
Last edited by biobier on Fri Jan 08, 2021 10:39 pm, edited 7 times in total.
Must-reads for FOREX NOOBS as me:
Help for Newbies.
Information For Beginners
biobier
Trader
Posts: 72
Joined: Mon Mar 18, 2019 7:24 am

EA log & Screenshot Mailer

Post by biobier »

New version 1.01 in above post fixing a bug that for single digit days and months.
Must-reads for FOREX NOOBS as me:
Help for Newbies.
Information For Beginners
biobier
Trader
Posts: 72
Joined: Mon Mar 18, 2019 7:24 am

EA log & Screenshot Mailer

Post by biobier »

New version 1.02 in first post.
Added
  • runOnlyAtHourOfDayVal Run only at a specific day of the week. Set to -1 to disable
  • runOnlyAtDayOfWeekVal Run only at a specific hour of the day. Set to -1 to disable
With this trades could be followed up further within the mail to see if they got stopped out or closed by an EA.

As usually feedback is welcome.
Must-reads for FOREX NOOBS as me:
Help for Newbies.
Information For Beginners
Post Reply

Return to “Automated trading systems”