Download MetaTrader 5

How to Prepare a Trading Account for Migration to Virtual Hosting

1 October 2014, 11:03
MetaQuotes Software Corp.
57 712

MetaTrader client terminal is perfect for automating trading strategies. It has all tools necessary for trading robot developers powerful C++ based MQL4/MQL5 programming language, convenient MetaEditor development environment and multi-threaded strategy tester that supports distributed computing in MQL5 Cloud Network. In this article, you will find out how to move your client terminal to the virtual environment with all custom elements. 

How to Provide the Reliable Round-the-Clock Operation of the Terminal?

A trader may need a terminal running 24 hours a day in the following three cases:

All these cases require constant connection to a trade server and uninterrupted power supply. Using a home PC is not always possible and convenient. Until recently, the most popular solution has been renting allocated computing capacities as VDS or VPS from specialized companies.

MetaTrader platform offers much more convenient and quick solution ‒ you can rent a virtual server for your trading account right from the client terminal.

What Is a Virtual Terminal

Virtual terminal has been developed specifically for working in Virtual Hosting Cloud network offering rental services. Any trader may rent a ready-made virtual server with already arranged trading environment in a few mouse clicks right from the client terminal.

Allocating a Virtual Server

To receive a virtual terminal, select the appropriate trading account and execute "Register a Virtual Server" command in the context menu.

Virtual Hosting Wizard window appears. It shows how the virtual hosting network works. The process of obtaining a virtual server consists of three steps. First, you will find out how to prepare for migration. After that, you will select the nearest virtual server with minimal network latency to your broker's trade server.

You can choose 1440 free minutes provided to each registered user or select one of the offered service plans. Finally, you will select the data migration mode depending on your objectives:

  • complete migration is necessary if you want to simultaneously launch Expert Advisors/indicators and trade copying;
  • only Expert Advisors and indicators if subscription to signals is not required;
  • only trade copying - only Signal copying settings (no charts or programs) are moved.

There are no limitations on the number of charts and Expert Advisors/indicators. The number of activations for products purchased in the Market is not decreased when launching them on a virtual terminal.

After selecting the migration mode, you can launch the virtual server immediately by clicking "Migrate now" or do that later at any time.

Congratulations! Now, you have your own virtual server with MetaTrader terminal ready for work!

Preparing for Migration

Before launching the virtual terminal, you should prepare an active environment for it - charts, launched indicators and Expert Advisors, Signal copying parameters and the terminal settings.

Charts and Market Watch

In the Market Watch, set up the list of symbols critical for your Expert Advisors' operation. We recommend that you remove all unnecessary symbols to decrease the tick traffic received by the terminal. There is no point in keeping hundreds of symbols in the "Market Watch" if only a couple of them are used for trading.

Open only the charts that you really need. Although there are no limitations on the number of open charts, there is no point in opening unnecessary ones. Color settings do not matter.

Set "Max bars in chart" parameter in Charts tab of the terminal settings. Some custom indicators are developed in a wasteful way and perform calculations on all history available on the chart. In that case, the lesser the specified value, the better. However, make sure that the indicator works correctly with these settings by restarting the terminal after changing this parameter.

The virtual terminal has been designed so that it automatically downloads all available history from a trade server, but not more than 500 000 bars are available on a chart.

Indicators and Expert Advisors

Apply to the charts all indicators and Expert Advisors that are necessary for the terminal's autonomous operation. Most trading robots do not refer to indicators on the charts, so check out and decide what you really need. 

Products purchased on the Market and launched on the chart are also moved during migration. They remain completely functional, and the number of available activations is not decreased. Automatic licensing of purchased products without spending available activations is provided only for the virtual terminal.

DLL calls are completely forbidden in the virtual terminal. During the first attempt to call a function from DLL, the launched program is stopped with the critical error.

All external parameters of indicators and Expert Advisors should be set correctly. Check them once again before launching synchronization.

Scripts cannot be moved during migration even if they have been launched in an endless loop on the chart at the time of synchronization.

Virtual terminal can be automatically restarted when it is updated through the LiveUpdate, as well as during the maintenance of virtual hosting. Thus, all the programs intended to operate on the virtual platform must correctly process terminal stop and restart in order to correctly continue their operation after these events.

