[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...





 ---- you wrote: 
> So all you really need is an xaverage of myarray[0].
> 
> Try something like...
> 
> fact = 2/(len+1);
> av = (1-fact)*av[1] + fact*myarray[0];
> 
> > No ! My array indexes in the new value at 0 and kicks out the last at 20 and
> > moves everything down at the close of each bar. I am sure it can be done, it
> > is just a little over my head. Thanks for your input.
> 
> -- 
>   Dennis
>