Русский 中文 Español Deutsch 日本語 Português
Practical Use of the Virtual Private Server (VPS) for Autotrading

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

MetaTrader 4Examples | 6 August 2007, 09:33
5 747 4
Mykola Revych
Mykola Revych

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: http://fileshare.in.ua/20222

To enter Windows use the following:

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

Download the file w2k3.img at http://fileshare.in.ua/20222 (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) http://prostohosting.com/services/vps.html
  2. SSH-client http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html
  3. File interchange with VPS, WinSCP program : http://www.listsoft.ru/programs/16038/
  4. The official site of QEMU for Linux http://fabrice.bellard.free.fr/qemu/
  5. The official site of QEMU for Windows http://www.h7.dion.ne.jp/~qemu-win/
  6. Installation of QEMU in Linux : http://mydebianblog.blogspot.com/2006/07/qemu.html
  7. Discription of the virtual machine QEMU http://jack.kiev.ua/docs/qemu-doc-ru.html#SEC8
  8. Free task planner nnCron http://www.nncron.ru/download_ru.shtml


Translated from Russian by MetaQuotes Ltd.
Original article: https://www.mql5.com/ru/articles/1478

Last comments | Go to discussion (4)
[Deleted] | 12 Aug 2007 at 09:59
... At last

MetaTrader on Linux VPS

Wow, many thank's, will try it
Mykola Revych
Mykola 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)

http://fileshare.in.ua/59733
login : 1CMaster
password : 123
[Deleted] | 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


Khurram18487
Khurram18487 | 31 May 2017 at 06:21
Can I use single VPS to different computer?  For instance I have VPS at home for my forex trading and the same VPS can be use on my Office PC. Does it effect anything?
How to Cut an EA Code for an Easier Life and Fewer Errors How to Cut an EA Code for an Easier Life and Fewer Errors
A simple concept described in the article allows those developing automated trading systems in MQL4 to simplify existing trading systems, as well as reduce time needed for development of new systems due to shorter codes.
Price Forecasting Using Neural Networks Price Forecasting Using Neural Networks
Many traders speak about neural networks, but what they are and what they really can is known to few people. This article sheds some light on the world of artificial intelligence. It describes, how to prepare correctly the data for the network. Here you will also find an example of forecasting using means of the program Matlab.
Creation of an Automated Trading System Creation of an Automated Trading System
You must admit that it sounds alluringly - you become a fortunate possessor of a program that can develop for you a profitable automated trading system (ATC) within a few minutes. All you need is to enter desirable inputs and press Enter. And - here you are, take your ATC tested and having positive expected payoff. Where thousands of people spend thousands of hours on developing that very unique ATC, which will "wine and dine", these statements soundб to put it mildly, very hollow. On the one hand, this really looks a little larger than life... However, to my mind, this problem can be solved.
ZUP - Universal ZigZag with Pesavento Patterns. Part 2 ZUP - Universal ZigZag with Pesavento Patterns. Part 2
ZUP - Universal ZigZag with Pesavento Patterns. Part 2 - Description of Embedded Tools