[][src]Struct sma_rs::SMA

pub struct SMA { /* fields omitted */ }

#SMA(Simple Moving Average)

use ta_common::traits::Indicator;
use sma_rs::SMA;
let mut sma = SMA::new(4);
assert_eq!(sma.next(4.0), Some(4.0));
assert_eq!(sma.next(5.0), Some(4.5));
assert_eq!(sma.next(6.0), Some(5.0));
assert_eq!(sma.next(6.0), Some(5.25));
assert_eq!(sma.next(6.0), Some(5.75));
assert_eq!(sma.next(6.0), Some(6.0));
assert_eq!(sma.next(2.0), Some(5.0));

Implementations

impl SMA[src]

pub fn new(period: u32) -> SMA[src]

Trait Implementations

impl Indicator<f64, Option<f64>> for SMA[src]

Auto Trait Implementations

impl RefUnwindSafe for SMA

impl Send for SMA

impl Sync for SMA

impl Unpin for SMA

impl UnwindSafe for SMA

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.