Math.variance
The mean of the squared distances of a list of numbers from their mean. Cloud9Trader adds it to JavaScript’s built-in Math.
variance(x: number[]): number;Parameters
Section titled “Parameters”- x: an array of numbers, such as the result of
prices().
This is the population variance: it divides by the number of items, not one less.
Errors
Section titled “Errors”Stops the run if x is not an array: “Value passed to Math.variance() must be an array of numbers”.
Example
Section titled “Example”function onIntervalClose() { log("variance", Math.variance(prices(20)));}