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:
- buy Linux VPS with a preinstalled operating system Ubuntu Dapper (for example, here);
- download SSH-client (all Linux systems are remotely controlled through such clients)
- connect to the server:
- 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:
- creating a file of several gigabytes' size;
- starting QEMU with start key from CD drive;
- installing Windows 2003 Server;
- activating terminal services;
- 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 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
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
- Providing a virtual private server (VPS) http://prostohosting.com/services/vps.html
- SSH-client http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html
- File interchange with VPS, WinSCP program : http://www.listsoft.ru/programs/16038/
- The official site of QEMU for Linux http://fabrice.bellard.free.fr/qemu/
- The official site of QEMU for Windows http://www.h7.dion.ne.jp/~qemu-win/
- Installation of QEMU in Linux : http://mydebianblog.blogspot.com/2006/07/qemu.html
- Discription of the virtual machine QEMU http://jack.kiev.ua/docs/qemu-doc-ru.html#SEC8
- Free task planner nnCron http://www.nncron.ru/download_ru.shtml
Translated from Russian by MetaQuotes Software Corp.
Original article: https://www.mql5.com/ru/articles/1478