[−][src]Struct roc_rs::ROC
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
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]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,