pub trait IndicatorInstance: Sized {
    type Config: IndicatorConfig<Instance = Self>;
    fn config(&self) -> &Self::Config;
    fn next<T: OHLCV>(&mut self, candle: &T) -> IndicatorResult;

    fn over<T, S>(&mut self, inputs: S) -> Vec<IndicatorResult>
    where
        T: OHLCV,
        S: AsRef<[T]>
, { ... } fn size(&self) -> (u8, u8) { ... } fn name(&self) -> &'static str { ... } fn into_fn<'a, T>(self) -> Box<dyn FnMut(&'a T) -> IndicatorResult>
    where
        T: OHLCV,
        Self: 'static
, { ... } }
Expand description

Base trait for implementing indicators State

Associated Types

Type of Indicator Configuration

Required methods

Returns a reference to the indicator Configuration

Evaluates given candle and returns IndicatorResult

Provided methods

Evaluates the State over the given sequence of candles and returns sequence of IndicatorResults.

use yata::prelude::*;
use yata::helpers::{RandomCandles};
use yata::indicators::Trix;

let candles: Vec<_> = RandomCandles::new().take(10).collect();
let trix = Trix::default();
let mut state = trix.init(&candles[0]).unwrap();

let results = state.over(&candles);
println!("{:?}", results);

Returns count of indicator’s raw values and count of indicator’s signals.

See more at IndicatorConfig

Returns a name of the indicator

Creates a function from IndicatorInstance

Implementors

Implementing IndicatorInstance trait for Example