Distributed Processing or Backtesting of Forex Strategies Using MQL5

I have recently started to dabble in MQL5. It is the new language used by the MT5 platform for currency trading. One of the greatest features that I can see so far is the ability to scale your processing. At first this theory might sound a bit advanced but I will show you how easy it can be.

If you have ever used MQL4 or MT4 then you know one of the biggest drawbacks is the application will only use one of your processors when you are backtesting a strategy. Another one of the biggest drawbacks is if your backtests has tons of data it can take literally hours or days to crunch your test. This is a big nuisance. However, with MQL5 these problems have been resolved.

First let’s take a look at a backtest. You can see in this image below that I’m running 8 processors in my current machine. They are all being utilized. You can also see the “remote” agents which is emtpy. Below I will take you through the steps of creating a remote agent.

The first thing you want to do is search your PC for a file named metatester.exe or metatester64.exe. Depending if you are planning on deploying a 64-bit remote agent or a 32-bit remote agent.

The next thing you are going to want to do is copy this file to your remote PC which will be doing the remote processing. I created a folder on my remote PC on the root of my C:\ drive named metatester. So my full path will be C:\MetaTester\metatester.exe

Once I have copied this file to my remote machine I’m going to run it. Below is what you will see when you do this. There are only 2 options the password you want to use and the port you want to use. In my case for demo purposes I use MySecurePassword and port 2000 (the default) then I simply click the add button. If your remote PC has multiple processors then you should increase the TCP port to 2001 and add another service instance. You should do this for as many processors as your remote machine has. Incrementing the port number by one every time.

If you now open your services console you will see a new service set on startup on your remote machine. You will see multiple instances of this if you have more than 1 processor.

Now that we have successfully deployed a remote agent we must go back to our main machine where we are backtesting our EA or expert advisor. From the Agents tab on the strategy tester window you are going to want to right click on “Remote” and select “Add”, see below.

You will now see the image below. You can type in anything for the first field which is “name” it does not matter. For the second field you must type in the IP address of your other machine or hostname. Then simply type the password in from when you configured the service and click ok.

That is it you can see now you have successfully added a remote agent. Mine is erased to protect the identify of my computer.



Share
Tagged with: , , , , , , , , , , , , , , , , , , , , ,
Posted in Forex, Metatrader, MQL5

Facebook comments:

Leave a Reply

Your email address will not be published. Required fields are marked *

*


*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>