Skip to content

The sum of a list of numbers. Cloud9Trader adds it to JavaScript’s built-in Math.

sum(x: number[]): number;
  • x: an array of numbers, such as the result of prices().

Stops the run if x is not an array: “Value passed to Math.sum() must be an array of numbers”.

function onIntervalClose() {
log("sum", Math.sum(prices(5)));
}