Struct SumIndicator<TInner, TSample, TValue>
Result of Sum<TSelf, TSample, TValue>(IIndicator<TSelf, TSample, TValue>, int). Maintains an O(1)-amortized running sum over a sliding last-N window.
public readonly struct SumIndicator<TInner, TSample, TValue> : IIndicator<SumIndicator<TInner, TSample, TValue>, TSample, (TValue Sum, int Count)>, ISignal<(TValue Sum, int Count)> where TInner : IIndicator<TInner, TSample, TValue> where TValue : IAdditionOperators<TValue, TValue, TValue>, ISubtractionOperators<TValue, TValue, TValue>
Type Parameters
TInnerThe wrapped indicator's concrete type.
TSampleThe sample type consumed on each observation.
TValueThe wrapped indicator's value type.
- Implements
- Inherited Members
- Extension Methods
Properties
Value
The current signal value.
public (TValue Sum, int Count) Value { get; }
Property Value
Remarks
Count is the live in-window count (≤ the requested window size,
less until the window fills) — needed by any caller dividing the sum into an
average.
Methods
Add(TSample)
Fold one more sample in, returning the updated indicator.
public SumIndicator<TInner, TSample, TValue> Add(TSample sample)
Parameters
sampleTSampleThe new observation.
Returns
- SumIndicator<TInner, TSample, TValue>
A new indicator instance reflecting
sample.