replacing close with an array

Questions about MultiCharts and user contributed studies.
Guest
replacing close with an array

Postby Guest » 23 Mar 2007

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?

User avatar
Stanley Miller
Posts:556
Joined:26 Jul 2005
Has thanked: 3 times

Postby Stanley Miller » 27 Mar 2007

You can use array_sum function i.e.:

Code: Select all

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

Guest

Postby Guest » 27 Mar 2007

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)

User avatar
Stanley Miller
Posts:556
Joined:26 Jul 2005
Has thanked: 3 times

Postby Stanley Miller » 27 Mar 2007

Code: Select all

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


Return to “MultiCharts”