pub struct StdDev { /* private fields */ }Expand description
Standard Deviation of closing prices.
Measures the volatility of price movements over a specified period.
§Examples
use mantis_ta::indicators::{Indicator, StdDev};
use mantis_ta::types::Candle;
let candles: Vec<Candle> = [1.0, 2.0, 3.0, 4.0]
.iter()
.enumerate()
.map(|(i, c)| Candle {
timestamp: i as i64,
open: *c,
high: *c,
low: *c,
close: *c,
volume: 0.0,
})
.collect();
let values = StdDev::new(3).calculate(&candles);
assert_eq!(values[0], None);
assert_eq!(values[1], None);
assert!(values[2].is_some());
assert!(values[3].is_some());Implementations§
Trait Implementations§
Source§impl Indicator for StdDev
impl Indicator for StdDev
Source§fn next(&mut self, candle: &Candle) -> Option<Self::Output>
fn next(&mut self, candle: &Candle) -> Option<Self::Output>
Feed one candle; returns
Some(output) once warmup is satisfied, otherwise None.Source§fn warmup_period(&self) -> usize
fn warmup_period(&self) -> usize
Number of candles required before the first valid output.
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