Terminal global variables are not migrated to the virtual hosting. If you need to initialize lots of variables when starting a program, you can use reading from files that can be passed using the "#property tester_file" directive.

Sending Files

If a certain file is required for an Expert Advisor or indicator, you can send it to the virtual terminal by specifying a #property parameter:

  • #property tester_file "data_file_name"- for sending a file from <data_folder>\MQL5\Files or <data_folder>\MQL4\Files
  • #property tester_indicator "indicator_name" - for sending a custom indicator from <data_folder>\MQL5\Indicators or <data_folder>\MQL4\Indicators
  • #property tester_library - "library_name" - for sending a library from <data_folder>\MQL5\Libraries or <data_folder>\MQL4\Libraries

Please note that called libraries are identified and sent to the hosting automatically during the migration even if they are not specified. Therefore, you do not need to specify them. Also, you do not need to specify indicators that are explicitly called in the code by their names via the iCustom() function.

When migrating, these directives are identified by the terminal and the necessary files are sent. The file size should not exceed 64 MB.

Sample code for sending files of the following three types to the virtual terminal:

    #property tester_file "trade_patterns.csv"    // A data file an Expert Advisor is to work with. It should be specified if needed on the hosting
    #property tester_indicator "smoothed_ma.ex5"  // Custom indicator file if the indicator name can be identified
    #property tester_library - "alglib.ex5"       // Library of the functions called in an Expert Advisor. You do not need to specify it

Configuring Email, FTP and Signals

If an Expert Advisor is to send emails, upload data via FTP or copy Signal trades, make sure to specify all necessary settings. Set correct login and password of your account in Community tab. This is necessary for Signal copying.

It is highly recommended that you specify your MetaQuotes ID and allow sending messages of performed trades in Notifications tab. Thus, you will stay aware of what is going on at your trading account without even opening your terminal.

Permission to Trade and Signal Copying

The automated trading is always allowed in the virtual terminal. Therefore, any Expert Advisor with trading functions launched during synchronization can trade on the virtual terminal after the migration. Do not launch the Expert Advisors you are not sure about.

Regardless of whether autotrading is allowed or forbidden in your client terminal or in the properties of a launched Expert Advisor, any trading robot is allowed to trade after being moved to the virtual terminal.

Set necessary trade copying parameters in Signals tab. If a trading account has an active subscription and trade copying is allowed, permission to copy signals is disabled in the client terminal during migration. This is done in order to prevent the situation when two terminals connected to the same account copy the same trades simultaneously.

Trade copying is automatically enabled on the virtual terminal when migration is complete. Message about copy cancellation in the client terminal is also repeated in the journal.

Setting WebRequest

If a program that is to operate in the virtual terminal uses WebRequest() function for sending HTTP requests, you should set permission and list all trusted URLs in Expert Advisors tab.


Migration is transferring the current active environment from the client terminal to the virtual one. This is a simple and straightforward way to change the set of launched programs, open charts and subscription parameters in the virtual terminal.

Migration is performed during each synchronization of the client terminal. Synchronization is always a one-direction process - the client terminal's environment is moved to the virtual terminal but never vice versa. The virtual terminal status can be monitored via requesting the terminal's and Expert Advisors' logs as well as virtual server's monitoring data.

To perform synchronization, execute "Synchronize Environment" command and select migration type.

Thus, you always can change the number of charts and the list of symbols in the Data Window, the set of launched programs and their input parameters, the terminal settings and Signal subscription.

When performing migration, all data is recorded in the client terminal's log.

After the synchronization, open the virtual terminal's main journal to examine the actions performed on it.

In the newly opened log window, you can set a piece of text the journal entries are to be filtered by and a desired interval. After that, click Request to download the found logs.

Virtual terminal logs themselves are updated at each request and saved in <terminal data folder>/logs/hosting.<hosting_ID>.terminal and <terminal data folder>/logs/hosting.<hosting_ID>.experts.

Working with the Virtual Terminal

The rented virtual server status can also be easily monitored from the client terminal. Execute "Details" command in the context menu.

The newly opened dialog window shows the virtual server's monitoring data:

  • CPU usage graph, %;
  • memory usage graph, Mb;
  • hard disk usage graph, Mb.

