ExtremesArray (Function)

image\trumpet2.gif Disclaimer

The ExtremesArray function returns the extreme highest or lowest value from an Array of values and how many bars ago the extreme value occurred.  There may be times when two or more bars have the exact same extreme highest or lowest value; when this happens the function identifies the most recent occurrence.

Syntax

ExtremesArray(PriceArray,Size,HiLo,oExtremeVal,oExtremePosRaw)

Returns (Integer)

The oExtremeVal and oExtremeBar output parameters return the extreme value and the number of bars ago it occurred.  The ExtremesArray function itself returns a value of 1.

Parameters

Name Type Description
PriceArray Numeric Array Specifies the name of a numeric array containing bar values to compare for highest and lowest extremes.
Size Numeric Sets the number of data elements (size) in the array to evaluate.
HiLo Numeric Sets whether the function will return the highest or lowest extreme value.  1=Highest, -1=Lowest.
oExtremeVal Numeric Outputs the highest or lowest extreme value found for the range of bars based on the HiLo setting.
oExtremePosRaw Numeric Outputs the number of bars ago the extreme value occurred.

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 ExtremesArray function only works with one-dimensional arrays.  All array-based referencing begins with array element 1.

See Multiple Output Function for more information on using output parameters to return values.

  This array function is similar to Extremes except that you can build an array of values that does not necessarily include contiguous bar values.

Example

Assigns to Value2 the highest High in the specified named array myArray with 20 elements using the oExtremeVal output parameter, and assigns to Value3 the number of bars ago the highest High occurred using oExtremeBar output parameter. Value1 is assigned a value of 1:

Array: myArray[20](0);

Vars: oExtremeVal(0), oExtremePosRaw(0);

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

Value1 = ExtremesArray (myArray, 20, 1, oExtremeVal, oExtremePosRaw);

Value2 = oExtremeVal;

Value3 = oExtremePosRaw;

 

See Also

Extremes, NthExtremesArray.