Skip to content

Algorithm SDK

_ (Underscore)

The Underscore.js library, version 1, as _. It is kept so older algorithms keep running. In new code, use JavaScript’s built-in array methods, such as map, filter, reduce and find, and the Math helpers.

declare const _: any;
function onIntervalClose() {
const closes = prices(10);
const rising = closes.filter((close, i) => {
return i > 0 && close > closes[i - 1];
});
log(rising.length, "of the last 10 closes were above the one before");
}