Categories
How to set up VPS for EAs/Indicators on MT4 & MT5? (using MQL4 and MQL5)
VPS Hosting on MT4 and MT5< by MQL4/MQL5
Virtual hosting (VPS) is a service that allows you to ensure round-the-clock operation of the client terminal.
This may be necessary in the following cases:
- There is a trading robot running or script written to order automatically;
- There is an expert adviser bought in the Market;
- Subscribed to Signal.
In all these cases, it is necessary to ensure a permanent connection to the trading server and uninterrupted power supply to the computer.
Using a home computer for these methods is not always possible and acceptable.
The MT4 and MT5 trading platform offers all traders a convenient and fast way to solve this problem.
You can rent a VPS for your trading account directly from the client terminal.
A significant advantage of this service compared to renting conventional VDS or VPS from third-party companies is the ability to select a server that is located closest to your broker, which allows you to minimize network delays when sending orders from the terminal to the trading server.
Payment for using the service is carried out conveniently through the MQL4 and MQL5 community account.
If you don’t have an account yet, you can register for free. The account must be specified in the terminal settings.
How to setup VPS server for MT4 and MT5
To get a VPS for use, connect with the required trading account and click on the “Select virtual server” command in the context menu of the “Navigator” window.
The VPS wizard will automatically select the closest server to your broker.
The window will immediately show how much the ping (network delay) will decrease compared to your current connection.
The lower the network delay between your platform and the broker’s server, the better the trades will be executed: slippage and the likelihood of getting requotes will decrease.
Select the appropriate plan and click “Next”.
The set of tariff plans and their cost are determined by the hosting company.
The selected tariff plan can be changed after the end of the rental period.
If an MQL4/MQL5 account was not specified in the trading platform settings, a pop-up window will prompt you to do so.
Hosting can be rented only if you have a valid MQL4/MQL5 community account.
Click “Next” and check all the details: the trading account for which the VPS will be rented, as well as the subscription cost.
To continue, you must agree to the terms of the shared hosting service.
If you want the rental period to be extended at the same rate after the end of the current subscription, enable the option “Automatically renew subscription when there are funds and terminal activity”.
Renewal is carried out only if your MQL4/MQL5 community account has enough funds to pay the rent, and also if the leased server is running at the time of renewal.
After clicking the “Next” button, the server rental process will be completed, and your account will be charged at the selected rate.
If the lease is canceled by the user, the rental price is not refundable.
You can immediately start migrating your terminal environment to the VPS.
Select the type of migration you want and click “Migrate Now”. If the terminal is not prepared yet, click Finish and migrate later.
Open MT4/MT5 account to get the VPS
How to make a payment for VPS hostings
If your MQL4/MQL5 community account does not have enough funds to pay for hosting, it is not necessary to go to the website and make a deposit.
Hosting can be paid directly through one of many payment systems.
Just click “Next” after choosing a plan. Choose the appropriate method and make the payment.
In order for you to always have a transparent and understandable history of rented hostings, and not to search for them using different payment systems, the required amount will first be credited to your MQL4/MQL5 community account, and then payment will be made from it.
After payment, you will proceed to the final stage of the VPS lease, where you can immediately migrate.
How to migrate your account to VPS hosting
Migration is the process of transferring the current active environment from a client terminal to a virtual one.
This is a simple and unambiguous way to set up the composition of running programs, open charts and subscription parameters on a VPS.
Before launching a VPS, it is necessary to prepare an active environment for it such as charts, running indicators and expert advisors, options for copying transactions by subscription, and terminal settings.
Migration of Charts and Market Watch
Set up in the “Market Watch” window the list of symbols that are necessary for the operation of your Expert Advisors.
It is better to remove all unnecessary symbols in order to reduce tick traffic to the terminal.
It makes no sense to keep a hundred symbols in the Market Watch if only a pair is used for trading.
Open only the charts you need, and close all unnecessary ones.
Although there are no restrictions on the number of open charts, it makes no sense to keep unnecessary ones. The color settings of the graphs do not matter.
In the terminal settings, in the “Charts” tab, specify the value of the “Max bars per window” parameter.
Some custom indicators are written in an uneconomical way and make calculations for the entire history available in the chart.
In this case, the smaller the value, the better.
But first make sure that the indicator works correctly with these settings and restart the terminal after changing this parameter.
The VPS is designed in such a way that it automatically downloads all available history from the trading server, but no more than 500,000 bars will be available on the chart.
Open MT4/MT5 account to get the VPS
Migration of Indicators and Expert Advisors
Put on the charts all the indicators and expert advisers necessary for the autonomous trading of the terminal.
Most EAs don’t refer to indicators on charts, do some revision and decide what you really need.
Products purchased from the Market and launched on the chart are also transferred during migration.
DLL calls are completely prohibited in a VPS. The first time you try to call a function from a DLL, the running program will be stopped with a critical error.
Charts without Expert Advisors do not participate in synchronization of the platform with the VPS, even if custom indicators are running on them.
To migrate a separately working custom indicator, launch an “empty” Expert Advisor on its chart that does not perform any actions.
It can be easily generated via the MQL4/MQL5 Wizard in MetaEditor by selecting the “Expert Advisor: Template” item.
This ensures that custom indicators are migrated.
All external parameters of indicators and expert advisers must be set correctly, check them again before starting synchronization.
Scripts cannot be migrated during migration, even if they were running in an infinite loop on the chart at the moment of synchronization.
Settings for the Mail, FTP and Signals sections
If the EA needs to send email, upload data via FTP or copy transactions by subscription, then you need to register all the necessary settings.
Be sure to specify the correct login and password for your MQL4/MQL5 community account in the “Community” tab.
This is necessary for copying signals.
Permission to trade and copy signals
The VPS always has permission for automatic trading.
Therefore, any Expert Advisor running at the moment of synchronization, which has trading functions, will be able to trade on the VPS after the transfer.
Do not run Expert Advisors on charts that you are not sure about.
When migrating Expert Advisors in the local client terminal, autotrading is disabled.
This is done to protect against the situation when two terminals are opened with the same account and the same Expert Advisor trades on them at the same time.
Regardless of whether automatic trading is enabled or disabled on your client terminal or in the properties of a particular running Expert Advisor, any Expert Advisor, when transferred to a VPS, will receive full permission to trade.
Specify the required parameters for copying trades in the “Signals” section.
If the trading account has an active subscription and copying trades is allowed, then at the time of the migration in the client terminal, the permission to copy the signal will be reset.
This is done to protect against the situation when two terminals are opened with the same account and copy the same transactions at the same time.
When migrating again with a signal already running on the VPS, enabling signal copying on the local terminal is not required.
On a VPS, the setting “Synchronize positions without confirmation” is always enabled.
The VPS does not have a user interface, transactions are copied only automatically, and it is not possible to confirm them manually.
Copying trades will be automatically enabled on the VPS when the migration is performed.
The message about canceling copying on the client terminal will also be duplicated in the log.
Types of Migration to MQL4/MQL5 VPS
Migration is performed at each synchronization of the client terminal.
Synchronization always works in one direction – the environment of the client terminal is delivered to the virtual one, but never vice versa.
The status of a VPS can be monitored using requests for terminal logs and experts, as well as VPS monitoring data.
To perform synchronization, call the context menu and select the type of migration.
There are several types of migration that should be used depending on the purpose:
- All
- Required if you want to simultaneously run Expert Advisors/Indicators in the terminal and copy trades by subscription. In this mode, account connection data, all open charts, signal copying settings, all running Expert Advisors and indicators, as well as FTP and mail settings are transferred to the VPS.
- Experts
- Only experts and indicators, if subscription to signals is not required. In contrast to the full mode, this mode does not transfer the signal subscription settings.
- Signals
- Only copying trades by subscription. In this case, only settings for copying the Signal are transferred, no charts and programs. In this mode, data for connecting to an account, settings for signal copying, as well as FTP and mail settings are transferred to the VPS.
Thus, at any time you can change the number of charts and the list of symbols in the Data Window, the composition of running programs and their input parameters, terminal settings and subscription to Signals.
During the first synchronization, all available history for open charts is automatically downloaded.
The process of downloading history from the trading server does not occur instantly and may take some time, so the programs launched on the charts must correctly handle the situation with updating the history.
When migration is performed, all information is written to the log of the client terminal.
After the synchronization is completed, open the VPS log to view the activities performed on it.
In the log viewer window that opens, you can specify a text fragment by which the log entries will be filtered, set the desired interval, and then click the “Request” button to download the found entries.
The VPS logs themselves are updated each time they are requested and saved to the [terminal data directory]\logs\hosting.*.terminal\ folder.
The migration process has a number of features:
- Automated trading in the VPS is always allowed, even if it was disabled by the terminal settings or in the settings of the running Expert Advisor.
- Scripts are not transferred during migration, even if they were launched in an infinite loop on the chart at the moment of synchronization.
- Charts with non-standard timeframes and symbols are not transferred.
Configuration of VPS setting
The status of a leased VPS can also be easily controlled from the client terminal.
Using the server context menu in the Navigator window, you can:
- View information about the VPS.
- Synchronize environment – perform an immediate migration.
- Request a log of the terminal and expert advisers.
- Stop the VPS.
- Cancel VPS hosting.
To view information about a VPS, call the “Details” command in its context menu.
The information is presented on several tabs.
The following information is displayed here:
- Hosting server name and ID of your VPS.
- Ping in milliseconds characterizing the network delay between the VPS and your broker’s trading server.
- VPS status: running, stopped. Here you can also enable / disable the VPS, as well as cancel the lease.
- The tariff chosen when allocating the server.
- The date of registration, the MQL4/MQL5 community account to which registration was made, as well as the current balance of this account.
- The date of the last synchronization and its type. Here you can immediately synchronize the current environment of the terminal.
Open MT4/MT5 account to get the VPS
How to check the CPU, Memory, and Hard Disk Usage
CPU Usage
This shows a graph of CPU utilization in percent.
Memory Usage
This is a graph of RAM usage.
Hard Disk Usage
This shows a graph of disk space usage.
VPS log
To control the operation of a VPS, you can view its log.
In the log viewer window that opens, you can specify a text fragment by which the log entries will be filtered, set the desired interval, and then click the “Request” button to download the found entries.
Here you can choose the type of log:
- Terminal
- Records of all events taking place in the terminal, including trading operations.
- Expert Advisors
- Information about the work of Expert Advisors and indicators.
The VPS logs themselves are updated each time they are requested and saved to the [terminal data directory]\logs\hosting.*.terminal\ folder.
If too many records are requested, then only a portion of the first records for the specified period is loaded.
This prevents performance degradation when logs are too large.
Stopping the server & Hosting cancellation
Stopping the server means temporarily shutting down the VPS.
The action is similar to closing the terminal on a computer.
It is performed using the “Stop server” command in the context menu of the server in the “Navigator” window.
To start the terminal, execute the “Start server” command.
Cancellation of hosting means termination of provision of the VPS and complete removal of the VPS.
When hosting is canceled, the terminal is completely deleted along with all the data transferred to it during migration.
When hosting is canceled, payment is not refundable.
Refund of the rental cost is possible only within 24 hours after the allocation of the VPS.
To stop hosting, execute the command “Cancel Hosting” in the context menu of the server in the “Navigator” window.
Transferring VPS hosting to another trading account
VPS is rented for a specific trading account, but it can be transferred to other trading accounts at any time.
Open the “Hosting” section in your MQL4/MQL5 community profile.
Find the subscription you want, click the gear button, and select Transfer.
Next, specify a new trading account (login) and, if necessary, a new server (broker), then click “Transfer”.
Open the trading platform and connect to the account to which the VPS hosting was transferred.
Through the context menu of the account in the “Navigator”, start the server and migrate the trading environment.