Skip to content

Algorithm SDK

Math.mean

The mean (average) of a list of numbers. Cloud9Trader adds it to JavaScript’s built-in Math.

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

The same as Math.average.

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

function onIntervalClose() {
log("mean", Math.mean(prices(20)));
}