pub struct DemaEngine { /* private fields */ }Expand description
Double Exponential Moving Average (DEMA) over the closing price.
DEMA = 2 * e1 - e2. e1 is this crate’s EMA of the closes (EmaEngine: seeded with the
first close, published from the period-th bar on); e2 is the same EMA taken over the
published values of e1, so the second stage starts with the first published value of the
first rather than with the first close.
That chaining differs from super::tema::TemaEngine, whose three stages all run from the
first close. The two produce different early values and converge as the seeds decay.
First output: once e2 publishes, i.e. with the 2 * period - 1-th bar.
Indicator::reset clears both averages.
Implementations§
Trait Implementations§
Source§impl Indicator for DemaEngine
impl Indicator for DemaEngine
fn name(&self) -> &str
fn warmup_period(&self) -> usize
fn reset(&mut self)
fn on_bar(&mut self, bar: &Bar) -> Option<IndicatorOutput>
fn alerts(&self) -> Vec<IndicatorAlert>
Source§fn on_checked_bar(
&mut self,
bar: &Bar,
) -> Result<Option<IndicatorOutput>, BarValidationError>
fn on_checked_bar( &mut self, bar: &Bar, ) -> Result<Option<IndicatorOutput>, BarValidationError>
Validates a bar before forwarding it to
Indicator::on_bar.Auto Trait Implementations§
impl Freeze for DemaEngine
impl RefUnwindSafe for DemaEngine
impl Send for DemaEngine
impl Sync for DemaEngine
impl Unpin for DemaEngine
impl UnsafeUnpin for DemaEngine
impl UnwindSafe for DemaEngine
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