Skip to main content

hma

Function hma 

Source
pub fn hma(closes: &[f64], period: usize) -> FinanceResult<Vec<Option<f64>>>
Expand description

Hull moving average of period (must be ≥ 2).

§Examples

use finance_solution::stocks::ta::hma;
let c: Vec<f64> = (1..=40).map(|x| x as f64).collect();
let h = hma(&c, 9).unwrap();
assert!(h.iter().any(|x| x.is_some()));
assert!(h.last().unwrap().unwrap().is_finite());