Using MetaTrader 5 (MT5) Agents on Amazon servers VPS/VDS. This is an excellent option for checking the trading strategy for the currency and stock markets Forex, CFD and Futures.
MetaTrader 4 (MT4) does not have Test Agents.
The difference from the use of the Agents cloud:
Agents are run with the flag “/local” as with local use.
The cost of using Amazon servers can be much more economical than using the Cloud of Agents. Calculation of the cost of the Cloud occurs by a mysterious formula, so it is very difficult to estimate the cost of full optimization.
Prices for spot-instances are available here.
But after registration, the table is available that can be obtained by creating a spot-instance (blue “Request Spot Instances” button) and clicking on the gray “Change instance type” button.
There is a special instance:
cc2.8xlarge CPUs 32 Memory 60.5GiB SSD 4 x 840 GB
The price ranges from $0.20 to $0.30 per hour, which corresponds to instances with 16 CPUs. This instance has an out-of-date status and can periodically disappear from the list of available instances. It makes sense to view all 4 US regions for its availability before ordering the instance.
The cc2.8xlarge is ideal for Agents.
It makes sense in four US regions to create a rule for Security Groups.
N. Virginia, Ohio, N. California, Oregon
You need to open ports for access from outside. Since the server will exist for a limited time and will not be used for public purposes. You can not bother with the choice of ports and open them all, although this is contrary to security rules.
You need to create a Role with access rights to the bucket S3.
You can create access keys for using programs to upload files to the S3 bucket. These keys also allow you to receive spot prices from all regions in AmazonUtils. Forgotten access keys in a source code can cause trouble (RU).
The download should be done for each region in which the Agents are scheduled to be launched.
In the Spot Requests click on the blue “Request Spot Instances” button.
A new request design will appear, in which all the settings are hidden under “Additional configurations”. You can switch to the old design at the very bottom of the page by “Previous version of Request Spot Instances”.
In the new design, select “Defined duration workloads”.
The script I created for running Agents is designed for Ubuntu.
I usually choose cc2.8xlarge with a built-in SSD on 840GB. It is often a great discount, because this instance of the previous generation, but for Agents it is great.
If the instance has built-in disk space, then the number of gigabytes for EBS can be set at a minimum (paid separately).
All Agents are run in “/mnt”. The first partition of the built-in disk is automatically mounted in this folder. If the size of the first partition is not enough, then you need to take an instance only with EBS or edit the script. Add a second partition does not make sense, because it will be the last.
Set the rule for opening ports in “Security groups”.
If you use a pre-created role in the “IAM instance profile”, then the script does not need to specify the key to Amazon.
Open the aws_ubuntu_user_data.sh and paste the contents into “User data”.
After clicking on the blue button “Launch” a request to create an instance.
Instance can be issued by Amazon with a delay, so you need to update the page until it appears in the “Instances” list.
After that, you can go to the instance page and click on the gray “Connect” button to get the IP.
Now you can add Agents to the list for optimization in MetaTrader 5 (MT5).
The script needs time (approximately 5 minutes) to run Agents in Ubuntu.