Gamestudio Links
Zorro Links
Newest Posts
Data from CSV not parsed correctly
by EternallyCurious. 04/25/24 10:20
Trading Journey
by howardR. 04/24/24 20:04
M1 Oversampling
by Petra. 04/24/24 10:34
Zorro FIX plugin - Experimental
by flink. 04/21/24 07:12
Scripts not found
by juergen_wue. 04/20/24 18:51
zorro 64bit command line support
by 7th_zorro. 04/20/24 10:06
StartWeek not working as it should
by jcl. 04/20/24 08:38
folder management functions
by VoroneTZ. 04/17/24 06:52
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
5 registered members (AndrewAMD, TipmyPip, VoroneTZ, Quad, 1 invisible), 688 guests, and 11 spiders.
Key: Admin, Global Mod, Mod
Newest Members
Mega_Rod, EternallyCurious, howardR, 11honza11, ccorrea
19048 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Debugging a script #412226
11/24/12 09:41
11/24/12 09:41
Joined: Jul 2000
Posts: 27,982
Frankfurt
jcl Offline OP

Chief Engineer
jcl  Offline OP

Chief Engineer

Joined: Jul 2000
Posts: 27,982
Frankfurt
Often you want to debug a script and observe how its variables change in every run. We have a lite-C debugger, but it's not yet implemented in Zorro. Until then, you can debug a script with a simple message box. Example:

Code:
function run()
{
	var *Price = series(price());
	var *Trend = series(LowPass(Price,1000));
	Stop = 4*ATR(100);
	
// Display a message box with the variables to be observed
// Click [Yes] for a single step, [No] for closing the box
	static int debug = 1;
	if(debug) debug = msg(
		"Price = %.5f, Trend = %.5f, Stop = %.5f",
		Price[0],
		Trend[0],
		Stop);
	
	
	if(valley(Trend))
		enterLong();
	else if(peak(Trend))
		enterShort();
}


Re: Debugging a script [Re: jcl] #424822
06/22/13 12:53
06/22/13 12:53

A
acidburn
Unregistered
acidburn
Unregistered
A



Originally Posted By: jcl
Often you want to debug a script and observe how its variables change in every run. We have a lite-C debugger, but it's not yet implemented in Zorro. Until then, you can debug a script with a simple message box. Example:

// Display a message box with the variables to be observed
// Click [Yes] for a single step, [No] for closing the box
static int debug = 1;
if(debug) debug =
msg(
"Price = %.5f, Trend = %.5f, Stop = %.5f",
Price[0],
Trend[0],
Stop);


While we (still) wait for the proper debugger, may I just add that thou shalt not be a smartass (like yours truly) and forget the bolded part above and use unprotected msg() in a loop. Lest you end up with an endless stream of popups that can be stopped only by forcefully pulling the plug from the damn machine. No, you can't just close the Zorro itself and stop the spam, because popups also take the focus away from the main window.

Fortunately, while I was learning the above wisdom on the back of my mouse, I had only about 1300 clicks to freedom... grin


Moderated by  Petra 

Gamestudio download | chip programmers | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1