PureBytes Links
Trading Reference Links
|
At 12:34 PM -0400 9/30/02, Gene Pope wrote:
>Am I correct in assuming that when you run a verified indicator or strategy,
>and you get an Array out of bounds type error, that this error can be caused
>by an array call anywhere in the code, and not necessarily where you put
>Print Debug statements to try to pin it down?
>
>In other words, if your Debug statements show that you stopped executing at
>Line 20, is it possible to get an array error caused by an array call at
>line 40?
>
>Sure seems that way... any other undocumented Array warnings I should be
>aware of?
There are a lot of "warnings". I can recall a couple.
I just spent two days debugging one.
I had forgotten that TradeStation only allows you to nest four "for
loops" and my code used five. This gave me continuous "Array out of
bounds" errors for some unknown reason. (It was not possible in the
code I was using.) Of course, there was no error message to tell me
of the four-loop limit so I had to search for the problem after I
remembered this.
Also, TS4.0 only works with up to two dimensions on an array. There
are no error messages if you use more than two - it just doesn't work
correctly. TS2000i seems to have increased this limit to some higher
number.
The best debugging method I have found is to comment out sections of
code - narrowing the excluded section until the offending code is
isolated. This can end up as a loop or even a single statement which
has nothing to do with the error message. Then wrack your brain to
figure out what might be causing the problem. As in your case, the
print statements that printed up to the point of the error made no
sense - the printed sequence was not possible in any logical way.
In my case, I replaced one of the "for loops" with a "while loop" and
the code worked perfectly.
Extremely frustrating. I pity the poor guy with little software
debugging experience who tries to use TradeStation for anything
complex...
Bob Fulks
|