[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: XAverage on Array



PureBytes Links

Trading Reference Links

>I thought he was after an xaverage of the 20 elements in his array,
>not a 20 bar xaverage of the [0] element of the array...  Your code
>gives him the xaverage of the [0] element over 20 bars and ignores
>the other 19 elements of the array on each bar... 

Dennis' code is probably what you really want.  But if you really
want to do something over all 20 elements each pass, you could do:

if currentbar = 1 then
    fact = 2/(len+1);

for N = 19 downto 0 begin
   av = (1-fact) * lastav + fact * myarray[N];
   lastav = av;
end;

Jim