pause function?

 
Slawa,

Can you tell me how to pause a program at various places in order to read the various "Comments" in the expert program for trouble-shooting purposes? What method is used to pause a MQL-3 program? Thanks.
 
In order to read the various "Comments" during test mode or trading , everything is recorded in log.txt file . open it take what you need from it.
i hope i understand u well.
 
Can you tell me how to pause a program at various places in order to read the various "Comments" in the expert program for trouble-shooting purposes? What method is used to pause a MQL-3 program?

MQL- 3 program cannot be paused. You can set last time and prevent too frequently expert launches.
MQL 4 programs can be paused with Sleep function. for debug comments try to use MessageBox function
 
Can you tell me how to pause a program at various places in order to read the various "Comments" in the expert program for trouble-shooting purposes? What method is used to pause a MQL-3 program?

MQL- 3 program cannot be paused. You can set last time and prevent too frequently expert launches.
MQL 4 programs can be paused with Sleep function. for debug comments try to use MessageBox function


Slawa,

For the benefit of others, I found a way to pause MQL-3 programs so I am including the code for it below. I use a while loop for each pause duration and comment that I wish to install in an existing MQL-3 program. Example below:

While Seconds <= 11 begin
Comment(" The first pause. "," Seconds = ",Seconds);
end;

While Seconds > 11 and Seconds <= 23 begin
Comment(" The second pause. "," Seconds = ",Seconds);
end;

While Seconds > 23 and Seconds <= 35 begin
Comment(" The third pause. "," Seconds = ",Seconds);
end;

While Seconds > 35 and Seconds <= 47 begin
Comment(" The fourth pause. "," Seconds = ",Seconds);
end;

While Seconds > 47 begin
Coment(" The fifth pause. "," Seconds = ",Seconds);
end;

Each pause duration is 12 seconds, but can be changed to the amount of time you wish. I placed this script
in my MQL-3 expert files and attached it to a chart to see how this idea works. The coments are displayed on
the chart in the upper left corner. I also can use any or all of the while loops in various locations of an existing
program and change the "comments" to display the values of variables that I need to see. Makes a great
trouble-shooting aid.
Cheers,
Richard
 
no. in the mt3.xx experts cannot work longer than 1 second. experts are stopped and "loop detected" error logged into journal
 
Slawa,

Well, I guess the program starts and stops many times, because the above code gives me the information about
a program that I wish to see. It works for me. I have already tried it to find out information about an existing
program and it gives me the results that I was looking for.

Richard
 
you can prevent expert executing in (for instance) 20 seconds and your previous comment stays on the chart 20 seconds
if CurTime - last_time < 20 then exit;
last_time=CurTime;
...
Comment(some debug info);
 
you can prevent expert executing in (for instance) 20 seconds and your previous comment stays on the chart 20 seconds
if CurTime - last_time < 20 then exit;
last_time=CurTime;
...
Comment(some debug info);



Slawa,

Where is "last_time" located in the dictionary? I only see " LastTradeTime" in the MQL-3 dictionary. I would have
used "last_time" if I had seen it in the dictionary.

Richard
 
last_time is just variable defined and controlled by You
 
last_time is just variable defined and controlled by You


Slawa,

Since "CurTime" is up in the billions of seconds since Jan. 1970, then "last_time" would have to be nearly that
large also. "CurTime < 20" would never happen as 20 seconds is far from the billions of seconds that "CurTime"
has already accumulated.

I tried to take a snapshot of "CurTime" with a variable just prior to going into a while loop, but no matter what
I did, I could never get a frozen snapshot as the variable that captured the value of "CurTime" just kept on updating
no matter what and so my methods just wouldn't work. Have you tried the method you recommend to see if it actually worked?

Richard
Reason: