WebCab Technical Analysis Web Services for Delphi v1.1

Momentum.HighestPeriod Method 

Returns an array of the highest values for all look back sub-periods of a given length.

public double[] HighestPeriod(
   double[] prices,
   int noPeriods
);

Parameters

prices
An array of length equal to the number of periods considered in the indicator evaluation where the first element is the price in the last trading period, the second term is the price in the previous trading period and so on.
noPeriods
The number of periods previous within the look back period over which the highest value is found.

Return Value

A double array where the first term is the high found for the most recent look back period (i.e. noPeriods-periods back from the present period), the second term is the high for the previous look back period (i.e. noPeriods-periods back from the previous period), and so on. Note that the length of the returned array is equal to the length of the prices array minus noPeriods - 1.

Remarks

The total number of periods over which the highest value is iteratively searched for each set of periods is referred to as the look back period.

Example

We illustrate the application of this method with the following example. If the prices over the past five periods are: { 102, 101, 100, 103, 102 }, and the look back period has 3 periods, then the highest value over the first look back period is 103, which is the lowest value within { 101, 100, 103, 102 }. Now when the look back period is shift back a period to { 102, 101, 100, 103 }, highest value is 103, and hence in this case the returned array would be { 103, 103 }.

Exceptions

Exception TypeCondition
ArgumentExceptionThrown if prices array has strictly negative elements or if the noOfPeriods argument is greater then the length of prices array.

See Also

Momentum Class | Indicators Namespace | Highest