The main tab contains data on the virtual server itself and the terminal's active environment:

  1. server name and rent number;
  2. rent start date, account and trading account status;
  3. used service plan and remaining rental time;
  4. status  - started or stopped.

Besides, the following data is displayed for the virtual terminal:

  • last migration date and mode;
  • data on Signal subscription's migration and disabling trade copying on the client terminal (if an active subscription is present);
  • number of opened charts, Expert Advisors/indicators launched on it, moved EX4/EX5 libraries and created files.

The context menu of the rented server's icon is also used to launch and stop the virtual terminal. The rent can also be canceled there. No refund is provided in case of an early cancellation.

Virtual Hosting Is the Best Solution for the Automated Trading!

The benefits of the virtual hosting service are evident:

  • fast and easy way to receive a virtual server directly from the client terminal;
  • ability to examine and test the service within free 1440 minutes that can be used in parts;
  • ready-made and configured virtual terminal;
  • flexible service plans with discounts depending on a rental period duration;
  • ability to select location with the minimum network latency to your broker's trade server;
  • you can easily pay rental fees using your unified account. Ability to pay from a trading account is underway.

What do traders need to be able to perform the automated trading round-the-clock or copy trading signals? They need transparent and intuitive service that ensures reliable terminal operation with a guaranteed connection to a trade server and requires minimum efforts from a user.

Virtual hosting solves these issues - simply choose a virtual server and use your free 1440 minutes to check it out!

See also:

Translated from Russian by MetaQuotes Software Corp.
Original article:

Last comments | Go to discussion (89)
Manish Khanchandani
Manish Khanchandani | 24 Dec 2015 at 01:05

I tried to use the virtual server facility by mql5.

when i synchronize, it has one problem,

it seems to be not working properly, my EA calculates on every 30 min chart and in between it rest and does not do any calculation, so after 30 mins, i dont see it calculating, but when i click synch after 30 min, it calculates and creates order and then it dont calculate again till i synch, i.e. it is only calculating when i click synchronize button else it is not doing anything, locally it is working fine, is it some setting which i have to set to make it run all the time. 

forexverified | 29 Jun 2016 at 05:32

Can someone clarify for me?  

 "DLL calls are completely forbidden in the virtual terminal. During the first attempt to call a function from DLL, the launched program is stopped with the critical error."

Does that really mean that no EAs that use a DLL file can be used?  Why not figure out a way to allow this since most (all?) commercial EAs and trade copiers use DLL calls.

Ghadaffi Khalid
Ghadaffi Khalid | 14 Jul 2016 at 07:01

Hi, this is my first time posting here and I have question about using Metaquotes Virtual Terminal.

As for now, I'm not running any EA's but I want to store my indicator data such as Spread Monitoring Indicator on that chart for reference.

I've been running my PC 24 hours for about a year now to save the data. I want to know can I do the same if I use Virtual Terminal since my PC got problem sometimes.

I want all the spread bars available whenever I opened my MT4 

Attached the picture of the spread indicator on my chart.

NinjaForex | 11 Sep 2016 at 14:19

Thanks For Tutorial Info ,,,


Funny Papers Trading, LLC
James Dewey | 21 Sep 2016 at 16:06

as of this morning,the 2 NY City server's we're using are no longer responding. Called MQL5 New York 1:64298" and "MQL5 New York 1:63056. The MT4 journal error says: "2016.09.21 09:26:35.614 Virtual Hosting: failed to connect to server' MQL5 New York 1'


We are successfully connected to virtual servers in other locations. 

Our questions: is any one else experiencing the same thing (or have you in the past, and what if anything did you do to resolve it)? And second, are we able to switch to a different virtual, and if so, what is the procedure we have to follow?


thanks! we have been successfully using virtual hosting for our Signals for nearly two months now, and this is our first hiccup.  

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.

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.

Using text files for storing input parameters of Expert Advisors, indicators and scripts Using text files for storing input parameters of Expert Advisors, indicators and scripts

The article describes the application of text files for storing dynamic objects, arrays and other variables used as properties of Expert Advisors, indicators and scripts. The files serve as a convenient addition to the functionality of standard tools offered by MQL languages.