High
Last updated
Last updated
// Get current bar's high price
const currentHigh = this.api.High(0);
// Get previous bar's high price
const previousHigh = this.api.High(1);
// Find highest price over last 3 bars
let highestPrice = this.api.High(0);
for (let i = 1; i < 3; i++) {
const high = this.api.High(i);
if (high > highestPrice) {
highestPrice = high;
}
}
console.log(`Highest price in last 3 bars: ${highestPrice}`);
// Check if current bar made new high
if (this.api.High(0) > this.api.High(1)) {
console.log("New high formed on current bar");
}