pub struct IncrementalBollinger { /* private fields */ }Expand description
Incremental Bollinger Bands — per-tick bands over a rolling window.
Mirrors the batch BollingerBands:
middle is the period-SMA, the deviation is the sample standard
deviation (ddof = 1) over the window, and upper/lower are
middle ± std_mult * std (2.0 is the common multiplier). Emits None until
period samples are buffered. Unlike the EMA-based incremental structs this
keeps a period-length window, so each update is O(period), not O(1).
Implementations§
Source§impl IncrementalBollinger
impl IncrementalBollinger
Sourcepub fn new(period: usize, std_mult: f64) -> Self
pub fn new(period: usize, std_mult: f64) -> Self
Create incremental Bollinger Bands for the given period and band
multiplier (std_mult, conventionally 2.0).
Sourcepub fn update(&mut self, price: f64) -> Option<BollingerBandsValue>
pub fn update(&mut self, price: f64) -> Option<BollingerBandsValue>
Feed the next price; returns the bands once period samples are buffered
(and period >= 2, so the sample stddev is defined).
Trait Implementations§
Source§impl Clone for IncrementalBollinger
impl Clone for IncrementalBollinger
Source§fn clone(&self) -> IncrementalBollinger
fn clone(&self) -> IncrementalBollinger
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for IncrementalBollinger
impl RefUnwindSafe for IncrementalBollinger
impl Send for IncrementalBollinger
impl Sync for IncrementalBollinger
impl Unpin for IncrementalBollinger
impl UnsafeUnpin for IncrementalBollinger
impl UnwindSafe for IncrementalBollinger
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