iHighest
Syntax
iHighest(symbol: string, timeFrame: number, type: number, count: number, index: number): numberParameters
Return Value
Description
Example
Last updated
iHighest(symbol: string, timeFrame: number, type: number, count: number, index: number): numberLast updated
// Find highest high price in last 10 bars
const highestIndex = this.api.iHighest("EURUSD", 60, 1, 10, 0);
if (highestIndex !== -1) {
const highestPrice = this.api.iHigh("EURUSD", 60, highestIndex);
console.log(`Highest price: ${highestPrice} at index ${highestIndex}`);
}
// Find highest close in last 20 bars
const highestCloseIndex = this.api.iHighest("EURUSD", 60, 3, 20, 0);
// Find highest volume in last 5 bars
const highestVolumeIndex = this.api.iHighest("EURUSD", 60, 4, 5, 0);
// Check if current bar is highest in last 50 bars
const isNewHigh = this.api.iHighest("EURUSD", 60, 1, 50, 0) === 0;
// Find highest high starting from a specific bar
const startIndex = 10;
const lookback = 5;
const highIndex = this.api.iHighest("EURUSD", 60, 1, lookback, startIndex);
// Get highest price values for different types
const types = [0, 1, 2, 3]; // OPEN, HIGH, LOW, CLOSE
const highestValues = types.map((type) => {
const idx = this.api.iHighest("EURUSD", 60, type, 10, 0);
return idx !== -1 ? this.api.iHigh("EURUSD", 60, idx) : null;
});