Skip to content

Algorithm SDK

Math.meanDeviation

The mean absolute distance of a list of numbers from their mean. Cloud9Trader adds it to JavaScript’s built-in Math.

meanDeviation(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.meanDeviation() must be an array of numbers”.

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