Download MetaTrader 5
To add comments, please log in or register
Having questions? Ask them on the Forum - traders will help you!
KonradNo
27
KonradNo 2013.10.12 15:20 

Hi,

A newbie question: I would like to run debugger (in Mgl5 MetaEditor) over some period of time in the past. Is there a way to set up the debugger for it? I could only find in the debugger settings currency pair and time period.

Tracing the execution of my advisor in Strategy Tester with Print() or Alert() is a bit troublesome & I need watch functionality. When i debug my advisor OnTick() function is always called with time of last 24 hours.

There must be simple work around or solution for my problem but i am not aware of it... Thanks in advance for your answers!

Alain Verleyen
Moderator
28535
Alain Verleyen 2013.10.12 15:24  
Unfortunately, there is no way for the moment, Debugger only works with live chart.
KonradNo
27
KonradNo 2013.10.12 16:54  
angevoyageur:
Unfortunately, there is no way for the moment, Debugger only works with live chart.

Thank you for your prompt answer!

Does it mean that the debugger only works for the future ticks? My EA works with D1 charts so i guess that using debugger is pretty useless for it (as it is now)?

Do you have any plans to integrate the debugger into Strategy Tester?

Alain Verleyen
Moderator
28535
Alain Verleyen 2013.10.12 17:26  
KonradNo:

Thank you for your prompt answer!

Does it mean that the debugger only works for the future ticks? My EA works with D1 charts so i guess that using debugger is pretty useless for it (as it is now)?

Do you have any plans to integrate the debugger into Strategy Tester?

It works on a live chart, and can be with each new tick. Why useless on D1 chart ? D1 chart receive the same ticks as any other chart.

Forum

debugger

stringo, 2013.05.08 07:04

Servicedesk answers: "Maybe later". It is not so easy to implement this functionality right now

KonradNo
27
KonradNo 2013.10.12 17:52  

As I said I am a complete newbie:

My EA is supposed to open the positions rarely: sometimes once per a week or a month, also there are dependencies to already opened positions in other currencies (it is multicurrency EA). Does it mean that I have leave it for debugging for days/weeks to watch EA internals when the position is finally opened?

Pls correct me if i got it wrong and talking nonsense...

Alain Verleyen
Moderator
28535
Alain Verleyen 2013.10.12 18:43  
KonradNo:

As I said I am a complete newbie:

My EA is supposed to open the positions rarely: sometimes once per a week or a month, also there are dependencies to already opened positions in other currencies (it is multicurrency EA). Does it mean that I have leave it for debugging for days/weeks to watch EA internals when the position is finally opened?

Pls correct me if i got it wrong and talking nonsense...

You are right, if you want to use the debugger. But there are other ways to check/debug your code. Do you search a solution for a specific issue ?

Maybe you can use the Strategy Tester ?

KonradNo
27
KonradNo 2013.10.23 15:18  
angevoyageur:

You are right, if you want to use the debugger. But there are other ways to check/debug your code. Do you search a solution for a specific issue ?

Maybe you can use the Strategy Tester ?

Thank you for the link. Lots of interesting info to study

But I have noticed something odd: when I run Strategy Tester my EA OnInit() function is not called at all! OnTick() is getting called. (just tested it with Print())

EDIT: when I run debugger on my code it enters both OnInit() & OnTick().

What am I doing wrong???

Alain Verleyen
Moderator
28535
Alain Verleyen 2013.10.23 18:31  
KonradNo:

Thank you for the link. Lots of interesting info to study

But I have noticed something odd: when I run Strategy Tester my EA OnInit() function is not called at all! OnTick() is getting called. (just tested it with Print())

EDIT: when I run debugger on my code it enters both OnInit() & OnTick().

What am I doing wrong???

Of course OnInit() is called when you are using the Strategy Tester, but you probably don't see your print statement in the Journal tab. You have to use the viewer or open the log file. Right-click inside the Journal tab window, and you will see these options.
KonradNo
27
KonradNo 2013.10.24 12:17  

OK i have it figured out now and it seems to work fine for me. Thank you!

I just learned 2 things:

I was not aware that some Print() messages might not appear in Journal window (even though they all can be found in log file). Maybe it should be mentioned somewhere in tutorial?

When using FileWrite() debugger and Strategy Tester save files in different folders and also log files are saved in 2 different locations, which makes 4 different locations altogether. I found it confusing as sometimes I was looking into wrong log file..

Documentation on MQL5: File Functions / FileWrite
Documentation on MQL5: File Functions / FileWrite
  • www.mql5.com
File Functions / FileWrite - Documentation on MQL5
/
To add comments, please log in or register