Crates.io | dema-rs |
lib.rs | dema-rs |
version | 0.1.0 |
source | src |
created_at | 2020-11-18 10:10:47.663911 |
updated_at | 2020-11-18 10:10:47.663911 |
description | Double Exponential Moving Average (DEMA) Implementation In Rust |
homepage | https://github.com/immortalinfidel/dema-rs |
repository | https://github.com/immortalinfidel/dema-rs |
max_upload_size | |
id | 313625 |
size | 4,777 |
use dema_rs::DEMA;
use ta_common::traits::Indicator;
let mut ema = DEMA::new(5);
assert_eq!(ema.next(81.59), None);
assert_eq!(ema.next(81.06), None);
assert_eq!(ema.next(82.87), None);
assert_eq!(ema.next(83.00), None);
assert_eq!(ema.next(83.61), None);
assert_eq!(ema.next(83.15), None);
assert_eq!(ema.next(82.84), None);
assert_eq!(ema.next(83.99), None);
assert_eq!(ema.next(84.55), Some(84.15945181120765));
assert_eq!(ema.next(84.36), Some(84.37935138613696));
assert_eq!(ema.next(85.53), Some(85.12493437653475));
assert_eq!(ema.next(86.54), Some(86.06242299709658));
assert_eq!(ema.next(86.89), Some(86.72659316211335));
assert_eq!(ema.next(87.77), Some(87.5288251063304));
assert_eq!(ema.next(87.29), Some(87.64550318083462));
DEMA=2*EMAn(input) -EMA(EMAn(input));
n=period