Proven Ways to Fix Expert Advisor Problems on MetaTrader 4
To be honest, I am not sure why I did not wrote this blog post earlier. For years people have been contacting me with various problems they have with their Expert Advisors and MetaTrader 4 platform. Obviously, they do have problems with my MT4 apps as well from time to time, but that’s pretty normal because every individual has it’s own knowledge base and there are no one who knows everything.
I’ve been running my software business since 2009 and during those years I have received thousands of email messages with various questions from currency traders. What I have learned during those years is that in most cases there is nothing wrong with the Expert Advisor or even the MetaTrader 4 client terminal. The problem is the lack of knowledge and the shortage of content available online that explains how to solve these problems.
Sure, it is easy to find basic lessons on how to use MT4 platform or even video tutorials on MT4, but as you might already know these lessons cover only the most basic stuff. Of course that is more than enough for anyone to learn and start using MetaTrader 4, but the problem begins when you face some difficulties and something is not working as it should.
I cannot promise that the information I provide in this article will solve all problems you might face with EAs, but I am sure that in most cases you’ll find these simple steps can remove most problems in minutes or even seconds.
Below you’ll find the checklist you should go through before you report any problem you have with MT4 apps. And I do not mean this should be used only on my MT4 apps. This stuff works with any MT4 EA, Indicator or script.
MT4 Apps Troubleshooting Checklist
The list of things that are most likely to fix Expert Advisors problems on MT4 client terminal:
- “Autotrading” option should be turned on in the top toolbar of the MT4 terminal window.
- “Allow live trading” option should be selected in the “EA Properties” window. Look for smiley face in the right-top corner of the chart.
- “Long & Short” positions should be enabled for normal Expert Advisor operation.
- For some EA’s the “Allow DLL imports” option should be selected in the “EA Properties” window.
- For some EA’s the “Allow import of external experts” option should be selected in the “EA Properties” window.
- Check configuration in the “Tools -> Options -> Expert Advisors” window.
- Check the “Experts” tab for error messages at the bottom of the MT4 terminal window.
- Check the “Journal” tab for error messages at the bottom of the MT4 terminal window.
- Check if MT4 terminal is connected to the broker server.
- Check if your Internet connection has no problems.
- Make sure MT4 app can authorize license key (if applicable).
- Restart MT4 client terminal.
- Check if your computer has multi-core CPU.
- Read instruction manual and double check everything.
- Contact technical support.
Now let me give you as much details as I can on each of those checklist items.
1. Is Autotrading enabled?
One of the most common problems when running EAs is that MT4 has “Autotrading” option disabled. Obviously that is for your own safety which protects you from any problems that can arise if you accidentally run EA without even knowing much about it. I mean if you are new to MT4 and just started using it, any EA or script might do damage to your account if you use it incorrectly. This is why Autotrading is disabled by default.
Once you are ready to use Autotrading you can enable this option in the top toolbar of your MT4. Look for a button which reads “Autotrading” (in earlier MT4 versions this button was called “Expert Advisors”).
Green “Autotrading” button indicates that Expert Advisors are enabled on MT4.
Red “Autotrading” button indicates that Expert Advisors are disabled on MT4.
So if at any time you want to stop all trading robots running on your MT4 you can simply disable “Autotrading” option. However, not all EAs are created equally. Some may still continue to work and perform some of their operations, but you can be sure that under any circumstances no EA will be able to perform any trading operation if you have “Autotrading” disabled.
Also keep in mind that by default MT4 client terminal will disable Autotrading option once you change “Profile” (File -> Profiles) or log into a different account. This is to protect you from an unwanted EA operations once you change accounts.
Imagine if you are logged into account #1 where you have EA running that is suppose to close all trades when equity drops below 1000 USD. What if you switch to account #2 which has equity of 500 USD? EA would immediately close all positions. For this reason MT4 added this security option and all EAs would get disabled if you change accounts.
This MT4 behavior can be changed from the “Tools -> Options -> Expert Advisors” window. We will get back to this a bit later in section 6.
2. Is trading allowed for Expert Advisor?
A very common problem is that people do not realize that trading for the EA must be enabled when it is attached to the chart. By default it is disabled for security reasons.
When you attach the EA to the chart you’ll see “Expert Advisor Properties” window like this one below.
If this option is not selected the EA will not be able to perform any trading operations. This means this can also be used as an additional tool if you want to disable certain EA from trading. Sometimes I use this if I need temporary solution to stop EA from trading. It will continue to do it’s job like it normally would, but it will show an error when it attempts to open, modify or close a trade. In such case EA would receive an error code of 4109 (ERR_TRADE_NOT_ALLOWED). In human language normally this is translated as “Trade is not allowed“.
3. Is Expert Advisor allowed to trade in both directions?
This one is quite rare, but I’ve seen some cases when people set the EA to trade only in one particular direction and then later they forget about this and complain that their EA takes trades only in one direction.
In the example above we see EA is configured to take Long and Short positions (which is default setting), but this option allows you to set the EA trade only in one particular direction. Say if you select “Long only” option then EA will not be allowed to open Short positions. In that case EA would return error code 4111 (ERR_SHORTS_NOT_ALLOWED). In human language this is translated as “Shorts are not allowed“. Alternatively if your EA was set to trade in “Short only” mode then each time it tried to place a Long order you would see error code 4110 (ERR_LONGS_NOT_ALLOWED). In human language that is translated as “Longs are not allowed“.
4. Are DLL libraries enabled?
Many MT4 apps these days are using DLL libraries and usage of them is disabled by default in all MT4 client terminals. This is done for security reasons. You should be careful with MT4 apps that use DLL libraries. You should only use such apps if you obtain them from a trusted software provider.
I know this sounds like a bad thing, but it literally can be, because DLL files can be programmed to have access to all files on your computer. I do not want to scare you off using MT4 apps that use DLL files, just want to let you know how this works.
For example, almost every EA that I’ve created use DLL library file. Obviously I use clean code. The purpose of the DLL is to add a special function to the EA so it could connect to my server for license key authorization. I’ve been working very hard on this to make it as simple as possible and to not annoy customer in any way.
Because my apps use DLL library you cannot run them if you have “Allow DLL imports” option disabled. So if EA you are trying to use does not work, make sure you check if it uses any DLL libraries and if you should enabled this option.
If you try to run Expert Advisor which needs to use DLL library, but you have them disabled by unchecking the “Allow DLL imports” option, you would normally see error message like this in the “Experts” tab.
In the example above I’ve tried to run Hedge EA trading tool with DLL library calls disabled and this is the error I got: Cannot call ‘hedge_ea_18_personal.dll::auth’, DLL is not allowed.
Another problem I face with a DLL files is that they are usually not trusted by Anti-Virus software. There were some cases when my clean DLL files have been detected as false positive for virus. After I contacted anti-virus company and they’ve checked the code of my DLL, it was added to their white-list, but this situation still created unwanted inconvenience.
For this reason I have taken an extra step and requested to get a signed security certificate which is now attached almost to every single app that I create. This creates a “better relationship” with anti-virus programs, but still do not remove a problem of false positive detection in some cases.
My point with this is that even clean DLL libraries can be detected as viruses (even though it’s false positive), but this does not mean you should not be careful. DLL files can definitely contain viruses or other malware code.
Here’s how auto-installer of my Local Trade Copier app looks like with the signed security certificate issued by COMODO when you run it on the computer. Obviously my DLL library files are signed by the same certificate as well.
When such window appears on your computer running my software, you can click “Show details” and you’ll be able to view the certificate and its details. Not many individual programmers are verified. In most cases you only see big software companies have such certificates. Most of the programmers are not verified publishers. I am telling this not to brag, I am saying that you should be careful and watch what software you install on your computer. Also note that such protection appears on Windows computers and only if you have “User Account Control” enabled in the “Control Panel“.
If you are worried that some unknown file on your computer might contain a virus you can check it at VirusTotal – Free Online Virus, Malware and URL Scanner. When you upload a file to this website they will check it with like 50+ anti-virus programs. If you see that almost all of them detect a virus then it is obvious that this particular file is dangerous. If none or just couple of these applications detect your file as suspicious, chances are that it’s a false positive.
5. Is import of external experts enabled?
Okay, so this one is quite rare, but there still might be EAs that require this to be enabled in order to work properly. Personally I do not use this so my apps do not require import of external experts to be enabled.
If you feel your EA may not work because of this you should try running it with the “Allow import of external experts” option selected in the “EA Properties” window.
Also note, that your EA might start and work properly for some time and only later stop working if this option is disabled. Only the creator of your EA might know how this should be set for sure. Also, this might be explained in the instruction manual if you have received one with your EA.
6. Check default Expert Advisors settings
There is a special settings window in the MT4 that you can access from the top menu “Tools -> Options -> Expert Advisors“.
This is where you can set default settings for EA execution.
In the picture above you can see I have “Allow automated trading” and “Allow DLL imports” options selected. This sets my MT4 terminal to have “Allow DLL imports” selected by default when I attach new EA to the chart (as explained above in section 4).
Also this is where you can configure whether MT4 should disable Autotrading once you log into a different account (or change “Profile“) or not. I have mentioned this in section 1.
7. Are there any error messages in the “Experts” tab?
This is where most of the problems might be solved. I mean it. This tab logs every action from every EA that is running on your account. Also, EAs are usually configured to print user-friendly error messages in there as well. Of course not all EAs are created equally, but when I create EAs I always try to print as much information as possible to let the user be aware of what’s going on on his MT4 terminal and what problems EA might be facing at the moment.
A simple example is where EA tries to open a position but it fails. I have set this app to open 100 lot size position and once I click BUY button the app obviously tries to complete this command. However broker server rejects the trade as there is not enough money in the account and TOC app receives a response from the broker server with the error code 134 (ERR_NOT_ENOUGH_MONEY). This simply means “Not enough money“.
Those who check “Experts” tab for error messages might solve their problems faster by themselves. In this particular example it is obvious that we need more money in the account or use a smaller lot size.
Those who do not check “Experts” tab for error messages might not even understand why the trade was not opened. Obviously they would put all the blame on the Expert Advisor. However, in this, like in many other cases, the problem is not in the EA.
Even if your EA gives just an error code with no explanation you can still find out what it means if you look at this list of MQL4 Error codes.
Also, important to mention that all these messages logged in the “Experts” tab are also stored in special log files that can be accessed anytime on your computer. Experts log files are stored in the \Data Folder\MQL4\Logs\
You can also access these log files faster by clicking the right mouse button inside the “Experts” tab and choosing “Open“. Here’s another article I wrote about how to read log files and actually understand them.
When you report any problem with the EA to the company, you should include the log files from that folder.
For me it is very important to solve the problems associated with my software, but I need a little bit of help from my customers as well. Ideally, people should check for any potential solution in this guide and the instruction manual first. If that does not help, I usually ask people to send me the following information so I could investigate the case.
- List of all trade numbers from the MT4 account involved in the incident.
- Log files from MT4 platform located at \Data Folder\MQL4\Logs\ (do not confuse them with the \Data Folder\logs\ because these files does not help)
- Screenshot of the MT4 platform with the EA dashboard visible or the chart where EA is attached.
“Data Folder” can be opened from your MT4 platform by going to “File -> Open Data Folder“.
If customer sends me a question “My EA does not work. Why?” I really cannot help much with just this information.
8. Are there any error messages in the “Journal” tab?
The “Journal” tab is not that useful as the “Experts” tab, but in some cases it might give you quite useful and important information. Let’s take the same example we used before. When “Not enough money” error was logged in the “Experts” tab the same was logged in the “Journal” tab as well.
However, when you troubleshoot EAs, such information might not be useful because this does not tell us if this request to open a position was sent by an Expert Advisor or by a human (manually).
I would say that the “Journal” tab is more useful when you are looking for messages about the connection problems. MT4 logs them here.
Those who check “Journal” tab for error messages might solve their problems faster by themselves.
Also, important to mention that all these messages logged in the “Journal” tab are also stored in special log files that can be accessed anytime on your computer. Journal log files are stored in the \Data Folder\logs\
You can also access these log files faster by clicking the right mouse button inside the “Journal” tab and choosing “Open“.
9. Is your MT4 terminal connected to the broker server?
The most simple way to check if your MT4 terminal is connected to the broker server or not is to look at the bottom-right corner of the terminal window. If it reads “No connection“, or “Invalid Account“, or “Account Suspended“, or anything like that, this means you are not connected and trading is not possible.
When MT4 terminal is connected, it will typically display the counter at the bottom-right corner, which indicates how much data were downloaded from the broker server.
Here’s another great idea how to check whether your MT4 terminal is connected to the broker server or not. If the clock in the “Market Watch” window is running and price quotes are updating constantly then your terminal is connected to the broker server.
If “Market Watch” window is not updating then your MT4 terminal is not connected to the broker server or it is weekend and the market is closed.
10. Is your Internet connection stable?
Check if your Internet connection has no problems. The most simple way to do this is to open your Internet Browser and visit a few websites on the Internet.
Also, you should close all 3rd party applications that might use high bandwidth of your Internet connection. I have in mind Torrent software and other similar downloader apps
You can also check with your Internet service provider and ask if everything is okay on their side if you suspect you have a slow Internet connection.
11. Is EA able to authorize its license key?
If your MT4 app needs to authorize with the vendor server, make sure there are no Internet connection problems and you can access vendor’s website. Firewall or Anti-Virus software on your computer might be blocking connection.
For example most of my MT4 apps use license key. Once you purchase a software from me you get a license key that must be used with the software. Obviously this license key must be authorized by establishing a connection to my web-server. If any 3rd party software on your computer blocks this connection the EA will not be able to authorize and run.
Not all MT4 apps work that way, but there are certainly many that do so. If you can access this blog post from the same computer where you have one of my apps giving you trouble with the authorization, this means your connection is good and the problem is somewhere else. Then you should double check if you enter correct license key and if there are no spaces or other characters around it.
If you are using software from someone else you should contact that particular company/author.
12. Have you tried restarting MT4 terminal?
It cannot be more simple than this, yet many people do not think about it. If you tried most or all of the things discussed on this page and you still experience problems a simple MT4 restart might solve the problem.
To restart MT4 you simply need to close the main MT4 terminal window and after 15-30 seconds start MT4 again.
If things look weird with MT4 window or it cannot respond at all, you should check if there are no MT4 process “stuck” in memory. With the latest MT4 version this does not happen much, but still there is a chance.
To check if there is an MT4 process stuck in memory you need to open “Task Manager” window by clicking right-mouse button on the bottom task bar and choosing “Start Task Manager“.
Once “Task Manager” window is loaded you need to switch to the “Processes” tab and see if there are any “terminal.exe” processes on that list. Sorting the list by “Image Name” helps a lot in this situation.
If you have all MT4 windows closed and you see terminal.exe processes on this list you should end them. To end a process you need to select it and click “End Process” button. When you end all terminal.exe processes you can start your MT4 terminal. You should end processes in such way only if you feel your MT4’s are stuck in memory and do not respond or even do not show main window.
13. Is your MT4 slow because of multi-core CPU?
I have discovered this problem last year. Basically it sounds like this. If you are running MT4 client terminal on a multi-core CPU machine then all MT4 terminals might work very slow. This seems to be the case only on those computers and VPS servers that have multi-core CPU processors. I have already explained how to check and solve this problem in detail in another blog post and people call it the most effective solution to speed up your MetaTrader 4 platform.
14. Have you read instruction manual?
Okay, I admit that this is the most boring thing to do in the world. I’ve never read instruction manual before in my life until I was forced to write one for my MT4 app. Yes, that’s true. I know how boring that is and that most people think it is a waste of time. But believe me, instruction manuals are written for a reason. Actually that’s pretty obvious. If you get an instruction manual of 100 pages do not freak out. It might be that 80% of that document is just pictures and you will read it all in just 10 minutes or so.
Also, if you scan through the table of contents you might see that some sections of the manual is not relevant to you at this moment and you can just read the ones that are important.
And my favorite method of reading instruction manuals is that I read first few pages, which usually contain the most important information, and then I just read the headlines of other pages. If I find that this is relevant for me I will read the entire page.
For example the instruction manual of my MT4 trade mirroring software is quite long, but there are sections that explain things like “How to create an image of your MT4 terminal” which might be not relevant to many people. It won’t do any harm if you skip this, and when you finally need to learn this you’ll know where to find it.
Also, I always use search feature to find things I need. For example you want to find out what UseSmartBreakout option does in my Trendline Trader software. It would be quite boring to read all the instruction manual so you can just use search function (Ctrl+F in Adobe Reader) to find this text and read only what interests you.
15. Do you really need to contact technical support?
When you contact your FX broker you expect them to respond fast. Many brokers even offer live chat support. I’ve been using this a lot lately and I must say it’s awesome. You can open websites from 20 different brokers and copy/paste the same question to all of them almost at the same time. In just a few minutes you’ll have an answer from all of them. So this saves you hours of your time as you do not need to read all of the content on each website.
However, when you contact technical support team of one person, like for example me, then it’s obvious that he will not be able to answer instantly. If all 8 work hours a day that I have would be dedicated to answering questions then yes, I think I would be able to answer emails in minutes and even offer live chat support. However, I also need to improve my software, create new features, fix bugs, analyze tons of log files that I receive from my customers and I have only 8 hours a day for all this.
Yes, I could hire someone to do the support, and I’ve tried that last year. It did not work well because I was reading emails and because of that I was not familiar with the problems my customers have, and in the end I still had to answer many of the technical questions myself as I am the only programmer and creator of my apps.
Of course, if none of the above helps and you cannot find any solution to your problem in the instruction manual, and there is not much help on the vendor’s website, then you should contact support team with whatever questions you have. I cannot speak for others, but I know that I always do my best to answer every single email I receive. Obviously priority goes to those who have purchased my software.
Conclusion
All computer application have problems from time to time and this is inevitable. What’s important here is if you receive help from the software creator or the company that sold you the software. However, keep in mind that many problems come from misunderstanding and if you can spend 5 minutes to solve the problem yourself then do it. From my point of view it is easier to find an answer and solve the problem in minutes by yourself than contacting technical support team and waiting for 12-72 hours until they respond. Obviously not all questions are equal. Some might be answered only by technical support team.
I hope this short guide will help you solve problems when running your Expert Advisor on the MT4 client terminal.