Download MetaTrader 5

Practical Use of the Virtual Private Server (VPS) for Autotrading

6 August 2007, 09:33
Nick Revych
2 145

Setting a Task: Finding a Working Place for Robots

Each autotrader has its trading robots that trade in financial markets, and a computer, on which these Expert Advisors run and operate. One launches Expert Advisors at home, another at work, the third one on the friends' server or a dedicated server. What is clear, is that Expert Advisors need a working place (office), and traders want less woe, connected with this office.

All the enumerated offices have their advantages and disadvantages, so I will not labor the point. I will offer my own variant. So, we have a task to find an office for the operation of trading robots, which will meet the following requirements: remote installation, connection from any point of the world, quick setup, quick failure recovery, easy migration, entire archive backup, preferably first-class hardware, protection, system upgrade with such services as trading reports publishing, quotes, etc. And preferably not too expensive.

Choosing an Office for the Autotrading

The task is set. Let us begin our search. A home computer does not suit. A computer at work does not suit at all, moreover the management "interferes". Friends offer a terminal access to the server, but they often overcharge it, and I don't want to depend on anyone. What is left is a dedicated server. To rent a server or buy your own is cool. But one has to look after it, and, frankly speaking, I am lazy about it. A dedicated server requires much time and power. So, let us dwell on a new possibility - VPS. VPS is a virtual private server. The powerful server divides its resources between 30-40 users, each having his own virtual copy or simulator of a full-blown PC (server). Be honest, I decided on a VPS at once. It differs from other offers and meets my requirements to an office for Expert Advisors. The only thing left to decide on is a platform: Windows VPS or Linux VPS? Here I didn't think much. I have worked with both operating systems. I hate the first one and love the second. Pity, I have no MetaTrader 4 for Linux, I wouldn't have any problems. But life is not that easy...

(General scheme of the trading area components)

Arranging a Remote Office

Now we need to run MetaTrader 4 under Linux. So, MetaTrader works under Wine (an emulator of Windows), but not all the buttons function interactively. I.e. the system operates unreliably by now. So, let us run MetaTrader 4 under VMWare, Xen and QEMU on a virtual privat server. If it doesn't work, we will rent Windows VPS.

Installation of a Virtual Machine QEMU

VMWare, Xen did not operate on the VPS, while they needed a peculiar module in Linux kernel, and VPS does not allow this. QEMU functioned without an accelerator. Let us decide on it:

  1. buy Linux VPS with a preinstalled operating system Ubuntu Dapper (for example, here);
  2. download SSH-client (all Linux systems are remotely controlled through such clients) here;
  3. connect to the server:

  4. install virtual QEMU from the repository (a storage of programs, which is connected on default) using commands:
    aptitude search qemu,
    aptitude install qemu

    (in Linux all program distributives are saved in repository and are easily installed, as described earlier)

Creating the Image of Windows 2003 Server + Terminal Services

The virtual machine is ready for the start. All we need is to create the image of Windows Server 2003 with activated terminal servers for the virtual QEMU. Creating the image of Windows Server 2003+ Terminal Services is quite a complicated procedure.

Creating the image involves the following steps:

  1. creating a file of several gigabytes' size;
  2. starting QEMU with start key from CD drive;
  3. installing Windows 2003 Server;
  4. activating terminal services;
  5. installing network card drivers.

It is the most difficult stage. But you can omit it and get the ready image here:

To enter Windows use the following:

  • login: Administrator
  • password: no. You can set your own password

Download the file w2k3.img at (image of Windows 2003 Server for a virtual machine) onto your private server into any folder. For the file interchange with your server you will need WinSCP program. It can load files directly onto your private server.

Starting a Remote Office

You can start Windows 2003 Server image under a virtual machine on a remote private server using the task planner AT or locating it in the autorun (/etc/rc.local). First install the task scheduler for Linux using the command 'aptitude install at'. Also install Midnight Commander (analogue of Norton Commander) using the command 'aptitude install mc'. Midnight Commander is started by the command 'mc'. After that the following window will appear:

