Have you ever experienced your Empty4(MT5) crashing down or freezing?
I think everybody has. It sucks. I know. When it happens your EA does not
have control over your orders anymore.
I have written small PowerShell script. This script automatically starts
your Empty4 an checks out if terminal.exe is running and is responsive in regular intervals.
If your Empty4 crashes down (not running) it will start it again and send you an email message.
If your Empty4 runs but is not responding (terminal freezes) it will kill it and start again with email notification.
Installation:
1. Log in your gmail account.
2. Go to https://www.google.com/settings/security/lesssecureapps
3. Allow access for less secure applications
4. Run PowerShell.exe as Administrator then execute these commands:
Code: Select all
Set-ExecutionPolicy Unrestricted
$cred = Get-Credential (input your gmail username and passwors)
$cred | Export-CliXml c:\scripts\cred.clixml6. Edit your input parameters:
Code: Select all
################################################### external input
$PathTerminal = 'e:\MT.DEMO\Empty4\FxPro.VTS\terminal.exe'
$WorkingDirectory = 'e:\MT.DEMO\Empty4\FxPro.VTS'
$ArgumentList = '/portable'
$message = 'Terminal Nitro+ has started'
$CheckOutInterval = 60 #seconds
$WaitForNonRespondingTerminal = 60 #seconds
$params = @{
From = 'StartTerminal@gmail.com'
To = 'john.smith@gmail.com'
SmtpServer = 'smtp.gmail.com'
Port = 587
Credential = Import-CliXml c:\scripts\cred.clixml
UseSsl = $true
}
################################################### external inputIt is done!
You can automatically run it after computer start with "Task Scheduler" in Windows.
This is my first attempt to write PS script. Any recommendations how to improve script are welcomed.
I have also appended terminal.exe for simulating non responsive process. Just click on "Freeze me!" button.
Zentrader
