Close
Last updated
Last updated
// Get current bar's closing price
const currentClose = this.api.Close(0);
// Get previous bar's closing price
const previousClose = this.api.Close(1);
// Calculate price change
const priceChange = this.api.Close(0) - this.api.Close(1);
console.log(`Price changed by ${priceChange} points`);
// Get closing prices for last 3 bars
for (let i = 0; i < 3; i++) {
const closePrice = this.api.Close(i);
console.log(`Bar -${i} close price: ${closePrice}`);
}