Skip to content

The timeframe you chose when you started the backtest or session, such as "H1". onIntervalClose fires on its bars.

declare const INTERVAL: Timeframe;
type Timeframe = "M1" | "M2" | "M5" | "M10" | "M15" | "M30" | "H1" | "H2" | "H4" | "H8" | "H12" | "D1";

The timeframes are M1, M2, M5, M10, M15 and M30 (minutes), H1, H2, H4, H8 and H12 (hours), and D1 (a day).

function onIntervalClose() {
if (INTERVAL === "D1") {
log("Daily close", CLOSE);
}
}