pub struct StdDev { /* private fields */ }Expand description
Standard Deviation indicator.
Computes the population standard deviation of closing prices over the specified period.
§Formula
StdDev = sqrt(sum((x - mean)^2) / n)
where x is each closing price, mean is the average, and n is the period.
§Example
use quant_indicators::{Indicator, StdDev};
use quant_primitives::Candle;
use chrono::Utc;
use rust_decimal_macros::dec;
let ts = Utc::now();
let candles: Vec<Candle> = (0..20).map(|i| {
Candle::new(dec!(100), dec!(110), dec!(90), dec!(100) + rust_decimal::Decimal::from(i), dec!(1000), ts).unwrap()
}).collect();
let stddev = StdDev::new(20).unwrap();
let series = stddev.compute(&candles).unwrap();Implementations§
Trait Implementations§
Auto Trait Implementations§
impl Freeze for StdDev
impl RefUnwindSafe for StdDev
impl Send for StdDev
impl Sync for StdDev
impl Unpin for StdDev
impl UnsafeUnpin for StdDev
impl UnwindSafe for StdDev
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