[][src]Struct roc_rs::ROC

pub struct ROC { /* fields omitted */ }

roc-rs

Rate Of Change (ROC) implementation in rust

use roc_rs::ROC;
use ta_common::traits::Indicator;

let mut roc = ROC::new(1, None);
let res = roc.next(100 as f64);
assert_eq!(None, res);
let res = roc.next(50 as f64);
assert_eq!(Some(-50_f32), res);

Calculation

ROCR=(Current Price/Price Prev n Ago);
ROCP=ROCR-1;
ROC100=(ROCR)*100;
ROC=(ROCR-1)*100; //DEFAULT

Implementations

impl ROC[src]

pub fn new(price_ago: u32, result_type: Option<ROCType>) -> ROC[src]

pub fn calc(&self, input: f64) -> Option<f32>[src]

Trait Implementations

impl Indicator<f64, Option<f32>> for ROC[src]

Auto Trait Implementations

impl RefUnwindSafe for ROC

impl Send for ROC

impl Sync for ROC

impl Unpin for ROC

impl UnwindSafe for ROC

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.