1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
// Indicator traits
use ;
/// Resets an indicator to the initial state.
/// Consumes a data item of type `T` and returns `Output`.
///
/// Typically `T` can be `f64` or a struct similar to [DataItem](struct.DataItem.html), that implements
/// traits necessary to calculate value of a particular indicator.
///
/// In most cases `Output` is `f64`, though indicators such as Bollinger Bands
/// return a dedicated output structure.
/// Batched form of [`Next`]: consumes a slice of inputs and returns a vector of outputs.
///
/// The default implementation simply loops over [`Next::next`], so any
/// indicator implementing `Next<T>` automatically gets a `next_batch`
/// method with no extra code. Indicators that have a faster vectorized
/// path (e.g. [`ExponentialMovingAverage`](crate::indicators::ExponentialMovingAverage))
/// override this method to dispatch to the SIMD primitives in
/// [`crate::simd`]. Override semantics must exactly match the scalar
/// loop — every overrider has parity tests that compare `next_batch`
/// against repeated calls to `next` on the same input.