PureBytes Links
Trading Reference Links
|
Larry <lameyering@xxxxxxxxxxxxx> wrote:
> I think what everybody is trying to say is that your statement:
> If currentbar > maxbarsback then
> ind=ind[1] + 1;
>
> Is like saying: If 1 > 0 then
> ind=ind[1] + 1;
Correct.
> In other words the starting statement is always true - therefore
> ind=ind[1] +1 will try to go on forever - no way out - 1 is always
> greater then zero. ie "Infinite loop Error"
Not correct. It's not an infinite loop, since the code is only
executed once per bar. However since you have the "1 > 0" test,
you execute the Array_SetMaxIndex call on every bar.
Christian, you said TS locks up only if you have hundreds or
thousands of bars on the chart. In other words, it happens only
if you try to extend the array hundreds or thousands of times.
I suspect the TS array mechanism is getting wedged when you tell
it to extend the array by one, thousands of times. There's a
good chance that Bob's suggestion will resolve the problem, since
you'll only be asking TS to extend the array a few times. It
will also be a lot faster than running the Array_SetMaxIndex
logic thousands of times.
Gary
|