Skip to main content

Indicator

Trait Indicator 

Source
pub trait Indicator {
    type Input;
    type Output;

    // Required methods
    fn update(&mut self, input: Self::Input) -> Option<Self::Output>;
    fn reset(&mut self);
    fn warmup_period(&self) -> usize;
    fn is_ready(&self) -> bool;
    fn name(&self) -> &'static str;
}
Expand description

A streaming technical indicator.

Every indicator in Wickra implements this trait. The contract is:

  • update is called once per input point and must be O(1) in the input length. Pre-existing buffered state may be touched, but no full recomputation over the entire series is permitted.
  • The returned Option<Output> is None while the indicator is still in its warmup phase (insufficient inputs to produce a defined value), and Some once it is ready.
  • reset clears all state, returning the indicator to the exact configuration it had immediately after construction.

Implementors that consume scalar prices use Input = f64 so they automatically gain access to chaining via Chain.

Required Associated Types§

Source

type Input

Type of one input data point (typically f64 for a price, or Candle / Tick).

Source

type Output

Type of one output value.

Required Methods§

Source

fn update(&mut self, input: Self::Input) -> Option<Self::Output>

Feed one new data point into the indicator and return the freshly computed output, or None if the indicator is still warming up.

Source

fn reset(&mut self)

Reset all internal state, leaving the indicator equivalent to a freshly constructed instance with the same parameters.

Source

fn warmup_period(&self) -> usize

Number of inputs required before the first non-None output can be produced.

Source

fn is_ready(&self) -> bool

Whether the indicator has emitted at least one value since the last reset.

Source

fn name(&self) -> &'static str

Stable, human-readable indicator name. Used by chaining and diagnostics.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§

Source§

impl Indicator for AcceleratorOscillator

Source§

impl Indicator for Adl

Source§

impl Indicator for Adx

Source§

impl Indicator for Aroon

Source§

impl Indicator for AroonOscillator

Source§

impl Indicator for Atr

Source§

impl Indicator for AtrTrailingStop

Source§

impl Indicator for AwesomeOscillator

Source§

impl Indicator for BalanceOfPower

Source§

impl Indicator for BollingerBands

Source§

impl Indicator for BollingerBandwidth

Source§

impl Indicator for Cci

Source§

impl Indicator for ChaikinMoneyFlow

Source§

impl Indicator for ChaikinOscillator

Source§

impl Indicator for ChaikinVolatility

Source§

impl Indicator for ChandeKrollStop

Source§

impl Indicator for ChandelierExit

Source§

impl Indicator for ChoppinessIndex

Source§

impl Indicator for Cmo

Source§

impl Indicator for Coppock

Source§

impl Indicator for Dema

Source§

impl Indicator for Donchian

Source§

impl Indicator for Dpo

Source§

impl Indicator for EaseOfMovement

Source§

impl Indicator for Ema

Source§

impl Indicator for ForceIndex

Source§

impl Indicator for HistoricalVolatility

Source§

impl Indicator for Hma

Source§

impl Indicator for Kama

Source§

impl Indicator for Keltner

Source§

impl Indicator for LinRegAngle

Source§

impl Indicator for LinRegSlope

Source§

impl Indicator for LinearRegression

Source§

impl Indicator for MacdIndicator

Source§

impl Indicator for MassIndex

Source§

impl Indicator for MedianPrice

Source§

impl Indicator for Mfi

Source§

impl Indicator for Mom

Source§

impl Indicator for Natr

Source§

impl Indicator for Obv

Source§

impl Indicator for PercentB

Source§

impl Indicator for Pmo

Source§

impl Indicator for Ppo

Source§

impl Indicator for Psar

Source§

impl Indicator for Roc

Source§

impl Indicator for RollingVwap

Source§

impl Indicator for Rsi

Source§

impl Indicator for Sma

Source§

impl Indicator for Smma

Source§

impl Indicator for StdDev

Source§

impl Indicator for StochRsi

Source§

impl Indicator for Stochastic

Source§

impl Indicator for SuperTrend

Source§

impl Indicator for T3

Source§

impl Indicator for Tema

Source§

impl Indicator for Trima

Source§

impl Indicator for Trix

Source§

impl Indicator for TrueRange

Source§

impl Indicator for Tsi

Source§

impl Indicator for TypicalPrice

Source§

impl Indicator for UlcerIndex

Source§

impl Indicator for UltimateOscillator

Source§

impl Indicator for VerticalHorizontalFilter

Source§

impl Indicator for VolumePriceTrend

Source§

impl Indicator for Vortex

Source§

impl Indicator for Vwap

Source§

impl Indicator for Vwma

Source§

impl Indicator for WeightedClose

Source§

impl Indicator for WilliamsR

Source§

impl Indicator for Wma

Source§

impl Indicator for ZScore

Source§

impl Indicator for Zlema

Source§

impl<A, B> Indicator for Chain<A, B>
where A: Indicator<Input = f64, Output = f64>, B: Indicator<Input = f64>,