pub struct SlowStochastic { /* private fields */ }
Expand description
Slow stochastic oscillator.
Basically it is a fast stochastic oscillator smoothed with exponential moving average.
§Parameters
- stochastic_n - number of periods for fast stochastic (integer greater than 0). Default is 14. *ema_n - length for EMA (integer greater than 0). Default is 3.
§Example
use ta::indicators::SlowStochastic;
use ta::{Calculate, Next};
let mut stoch = SlowStochastic::new(3, 2).unwrap();
assert_eq!(stoch.calc(10.0), 50.0);
assert_eq!(stoch.calc(50.0).round(), 83.0);
assert_eq!(stoch.calc(50.0).round(), 94.0);
assert_eq!(stoch.calc(30.0).round(), 31.0);
assert_eq!(stoch.calc(55.0).round(), 77.0);
Implementations§
Trait Implementations§
Source§impl Clone for SlowStochastic
impl Clone for SlowStochastic
Source§fn clone(&self) -> SlowStochastic
fn clone(&self) -> SlowStochastic
Returns a copy of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreSource§impl Debug for SlowStochastic
impl Debug for SlowStochastic
Source§impl Default for SlowStochastic
impl Default for SlowStochastic
Source§impl Display for SlowStochastic
impl Display for SlowStochastic
Auto Trait Implementations§
impl Freeze for SlowStochastic
impl RefUnwindSafe for SlowStochastic
impl Send for SlowStochastic
impl Sync for SlowStochastic
impl Unpin for SlowStochastic
impl UnwindSafe for SlowStochastic
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more