pub struct StandardDeviation { /* private fields */ }
Expand description
Standard deviation (SD).
Returns the standard deviation of the last n values.
§Formula
Where:
- σ - value of standard deviation for N given probes.
- N - number of probes in observation.
- xi - i-th observed value from N elements observation.
§Parameters
- n - number of periods (integer greater than 0)
§Example
use ta::indicators::StandardDeviation;
use ta::{Calculate, Next};
let mut sd = StandardDeviation::new(3).unwrap();
assert_eq!(sd.calc(10.0), 0.0);
assert_eq!(sd.calc(20.0), 5.0);
§Links
Implementations§
Trait Implementations§
Source§impl Clone for StandardDeviation
impl Clone for StandardDeviation
Source§fn clone(&self) -> StandardDeviation
fn clone(&self) -> StandardDeviation
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 StandardDeviation
impl Debug for StandardDeviation
Source§impl Default for StandardDeviation
impl Default for StandardDeviation
Source§impl Display for StandardDeviation
impl Display for StandardDeviation
Auto Trait Implementations§
impl Freeze for StandardDeviation
impl RefUnwindSafe for StandardDeviation
impl Send for StandardDeviation
impl Sync for StandardDeviation
impl Unpin for StandardDeviation
impl UnwindSafe for StandardDeviation
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