PureBytes Links
Trading Reference Links
|
Gary,
I'm assuming that you're printing to the print window's buffer. I've had
much more success printing to a file when trying to debug or figure out how
a function is supposed to work.
In critical areas of code, you can ensure that the useful information makes
it into the file with a print() of an empty string directly following the
useful information print() call.
On some bad days, I've had more debug code in a system than actual system
code.
In general, the sophistication of debugging tools supplied with TS is one
step away from hammering on the computer with a rock.
-- Roy
----------------------------------------------------------------------------
--------------------------------------------
Inputs: L1(9), L2(21), RLen(4), ATRLen(2), Upper(90), Lower(10);
Vars: SMA(0), LMA(0), PerR(0);
print(File("F:\tmp\Sys10.out"), "********* Entered RJ.SYS10 Trading System.
Today's date is: ", Date:8:0);
SMA = XAverage(C, L1);
LMA = Average(C, L2);
print(File("F:\tmp\Sys10.out"), "Short term MA: ", SMA, " Long term MA: ",
LMA);
{ If this was a critical area, put another print() after it }
PerR = PercentR(RLen);
print(File("F:\tmp\Sys10.out"), "PercentR: ", PerR, " BuyZone: ", Lower, "
SellZone: ", Upper);
print(File("F:\tmp\Sys10.out"), "");
{
other goodies go here.....
}
print(File("F:\tmp\Sys10.out"), "********* Exited RJ.SYS10 Trading System
normally...");
print(File("F:\tmp\Sys10.out"), "********* ********* ********* *********
********* *********");
-----Original Message-----
From: Gary Fritz [SMTP:fritz@xxxxxxxx]
Sent: Monday, March 01, 1999 9:13 PM
To: omega-list@xxxxxxxxxx
Subject: EL bugs trash print output?
I ran into a problem with a large and complex indicator -- it
started
blowing up with a MaxBarsBack violation. Something in the code was
accessing back many more bars than it used to, and staring at the
code for several hours didn't turn up the culprit.
So I applied the Sophisticated Omega Debugging Tool -- the "print"
statement. :-( But that didn't help me narrow down where the MBB
violation was happening. The printed output from the bar where the
error happened just disappeared.
I printed messages at various points in the code, including one on
the very first line of the indicator, and one at the very last line.
Then, when my indicator blew up, the last thing printed in the Print
Log was the "last line in indicator" message from the previous bar.
It never printed the "first line" message for the next bar, which
was
where the error was happening.
I finally tracked down the problem, but it was 10x harder than it
should have been. Apparently the print statement output doesn't get
flushed to the Print Log when you get an MBB error. Any suggestions
for a less-painful way to zero in on MBB problems?
Also, I discovered that array bounds violations can apparently trash
your program, or at least the string literals in your print
statements. I ran into a problem while debugging the above
indicator, and discovered the print statements right after the
bounds
violations were printing only parts of what they were supposed to.
It's bad enough we have to debug this stuff with print statements,
but when the bugs BREAK the print statement, that makes it damn
hard!! I sure hope TradeLab, or TS5, or SOMEbody gets their act
together soon, or maybe it's time to give Ensign a try...
_
Gary
|