1 2 3 4 5 6 7 8 9 10 11 12
use crate::Kline; pub mod ma; impl Kline { // Takes Vec<f64> to calculate mean value pub fn mean(&self) -> f64 { let acc: f64 = self.values.iter().sum(); acc / (self.values.len() as f64) } }