pub struct MacdState { /* private fields */ }Expand description
Incremental MACD (fast/slow/signal EMAs).
Implementations§
Source§impl MacdState
impl MacdState
pub fn new(params: MacdParams) -> FinanceResult<Self>
pub fn from_history(params: MacdParams, closes: &[f64]) -> FinanceResult<Self>
pub fn params(&self) -> MacdParams
pub fn reset(&mut self)
Sourcepub fn push(&mut self, close: f64) -> FinanceResult<Option<(f64, f64, f64)>>
pub fn push(&mut self, close: f64) -> FinanceResult<Option<(f64, f64, f64)>>
Some((macd, signal, hist)) when all three are defined.
Sourcepub fn push_detail(&mut self, close: f64) -> FinanceResult<MacdBarOutput>
pub fn push_detail(&mut self, close: f64) -> FinanceResult<MacdBarOutput>
Per-line warm-up: MACD may be Some before signal/histogram.
pub fn last(&self) -> Option<(f64, f64, f64)>
Sourcepub fn push_bars(
&mut self,
closes: &[f64],
) -> FinanceResult<Vec<Option<(f64, f64, f64)>>>
pub fn push_bars( &mut self, closes: &[f64], ) -> FinanceResult<Vec<Option<(f64, f64, f64)>>>
Push many closes from one payload (full triple only when signal is ready).
Sourcepub fn push_bars_detail(
&mut self,
closes: &[f64],
) -> FinanceResult<Vec<MacdBarOutput>>
pub fn push_bars_detail( &mut self, closes: &[f64], ) -> FinanceResult<Vec<MacdBarOutput>>
Push many closes; each bar may have MACD before signal (batch/parity path).
Trait Implementations§
Auto Trait Implementations§
impl Freeze for MacdState
impl RefUnwindSafe for MacdState
impl Send for MacdState
impl Sync for MacdState
impl Unpin for MacdState
impl UnsafeUnpin for MacdState
impl UnwindSafe for MacdState
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more