Skip to content

Stops the run, writing your message to the log. The same as throw new Error(message).

declare function error(message: string): never;

A backtest stops at once. In a live session a handler error counts towards the limit of three within 60 seconds, after which the session stops.

function onIntervalClose() {
if (OPEN_POSITIONS_COUNT > 5) {
error("More than 5 positions open: check the entry rule");
}
}