pub trait Indicator: Send + Sync {
// Required methods
fn name(&self) -> &str;
fn reset(&mut self);
fn on_bar(&mut self, bar: &Bar) -> Option<IndicatorOutput>;
// Provided methods
fn warmup_period(&self) -> usize { ... }
fn on_checked_bar(
&mut self,
bar: &Bar,
) -> Result<Option<IndicatorOutput>, BarValidationError> { ... }
fn alerts(&self) -> Vec<IndicatorAlert> { ... }
}Expand description
Core trait implemented by all technical indicators.
Required Methods§
fn name(&self) -> &str
fn reset(&mut self)
fn on_bar(&mut self, bar: &Bar) -> Option<IndicatorOutput>
Provided Methods§
fn warmup_period(&self) -> usize
Sourcefn 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.
fn alerts(&self) -> Vec<IndicatorAlert>
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".
Implementations on Foreign Types§
Source§impl<T: Indicator + ?Sized> Indicator for Box<T>
Lets a boxed indicator (as returned by registry::build/registry::build_typed) be used
anywhere a concrete Indicator is expected, e.g. as the generic parameter of
source_mapped::SourceMapped or crate::graph::Leaf.
impl<T: Indicator + ?Sized> Indicator for Box<T>
Lets a boxed indicator (as returned by registry::build/registry::build_typed) be used
anywhere a concrete Indicator is expected, e.g. as the generic parameter of
source_mapped::SourceMapped or crate::graph::Leaf.