Page 1 of 1

replacing close with an array

Posted: Mar 23 2007
by Guest
I have built an array with a series of numbers. I'd like to take a moving average of these numbers without having to do it manually (ex (array[0]+array[1]+.....+array[100])/100). Is there anyway I can take this same calculation using the built in function? (ex replace close with the array, xaverage(array[0])) Is this possible?

Posted: Mar 27 2007
by Stanley Miller
You can use array_sum function i.e.:

Code: Select all

var avg(0):
avg = array_sum(array, 0, 100) / 101

Posted: Mar 27 2007
by Guest
that will work, I tried the following, however, it's showing an error

Array: TradingDataArray[159,4]

value9 = array_sum(TradingDataArray[159,0],111,159)

Posted: Mar 27 2007
by Stanley Miller

Code: Select all

Arrays: TradingDataArray[](0);
value9 = array_sum(TradingDataArray,111,159);