VPS restarted and screw up trading terminal

VPS restarted and screw up trading terminal

7 September 2015, 13:19
Teck Hua Chew

This post is relevant, if you are running an EA (Expert Advisor). If you are using VPS (Virtual Private Server). This post is about your VPS restarted while you are sleeping and dreaming about the growth you gonna make when your EA did some successful trades. Then when you went to logon to VPS using RDP (Remote Desktop Protocol). You realize none of your terminals are running, when you went on to look at your account. It's too late. The opened position has moved 100 pips and you got a margin call. You have lost thousands of dollars and your heart thumping very fast and your blood pressure went up and you suddenly feel the heat from your head to your chest and to your tummy. Yep, you got screwed by your VPS restarting without notice. Well, even if it did notice you, you will still be fast asleep. So how can we prevent this from happening?

Here is a solution that is feasible. This can be prevented by editing some settings on your Windows VPS. I am going to proceed to show the steps, with screen shots on how you can do that. I am using Vultr with Windows Server 2012. This method should work with Windows Server 2008 as well.

I will divide the information into 3 parts. Mainly

1) Enable autologon.
2) Create the script that execute the terminals.
3) Execute script using task scheduler.

I will cut the crap and goes down to the parts.

Part 1 - Enable Autologon

Using the search function, search for "Run" and execute "Run". A "Run" box will pops out as shown in the screenshot.
Enter "control userpasswords2" and press "OK".
A "User Accounts" box will pops out as shown in the screenshot.
Uncheck, "Users must enter a user name and password to use this computer."
A "Automatically sign in" box will pops out as shown in the screenshot. Enter your logon password and press "OK"
And automatic logon set up is completed.

Many may have a question in mind here, doesn't this has security issue?

Answer: It's considered more vulnerable because windows auto logon without password. But, if you are logging in using a RDP, you will still need to enter the password to log on to RDP, it's a RDP credential requirement.

Part 2 - Creating the scripts that execute the terminals

It's very simple and fast to create a batch script for our agenda. First, we open a notepad. Everybody knows how to open a notepad right? You definitely don't need an IT degree to do it. After you open up the notepad, simple put the lines in as per the example shown in the screenshot.

start "TickMill" "C:\Program Files (x86)\MT4 TickMill\terminal.exe"
timeout 10 /nobreak

Line 1 means: start the executable from that said path.
Line 2 means: wait for 10 seconds before executing next line. nobreak means even if you press a key, it will not break the execution.

Save the notepad to your VPS desktop as ".bat" file. And we are done with creating the batch script.
Example: "start terminal.bat"

Something to take note: Most likely you are unable to see the extension of the file type. You can do the following steps to allow the viewing of file extensions.
Go to Control Panel -> Folder Options -> View -> Uncheck "Hide extensions for know file types" as shown in the screenshot below.

 Part 3 - Execute script using task scheduler

After having the autologon, and the script, now is to run the script. What we need to do is use the task scheduler to run the script whenever windows logon.
Go to Administrative Tools -> Task Scheduler

On the right of the screen, you will see "Create Basic Task", Click on it. Go through the wizard, entering the name of the task. Click Next.

This is the key important setting here. Enter the trigger, "When I log on". Next.

Select "Start a program". Next.

Browse to the startup batch file you saved earlier on the desktop. Next.

And all the steps are completed. Now you can try to restart your VPS and see if everything startup nicely after restarting. Now you don't have to worry about your VPS restarting while you are sleeping, because they will be back up within minutes.

You may view the fruits of the settings by viewing through the web console, while you restart from your RDP. Look at the automation start up of the terminals.

If you will like to register with vultr, please use this referral link: http://www.vultr.com/?ref=6845027
You can also pm me to know more about the VPS. Cheers!

Share it with friends: