AverageArray (Function)
The AverageArray function calculates a standard Average of all the values within an array.
Syntax
AverageArray(PriceArray,Size)
Returns (Double)
The average of the values in a specified array..
Parameters
Name | Type | Description |
PriceArray | Numeric Array | Specifies the name of a numeric array containing values upon which the average is calculated. |
Size | Numeric | Sets the number of data elements (size) in the array to evaluate. |
Remarks
The average is the sum of the numbers in an array divided by the number of array elements, such as (1+2+3+4+5) / 5 = 3
The value for the Size input parameter should always be a whole number greater than 0 and is typically equal to the number of data elements in the array.
The AverageArray function only works with one-dimensional arrays. The first element of the array that is used by this function is element 1. Element 0 of the array is not used.
Example
Assigns to Value1 the 10 bar moving average of the specified array.
Array: myArray[10](0);
{… (assign values to array) }
Value1 = AverageArray(myArray, 10);