Using the task planner, a virtual machine with Windows image is started using the commands:

Autostart of a Virtual Machine

After the starting procedure is completed, press Enter, and then Ctrl-D. I would recommend to locate the start of the virtual machine in Autostart (file /etc/rc. local). But before this you will need the additional program of divided sessions (screen). Install this program using commands:

  • aptitude search screen
  • aptitude install screen

After that open the file /etc/rc.local and write there the autostart of the virtual machine with Windows image of the server.

Check that the virtual machine is started with the command ps ax.

So, the virtual machine is started with Windows image. End working with the server using the command exit:

Connecting to a Remote Office

Connect to the remote terminal server in a common way: Start - Programs - Standard - Connection - Remote Desktop Connection.

As a result we get the following server with started MetaTrader 4.0:

You can install on VPS also FTP- and Web-servers, your own Forum and other services. This article does not contain the information about their installation.

List of Web-Sites

  1. Providing a virtual private server (VPS)
  2. SSH-client
  3. File interchange with VPS, WinSCP program :
  4. The official site of QEMU for Linux
  5. The official site of QEMU for Windows
  6. Installation of QEMU in Linux :
  7. Discription of the virtual machine QEMU
  8. Free task planner nnCron

Translated from Russian by MetaQuotes Software Corp.
Original article:

Last comments | Go to discussion (3)
MQL4 Comments
MQL4 Comments | 12 Aug 2007 at 09:59
... At last

MetaTrader on Linux VPS

Wow, many thank's, will try it
Nick Revych
Nick Revych | 13 Aug 2007 at 09:35
New Version TradeServer2in1_w2k_v2.0 -under Windows 2000 Server + DevCon.exe  :)
(Qemu + Windows 2000 Server + Activated Terminal Services + NOD32 + nnCron + DevCon + Far + MT4)
login : 1CMaster
password : 123
MQL4 Comments
MQL4 Comments | 23 Aug 2008 at 12:15

i go off topic, you sau" You can install on VPS also FTP- and Web-servers, your own Forum and other services" i'd like make a my website based on wordpress with a forum and e-Commerce Shopping Carts. what is a good solution and is there a guide that explain how to do that?

You are grat !CMaster

Step on New Rails: Custom Indicators in MQL5 Step on New Rails: Custom Indicators in MQL5

I will not list all of the new possibilities and features of the new terminal and language. They are numerous, and some novelties are worth the discussion in a separate article. Also there is no code here, written with object-oriented programming, it is a too serous topic to be simply mentioned in a context as additional advantages for developers. In this article we will consider the indicators, their structure, drawing, types and their programming details, as compared to MQL4. I hope that this article will be useful both for beginners and experienced developers, maybe some of them will find something new.

Here Comes the New MetaTrader 5 and MQL5 Here Comes the New MetaTrader 5 and MQL5

This is just a brief review of MetaTrader 5. I can't describe all the system's new features for such a short time period - the testing started on 2009.09.09. This is a symbolical date, and I am sure it will be a lucky number. A few days have passed since I got the beta version of the MetaTrader 5 terminal and MQL5. I haven't managed to try all its features, but I am already impressed.

Portfolio trading in MetaTrader 4 Portfolio trading in MetaTrader 4

The article reveals the portfolio trading principles and their application to Forex market. A few simple mathematical portfolio arrangement models are considered. The article contains examples of practical implementation of the portfolio trading in MetaTrader 4: portfolio indicator and Expert Advisor for semi-automated trading. The elements of trading strategies, as well as their advantages and pitfalls are described.

False trigger protection for Trading Robot False trigger protection for Trading Robot

Profitability of trading systems is defined not only by logic and precision of analyzing the financial instrument dynamics, but also by the quality of the performance algorithm of this logic. False trigger is typical for low quality performance of the main logic of a trading robot. Ways of solving the specified problem are considered in this article.