PureBytes Links
Trading Reference Links
|
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
|