iHigh
Syntax
iHigh(Symbol: string, TimeFrame: number, index: number): numberParameters
Return Value
Description
Example
Last updated
iHigh(Symbol: string, TimeFrame: number, index: number): numberLast updated
// Get the high price of the current bar for EURUSD on H1 timeframe
const currentHigh = this.api.iHigh("EURUSD", 60, 0);
// Get the high price from 5 bars ago
const pastHigh = this.api.iHigh("EURUSD", 60, 5);
// Calculate the highest price over the last 3 bars
const highest = Math.max(
this.api.iHigh("EURUSD", 60, 0),
this.api.iHigh("EURUSD", 60, 1),
this.api.iHigh("EURUSD", 60, 2)
);
// Check if current bar's high is a new local high
if (this.api.iHigh("EURUSD", 60, 0) > this.api.iHigh("EURUSD", 60, 1)) {
console.log("New local high formed");
}
// Calculate the average high price of last 3 bars
const avgHigh =
(this.api.iHigh("EURUSD", 60, 0) +
this.api.iHigh("EURUSD", 60, 1) +
this.api.iHigh("EURUSD", 60, 2)) /
3;