pub trait MovingAverageConstructor: Clone + FromStr {
    type Type: Eq;
    type Instance: MovingAverage;

    // Required methods
    fn init(&self, initial_value: ValueType) -> Result<Self::Instance, Error>;
    fn ma_period(&self) -> PeriodType;
    fn ma_type(&self) -> Self::Type;

    // Provided method
    fn is_similar_to(&self, other: &Self) -> bool { ... }
}
Expand description

Trait for dynamically creation of moving average instances based on it’s type and period

This trait plays the same role for moving averages as IndicatorConfig plays for indicators.

Required Associated Types§

source

type Type: Eq

Used for comparing MA types

source

type Instance: MovingAverage

MovingAverage Instance type

Required Methods§

source

fn init(&self, initial_value: ValueType) -> Result<Self::Instance, Error>

Creates moving average instance with the initial_value

source

fn ma_period(&self) -> PeriodType

Returns period length of

source

fn ma_type(&self) -> Self::Type

Returns moving average type

Provided Methods§

source

fn is_similar_to(&self, other: &Self) -> bool

Checks two moving average constructors for the same moving average type

Object Safety§

This trait is not object safe.

Implementors§