Skip to content

The time of the current tick in onTick, or the close time of the bar in onIntervalClose.

declare const TIME: Date;

It is a JavaScript Date in UTC. In a backtest it is the simulated time, not the time on your computer.

function onIntervalClose() {
const hour = TIME.getUTCHours();
if (hour >= 7 && hour < 16 && OPEN_POSITIONS_COUNT === 0) {
openPosition("BUY", { quantity: 1000, stopLossPips: 20 });
}
}