replacing close with an array [SOLVED]
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?
- Stanley Miller
- Posts: 556
- Joined: Jul 26 2005
- Has thanked: 3 times
You can use array_sum function i.e.:
Code: Select all
var avg(0):
avg = array_sum(array, 0, 100) / 101
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)
Array: TradingDataArray[159,4]
value9 = array_sum(TradingDataArray[159,0],111,159)
- Stanley Miller
- Posts: 556
- Joined: Jul 26 2005
- Has thanked: 3 times