In this video we are going to check the Journal for error codes and find courses for errors. So let’s find out how to do that with MQL 5. This should be a trailing stop. Actually it’s a sell trailing stop but it doesn’t work. The stop doesn’t move.
Now we need to find the cause. If we look at the history, we see that there are no stop loss modifications. There’s nothing that we can find. But when we click on the Journal tab we should see that we have modification errors here. You see the red marks and this is when we see errors during the execution.
But this is only a small part of the journal and you might look at a time when no error is occuring. And when you look at it you might not see any errors because they maybe happen only once a day. So let’s stop the test here. My journal is still running. It might take a few seconds before all the entries are written. That happened right now. So we can now right click onto one of the entries and select open.
This will open the logs directory here. This is the current log file from today. You can see that it contains the date and when you point your mouse cursor over the file you will see that it is a very large file. In my case it’s 479 megabytes. That’s almost half a gigabyte.
Now we can right click on the file and can Select Open. But when we do that it will probably crash because Notepad as it is delivered with Windows is not a good tool to open files of this size. In my case, I’m going to use Notepad Plus Plus. This is a free software that you can download from Chip or any other websites. And this editor is able to open very big files. When we scroll down, we can see that this file has thousands and thousands of lines.
We could now manually scroll through the file, but this could take hours. But one of the best things in Notepad Plus Plus is that we have a very good search function. Let’s change the language here to English. That might be better for you. Now I can click on Search and Find and I can look for certain terms. Here we have the term log in. And what I can do is I can type in or copy and paste the term I’m looking for and click on this button “Find all in current document”. And it will now show me the lines that contain my search term and I can click on these lines here. And it will jump to the search results. In our case we know that we wanted to move a stop loss. So I’m going to click on Search, Find. And I will look for the term failed. Click on Find all in current document. Well this might take a little while because it’s a very large file. And here is my search result. So this is a very fast and easy way to find errors in big log files. In this case it’s easy to see what is causing the error. So let’s go to Google and look for MQL 5 error codes.
This is the first entry and this table will show you the different error codes that can happen. And the cause of the error, like in my case the invalid stops. So if your expert advisor is not doing what it is supposed to do, you now know how to find the errors in the journal. Because in this video you have learned how to find error codes even in big journal files and you have done it yourself in a few minutes.