atr

Function atr 

Source
pub fn atr<'a, T: ToPrimitive>(
    high: &'a [T],
    low: &'a [T],
    close: &'a [T],
    window: usize,
) -> impl Iterator<Item = f64> + 'a
Expand description

Average True Range

Moving average of the True Range series

§Sources

[1]

§Examples

use traquer::volatility;

volatility::atr(
    &[1.0,2.0,3.0,4.0,5.0,6.0,4.0,5.0],
    &[1.0,2.0,3.0,4.0,5.0,6.0,4.0,5.0],
    &[1.0,2.0,3.0,4.0,5.0,6.0,4.0,5.0],
    6).collect::<Vec<f64>>();