Maybe this little example will help:
Assume we want an array B equal to an array A shifted to the right one bar:
B = Ref(A, -1);
AB calculates the result by doing something like:
for(i=1; i<BarCount; i++) B[i]= A[i-1];
or:
for(i=BarCount-1; i>0; i--) B[i]= A[i-1];
However, if we try to shift an array A right by one bar using:
A = Ref(A, -1);
and AB calculates the result by doing something like:
for(i=1; i<BarCount; i++) A[i]= A[i-1];
the result is that all a[i] are set equal to a[0], not what we wanted.
AB could have calculated our desired result with something like:
for(i=BarCount-1; i>0; i--) A[i]= A[i-1];
But AB is just a computer program. It can't know our desires, unless we
tell it, in its own language.
-- Keith
Noah Bender wrote:
Here is a general question for someone like me who has had amibroker
for a few months.
I am trying to really get to the bottom of difference between array
proccessing and loop processing. I see my code incorporates both of
them and I think there may be some problems because I am not entirely
sure of the difference between them. So hopefully one of the gurus
will be kind enough to really list the differences. i found the
userguide to only give a cursory explanation.
thanks in advance
noah