GetMaxValueOffset

GetMaxValueOffset ( IDataHolder data , int length );

Default values:

length: 25

Description

Returns the offset of the highest value of data for the last length bars.

Input parameters

Parameter Default value Description
data - Defines data for which the highest value is found.
length 25 Defines period on which the highest value is found.

Example

declare lower;

input length = 25;

def upIndex = GetMaxValueOffset(high, length);
def downIndex = GetMinValueOffset(low, length);

plot AroonUp = (length - upIndex) * 100.0 / length;
plot AroonDown = (length - downIndex) * 100.0 / length;

The example calculates the Aroon Indicator. The GetMaxValueOffset is used to calculate the upIndex variable that defines the number of bars appeared starting from the maximum value for the last length bars. When drawing the AroonUp, the upIndex is recorded as a percentage from the overall number of length bars.