How to get "error" information from the journal? - page 3

 
ydrol:

I hope I'm not stating the obvious, and apologies if I am!

I suspect everyone responding has assumed you are aware, but the MT journal is simply a number of files, the last few lines of which are displayed in the GUI.

The files (for back testing) live in MetaTrader Install Folder/tester/logs

You can search through then using any tools available to you - eg dos command Findstr to extract the files...

cd MetaTrader Folder/tester/logs

Findstr some_text *.log

Findstr some_text *.log > small_log.txt


Again, Apologies if I am stating the obvious and you are actually after something else!?


In my first response, I asked "The journal may not have all information, but the log files aren't deleted are they?"

So I did assume that he was indeed opening the log.

Possibly it was the wrong assumption and he is trying to check the journal, not the log.

If he doesn't know. you can access the log by right clicking in the journal window and clicking on open. Then the last log file or whichever can be opened.

 
Proximus:

+10.000 lines are not enough, i`m not sure exactly how many of them the MT4 keeps but i`m sure its not enough for me.I usually make nowadays backtests with 5000-7000 trades or more, 1 line for orderopen,3-4 lines for trailstops ordermodify, and 1 line for orderclose =thats 6 lines /trade * 7000 trades =thats ~42000 lines or mode and i`m sure the MT4 journal doesnt keep that many in it :)

The log file . . . not just what is shown in the journal, will hold GBs if that is what you want . . . you seem to be more interested with counting the errors rather than finding them and fixing them, if thats all you want to do then just code a counter for each error number and increment the count . . . how this helps I don't know, but you seem to pretty insistent so I'll leave you to get on with it.
 

No problem, I was replying to OP. They can just use tools to analyse the log files? If on Linux, grep "some text" *.log | wc -l gets a quick count of matches, but I couldn't quickly find a built in Windows equivalent (spending too much time here :) ),

Now I think of it I suspect powershell has something..

 
Ovo:

No need to apologize, but I understood, that OP was not interested in finding and fixing errors, but rather in their statistics.
Actually both of them.I want to first know the types of errors occuring,because i`m not confident in my code and pretty skeptic, so i want to rule out all errors to my EA.After i have some data about them it will be more easy to correct them and avoid them in the future.
ydrol:

No problem, I was replying to OP. They can just use tools to analyse the log files? If on Linux, grep "some text" *.log | wc -l gets a quick count of matches, but I couldn't quickly find a built in Windows equivalent (spending too much time here :) ),

Now I think of it I suspect powershell has something..

I think you guys are way into that file search thing,when i told you that there is no need for that, that is a solution too, but thats the "hard way".A good programmer must find the optimal way first.So we have to search inside the code when it is still obtainable, so in the journal, because the log is too big in my case.If i`d go and use the "find" in the notepad it would take me years to find all errors and their specific details.

Also i`ve forgot to mention in the first post that i need to see the neighboring lines in the journal too.Because i've added some "Print()"s which will print some key data's like indicators current value, SL,TP and it will show it nicely in the journal/log but i must see the error too associated with that data, so for example if i catch a SL with value 0 then i will know that that error is because of that.

So after a big of search and diving into the mql4 language i've found this:

GetLastError();

I think the solution i need lies inside this function.I've read the documentation about it,and its pretty short.Can somebody help me to use it or explain it more detailed?

 
Proximus:

So after a big of search and diving into the mql4 language i've found this:

I think the solution i need lies inside this function.I've read the documentation about it,and its pretty short.Can somebody help me to use it or explain it more detailed?

 
Well, I think that we probably all assumed that you were searching for prints of GetLastError();
 
GumRai:
Well, I think that we probably all assumed that you were searching for prints of GetLastError();
Yes but i need to build a tester which tests the errors and groups them by type and counts them if it is possible.Can anyone explain it more detailed how can i use this function in advanced coding?
 
Proximus:
Yes but i need to build a tester which tests the errors and groups them by type and counts them if it is possible.Can anyone explain it more detailed how can i use this function in advanced coding?

What are Function return values ? How do I use them ?

How I control debugging output to the log

 
Proximus:

I think you guys are way into that file search thing,when i told you that there is no need for that, that is a solution too, but thats the "hard way".A good programmer must find the optimal way first


A good programmer Uses the right tools for the job. The log is a text file. There are a gazillion tools to search the text file and count lines, and display context/neigbouring lines if you want. These have been around for years. I bet some even have point-n-click GUI that you'd like.

A good programmer would nor program something when they dont have to (unless out of curiosilty).

First you tell programmers how simple your trendline code is despite lack of information, now you dismiss the simplest way to search text files as the hard way??

Good luck with it!

 

Thanks for the info it looks interesting.


ydrol:

A good programmer Uses the right tools for the job. The log is a text file. There are a gazillion tools to search the text file and count lines, and display context/neigbouring lines if you want. These have been around for years. I bet some even have point-n-click GUI that you'd like.

A good programmer would nor program something when they dont have to (unless out of curiosilty).

First you tell programmers how simple your trendline code is despite lack of information, now you dismiss the simplest way to search text files as the hard way??

Good luck with it!


You have some interesting points.Ok maybe it's not that simple but its confortable and raises your curiosity.And also i like to program stuff, its because of lazyness, its better if a bot does the hard work.That is their purpose it replaces human work.