In this blog post, I’ll show you how to improve MT4 performance and how to make sure your Expert Advisors and indicators are not suffering from unnecessary delays.
This literally allows you to speed up MT4 software when it is used on multi-core processor VPS servers. In this example, I will use one of my MT4 apps to demonstrate how to identify this problem and how to fix this, but you might experience the same problem with any other MT4 app in general.
Recently I have been receiving quite a lot of emails where people complain that my Local Trade Copier software is working very slowly. Results have been quite different for most of those trade copier users, but on average they have experienced somewhere between 10 to 60-second delay when copying trades. That is huge and not tolerable and should be fixed.
However, what I’ve found out is that everything is okay with my software and the problem comes from the MT4 platform when it runs on a multi-core CPU Virtual Private Server (VPS).
Do not get confused. Even if your hosting provider says that your VPS server has 1x CPU (processor) which has 4x cores, you will still experience MT4 performance problems. Yes, those CPU cores are virtual, they are not real, but that’s actually is the problem. If they were real MT4 would work fine. So it does not matter if your VPS has a 1x CPU with multiple cores or multiple CPUs, you need to use a special configuration to make your MT4 work efficiently.
So it is actually wise to choose VPS servers with just one single CPU and if you need more you can always rent an additional VPS server. Or, you can rent a dedicated server that does not have these problems and you can usually run dozens of MT4 instances on multi-core CPU platforms.
Normally the trade copier software should synchronize trades every 400 milliseconds, which is basically 2 times every second, and you can adjust the sync rate to make it work even faster. I’ve had this “slow copier” problem as well in the past so I want to share with you how to solve this problem.
This “slow MT4” problem is quite well known to programmers and there are lots of discussions about MT4 and multi-core processors. However, I do not want to throw technical terms and explanations at you. I just want to show you how to solve the problem when your MT4 is running slowly.
And even if your MT4 does not seem to run slowly, by applying this trick you might even be able to run more MT4 client terminals on the same VPS server.
Technically, the problem is that MT4 is a 32-bit application and this gives trouble to work efficiently on multi-core processor VPS (like Dual-core, Quad-core, etc).
This problem appears when you are running multiple MT4 client terminals on the same VPS server and this server has a multi-core CPU. Usually, the multi-core CPU on a VPS server is a “virtual CPU”, which means those CPU cores are not real physical CPU’s. They are virtual CPU cores. We just call it “virtualization”.
If you are running a single MT4 instance you should not face problems like this. This should not be a problem as well if you are running multiple MT4 instances on the VPS server that has only a single CPU. If you are running some simple MT4 app like this Partial Close EA then you might not face these problems as well.
But if your VPS server has more than one CPU and you are running more than one MT4 platform you will definitely see a delay in trade execution and other software operations.
How many CPU cores your VPS server has?
Here’s how to know how many CPU cores your VPS server has.
Click the right mouse button somewhere on the task-bar at the bottom of your Windows screen and in the pop-up menu choose “Start Task Manager“.
When the “Task Manager” window loads up you need to switch to the “Performance” tab where you’ll see if you have multiple CPU cores or not.
In the picture above you can see this VPS server has 4x CPU cores.
The specifications of this VPS server are as follows:
- AMD Opteron(tm) Processor 6136 (4 CPUs) ~2.4Ghz.
- 8GB RAM Memory.
- VPS system runs on a VMWare Virtual Platform.
If you switch to the “Processes” tab, you’ll find terminal.exe‘s in the process list. This is your MT4 processes and what you need to do is to set each of them to use the same CPU core.
By default, each process uses all CPU cores and in our case, this creates a problem for MT4.
To make this process more simple I suggest sorting that “Process” list by name by clicking on the column that says “Image Name“.
In this Task Manager process list, we see that there are 4x MT4 instances running. Each of those MT4 platforms runs several MT4 Copier EA instances which makes a total of 9x EA’s running on this VPS.
CPU Usage in the picture above is shown as 19% but it is actually jumping between 19% and 36% all the time. At a first glance, anyone might say that a CPU load of 36% or even 60% is not a big deal and VPS should work fine, however, this “CPU Usage” number seems to be incorrect in such a case.
The whole VPS system is working very slowly and it is even difficult to switch between windows. If I try to switch to another MT4 platform window I have to wait about 20-60 seconds. Obviously, trade copying on such a server would take ages and you would experience huge delays and price differences. I even had the same problem with only 2x MT4 instances and only two copiers EA’s (Server EA and Client EA).
A simple trick to make MT4 run faster on multi-core CPU servers
Now here’s a simple trick you need to apply to make MT4 client terminals (and of course all apps running inside these terminals) work faster. There are two options.
For some, option #1 helps speed up MT4, while others find only option #2 is actually helping.
Option #1: Set all terminal.exe processes to use the same CPU core.
To apply option #1 you need to set all terminal.exe processes to use the same CPU. It does not really matter which CPU core you’ll choose to use, what’s important is that all MT4 processes should use the same.
To make it simple I always set all terminal.exe‘s to use CPU0. This way MT4 will not need to split operations between multiple CPU’s and it will work faster.
It’s really easy to do and I will explain how it’s done a bit later, so keep reading.
IMPORTANT! If you leave one terminal.exe process using more than one CPU this trick will not work. It’s very important to have all terminal.exe‘s to use the same and only one CPU.
Option #2: Set each terminal.exe process to use a different CPU core.
If option #1 does not help you should also try option #2. To apply option #2 you need to set each terminal.exe process to use a different CPU core. Say your VPS has 4x CPU cores and you run 4x MT4 instances. Then all 4x MT4 instances should be set as follows:
- MT4 instance #1 should use CPU0
- MT4 instance #2 should use CPU1
- MT4 instance #3 should use CPU2
- MT4 instance #4 should use CPU3
If you have more MT4 platforms than you have CPU cores, you should close the rest of the MT4 instances (at least for testing purposes) to see if this option #2 solution helps you at all.
How to set MT4 to use certain CPU core
Configuring MT4, or any other process from the list, to use only a certain processor is quite easy. You need to switch to the “Processes” tab, choose the terminal.exe process from the list, click the right mouse button on that item, and choose “Set Affinity” from the pop-up menu.
In the “Processor Affinity” window you need to deselect all CPU cores and select only CPU0 like in the picture below.
When I did this for all 4x MT4 instances I am running on my VPS all of them started to work efficiently. I can now switch between windows easily and CPU Usage dropped as well to 16% – 29% (even though I still think this number does not show correct values on VPS servers).
Obviously, I can copy trades at the fastest speed possible. Trades are transferred between the MT4 platform in under 1 second now.
MT4 Trade Copier speed is just one piece of the puzzle
I would mention that Local Trade Copier’s speed has little to do with how fast your trades are copied between MT4 platforms. In most cases, delays come from the problems like slow MT4 (like in this example), poor internet connection, or even execution delays from your broker. There were even cases when brokers delay trade execution on purpose for some economic news scalpers/traders.
To list all potential problems that affect trade copying speed I would list them in the following order (where 1st item is the most common problem and the last item is the least common problem):
- Slow MT4 performance because of the multi-core CPU VPS server.
- Too many MT4 client terminals running on the same VPS server.
- Slow MT4 performance because of too many 3rd party indicators or Expert Advisors running on the MT4 terminal.
- Slow VPS performance because of 3rd party software (anti-virus, firewall, Internet browsers, and other apps).
- Poor internet connection. I know all VPS providers will say that their connection is high quality, but even world-class services have issues from time to time. Keep this in mind. On the other hand, it’s not necessary your service provider is the one to blame for a bad Internet connection. There can be several or even dozen servers/gateways in between your VPS and your broker’s server.
- Your MT4 app problem.
I won’t deny that my MT4 apps or MT4 copier might have problems running on your MT4 or your VPS. This has happened in the past and I did a lot of work to fix this. However, based on the last few years and tens of solved “slow trade copying” cases I’ve noticed that it’s always MT4, VPS, or Internet connection problem. When you finally fix the problem with the trade copying speed you can even try to copy your Forex trades at a better price.
How to know if your LTC copier is slow
So how to know if it’s the Local Trade Copier working slow and does not copy trades fast enough or is it that the problem lies in the slow execution from your broker?
That’s quite simple. Both, Server EA and Client EA have special counters in the blue dashboard that are growing on each synchronization cycle. Server EA has a “Server send” counter and Client EA has a “Server read” counter.
If counters on all LTC EA instances are growing steadily, consistently, and rapidly (according to your SyncRate setting in the EA Inputs), then it looks like your copier is working fine. If you see one of those counters growing slow and randomly, you should apply option #1 and/or option #2 solutions explained earlier in this article.
If counters on all LTC EA’s are growing steadily and consistently, but trades are still copied slowly, then you should also check the execution time. After each copied trade Client EA will print information in the “Experts” tab at the bottom of the MT4 client terminal about the trade execution speed, price deviation, and slippage.
In the picture above you can see Client EA reported that it took 203ms to execute the trade. This obviously does not include the synchronization time (the time required for the copier to actually send the signal from the master to the client account).
These 203ms are the time spent to deliver the “open trade” request to the broker’s server, actually, get the trade executed and receive a confirmation answer from the broker’s server.
In other words, this is out of control for the trade copier software or any other MT4 app. This depends on how fast your Internet connection is and how fast your broker’s execution speed is.
Under normal conditions, you should get an execution delay somewhere between 50-300 ms. If you want to get this close to 1ms, or something like that, you should rent a VPS server which is on the same network as your broker’s server. You can contact your broker to find out such information.
For example, there’s only about 35ms latency between one of HotForex Data Centers and the vpsforextrader.com network. And if you want even better latency you can rent a VPS server located in the Netherlands. This company has a network there too.
In the picture above we also see that the copier reported actual price deviation on the copied trade comparing it to the original trade’s open price.
In this case, there was a price difference of 0.6 pips which is considered very low under such circumstances.
This report also included slippage which was zero in this case. Slippage is something you cannot avoid, but the first thing you need to find out is whether the slippage you get is the result of a bad Internet connection or it’s your VPS server running slowly.
Trade copier speed troubleshooting checklist
- After each trade is copied there will be a message logged in the “Experts” tab which gives the exact slippage and delays in ms. This way you can know if a delay is coming from the broker/internet connection. If you get an execution delay between 50ms and 300ms then your Internet connection and broker is working fine.
- Check if “Server read” and “Server send” counters are growing steadily or randomly. If one of these counters grow randomly, with delays, then it means your computer is slowing down the trade copier software.
- Check if your VPS server has multiple CPUs or just a single CPU. If you have a single CPU then try closing 3rd party applications and remove other EAs and indicators from your MT4 to make it work faster. If this does not help then maybe you are running too many MT4 instances and/or simply need to get a better and more powerful computer.
- If your VPS server has multiple CPU cores then you might suffer from the well-known MT4 issue that it cannot work efficiently on multiple CPU core machines. In that case, you would have to set all terminal.exe’s to use the same CPU. This can be done from the “Processes” tab in the “Task Manager” window. You need to select each terminal.exe and choose “Set Affinity“. Then in the CPU list window, you need to select which CPUs each process should use. The idea here is to try two operational modes: 1) Set all terminal.exe’s to use the same CPU0; 2) Set each terminal.exe to use a different CPU.
If you have tried all that above and still have slow trade copying speed you should contact me.
If your MT4 is running slowly and your VPS server provider tells you that everything is okay on their side, you should check if your VPS is a multi-core CPU machine. MT4 cannot work efficiently on multi-core CPU VPS servers and requires some additional configuration.
I hope that this article has helped you find the cause of your slow MT4 problem and possibly fix it.
So, have you suffered from this problem before? Or maybe you are still struggling to find a solution to this? If you tried all that, did it helped? Please post your comments below.