pub fn simple_moving_average(slice: &[f64]) -> Result<f64>Expand description
Simple moving average (SMA) is the unweighted mean of the datum points.
The number of periods depends on the analytical objectives. Typical number of periods for short, medium and long term trends are 5-20, 20-60 and 100-200 respectively.
§Arguments
slice- array of values
§Example
use stat::analysis::trend;
let array = [3.5, 3.4, 3.3, 3.6, 3.7];
let value = trend::simple_moving_average(&array);
assert_eq!(value.ok(), Some(3.5));