HarmonicMeanArray (Function)
The HarmonicMeanArray calculates the harmonic mean of a specified array.
Syntax
HarmonicMeanArray(PriceArray, Size)
Returns (Double)
A numeric value containing the HarmonicMean of an array. If the function performs an illegal operation, or the declared Size Input is smaller than the declared array size, the function will return a -1.
Parameters
|
Name |
Type |
Description |
|
PriceArray |
Numeric Array |
Specifies the name of a numeric array containing values upon which the harmonic mean is calculated. |
|
Size |
Numeric |
Sets the number of data elements (size) in the array to evaluate. |
Remarks
The harmonic mean is the reciprocal of the arithmetic mean of reciprocals. The harmonic mean is always less than the geometric mean, which is always less than the arithmetic mean.
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 HarmonicMeanArray 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.
This array function is similar to HarmonicMean except that you can build an array of values that does not necessarily include contiguous bar values.
Example
Assigns to Value1 the harmonic mean of the specified named array MyArray with 10 elements.
Array: MyArray[10](0);
{… add EL statements here to assign price values to array elements... }
Value1 = HarmonicMeanArray(MyArray,10);