iHighest

Returns the index of the bar with the highest value over a specified range.

Syntax

iHighest(symbol: string, timeFrame: number, type: number, count: number, index: number): number

Parameters

  • symbol: The symbol to get data for

  • timeFrame: The timeframe of the data (in minutes)

  • type: The price type to compare (0=OPEN, 1=HIGH, 2=LOW, 3=CLOSE, 4=VOLUME)

  • count: Number of bars to search through

  • index: The starting bar index (0 is current/last bar, 1 is previous bar, etc.)

Return Value

Returns a number representing the index of the bar with the highest value. Returns -1 if no valid bar is found.

Description

The iHighest method searches for the bar with the highest value of the specified price type (open, high, low, close, or volume) within a range of bars. The search starts from the specified index and looks back for the specified number of bars. The method is useful for finding local maxima and implementing various technical analysis strategies.

Example

Last updated