ModeArray (Function)

image\trumpet2.gif Disclaimer

The ModeArray function returns the most frequently occurring or repetitive value within the array.

Syntax

ModeArray(PriceArray, Size, Type)

Returns (Double)

A numeric value containing the most frequently occurring or repetitive value within the array. If there is no repetition in the range of data or the Size is greater than the referenced Array, the function will return a -1.

Parameters

Name

Type

Description

PriceArray

Numeric Array

Specifies the name of a numeric array containing bar values used to calculate the mode value.

Size

Numeric

Sets the number of data elements (size) in the array to evaluate.

Type

Numeric

Sets whether to return the largest or smallest mode value if multiple modes exist (1=highest mode, -1=lowest mode)

Remarks

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 ModeArray 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

The following assigns the mode of elements 1 to 20 in the array to Value1.

Element [0] of the array (myArray[0]) is ignored by the ModeArray function.

In the event that there multiple modes in the array, the lower mode is returned (the Type input's value is less than 0).

Array: myArray[20](0);

{… add EL statements here to assign values to array elements... }

Value1 = ModeArray(MyArray, 20, -1);

See Also

ExtremesArray, DevSqrdArray