Fantastic Debugger for Empty4

Post Reply
f-trader
Trader
Posts: 27
Joined: Sat Feb 25, 2012 4:08 pm

Fantastic Debugger for Empty4

Post by f-trader »

I thought the Print() function would be enough for me to debug , but recently
an EA crashed my Empty4 hundreds of times in strategy tester and forward testing ....
and the whole Journal was gone before I had a chance to see my Print log.

What I needed was a simple tool to debug which keeps the log even when Empty4 crashes.

I found it.
It is free and I just tested it ..... and that´s why I call it "fantastic".

Here you can download it for free ( registration is needed there, but that is no problem ).
https://www.fx1.net/wiki/
Go to LogViewer2 , it is better than the MT4Logger if you have Empty4 crashes because it
keeps the LogView window after a crash.

They have other helpfull tools like Mt4Ticker which has been shared in this forum already.

Edit:
Unfortunately after posting this first comment, on further backtests on other Empty4-platforms,
my Ea crashed them (although it didn´t on another, so that is driving me crazy) and
the log-window is gone too.

Sometimes Empty4 crashes without popping up a window where I can decide to send the crash-report to Microsoft or not.
And sometimes it gives that popup window. That is good because at that point in time
the Logviewer window is there and I can export the log to Notepad with 1 click.

Now, what to do when that nice popup window doesn´t appear and the Empty4 just is blown away together with the Logview-window ?

Solution: Decreasing the speed of the backtest in strategy tester.
This allows to export the log to Notepad before the next tick is simulated.
The next tick will blow away Empty4 and the Logviewer-window, but I still have the Notepad file
and can see all my comments for debugging.

Just discovered that Logviewer writes a log file into the Empty4 folder which survives the crash.
Last edited by f-trader on Sun Jun 24, 2012 11:02 am, edited 1 time in total.
f-trader
Trader
Posts: 27
Joined: Sat Feb 25, 2012 4:08 pm

Re: Fantastic Debugger for Empty4

Post by f-trader »

Here is an example how the Logviewer window looks like:
Debugger.jpg
You do not have the required permissions to view the files attached to this post.
garyfritz

Re: Fantastic Debugger for Empty4

Post by garyfritz »

You can also just do FileWrite() operations. I keep an editor open on the file so I can reload it every time I run the EA/indicator.
f-trader
Trader
Posts: 27
Joined: Sat Feb 25, 2012 4:08 pm

Re: Fantastic Debugger for Empty4

Post by f-trader »

garyfritz wrote:You can also just do FileWrite() operations. I keep an editor open on the file so I can reload it every time I run the EA/indicator.
I never coded FileWrite() operations and would have to learn it first.

Using such an easy tool like this one is very convenient for me.
garyfritz

Re: Fantastic Debugger for Empty4

Post by garyfritz »

Add code like this to your EA or indi:

Global variable:

int handle;

In your init():

handle = FileOpen("myfile.csv", FILE_WRITE, ","); // opens a file under experts\files

In deinit();

FileClose(handle);

Where you want to print something:

FileWrite(handle, "foo = ",foo,", bar = ",bar," and other stuff = ",otherstuff);
FileFlush(handle); // not required but it makes sure everything gets written out to the file
User avatar
NeoTrader
Trader
Posts: 436
Joined: Wed Apr 04, 2012 2:52 pm
Location: small Village at Lake Chiemsee, Bavaria, Germany

Re: Fantastic Debugger for Empty4

Post by NeoTrader »

hi gary,
garyfritz wrote:Add code like this to your EA or indi:
Global variable:
int handle;
In your init():
handle = FileOpen("myfile.csv", FILE_WRITE, ","); // opens a file under experts\files
In deinit();
FileClose(handle);
Where you want to print something:
FileWrite(handle, "foo = ",foo,", bar = ",bar," and other stuff = ",otherstuff);
FileFlush(handle); // not required but it makes sure everything gets written out to the file
Nice Idea... will put it to my arsenal... Thanks..

happy Sunday,

NeoTrader

-
Post Reply

Return to “Coders Hangout”