1 unstable release
0.1.0 | Nov 16, 2020 |
---|
#3 in #roc
5KB
87 lines
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
Dependencies
~10KB