R
RobcPettit
Hi, What is the best way to use an array to find moving averages. I
want to calculate a 15 day and 41 day m/a. I know my array will need
to contain 12 columns, but the rows need to be dynamic. The row size
will need to be aminium of 50 rows. So far Im thinking of either
creating 2 arrays, one for 15 and one for 41 day m/a. Keeping them
each to that row size then iterate through them creating new arrays
when new data added. Eg when 16 data point added to the 15 day m/a,
remove the first data point, add the new data point at the end. I
think im right in thinking that I would have to add the data to a new
array to do this. The other idea was to create an array 12 cols wide
and some how have dynamic rows. Add data indefinatly, then itirate
through the array in reverse, first back 15 points, summing as I go,
and the again 41 points to calculate the average. I dont know how to
iterate in reverse or create an array with set col width but dynamic
rows. Any ideas appreciated.
Regards Rober
want to calculate a 15 day and 41 day m/a. I know my array will need
to contain 12 columns, but the rows need to be dynamic. The row size
will need to be aminium of 50 rows. So far Im thinking of either
creating 2 arrays, one for 15 and one for 41 day m/a. Keeping them
each to that row size then iterate through them creating new arrays
when new data added. Eg when 16 data point added to the 15 day m/a,
remove the first data point, add the new data point at the end. I
think im right in thinking that I would have to add the data to a new
array to do this. The other idea was to create an array 12 cols wide
and some how have dynamic rows. Add data indefinatly, then itirate
through the array in reverse, first back 15 points, summing as I go,
and the again 41 points to calculate the average. I dont know how to
iterate in reverse or create an array with set col width but dynamic
rows. Any ideas appreciated.
Regards Rober