Class ComparingIndicatorBase
- Namespace
- FinanceSharp.Indicators
- Assembly
- FinanceSharp.dll
An indicator that holds a memory (a CurrentPoint) based on comparing current to the newly updated time and value.
public abstract class ComparingIndicatorBase : IndicatorBase, IIndicator, IUpdatable
- Inheritance
-
ComparingIndicatorBase
- Implements
- Derived
- Inherited Members
- Extension Methods
Constructors
ComparingIndicatorBase(string)
Initializes a new instance of the Indicator class using the specified name.
protected ComparingIndicatorBase(string name)
Parameters
namestringThe name of this indicator
Fields
CurrentPoint
The Current and CurrentTime coupled.
protected (long Time, DoubleArray Array) CurrentPoint
Field Value
- (long time, DoubleArray Array)
Properties
Current
Gets the current state of this indicator. If the state has not been updated then the time on the value will equal DateTime.MinValue.
public override DoubleArray Current { get; }
Property Value
CurrentTime
The time of the currently stored data in milliseconds-epoch.
public override long CurrentTime { get; }
Property Value
InputProperties
The number of properties of input argument of Update(long, DoubleArray) must have.
public override int InputProperties { get; }
Property Value
IsReady
Gets a flag indicating when this indicator is ready and fully initialized
public override bool IsReady { get; }
Property Value
OutputCount
The number of items Current will have.
public override int OutputCount { get; protected set; }
Property Value
Properties
The number of properties Current will have.
public override int Properties { get; }
Property Value
WarmUpPeriod
Required period, in data points (number of updates), for the indicator to be ready and fully initialized.
public override int WarmUpPeriod { get; }
Property Value
Methods
Comparer((long time, DoubleArray Array), (long Time, DoubleArray Array))
Compares current against input returning the new Current and CurrentTime values.
protected abstract (long Time, DoubleArray Array) Comparer((long time, DoubleArray Array) current, (long Time, DoubleArray Array) input)
Parameters
current(long time, DoubleArray Array)The Current from the handling indicator.
input(long time, DoubleArray Array)The new input to compare against.
Returns
- (long time, DoubleArray Array)
The new Current and CurrentTime to set.
Remarks
Equivalent to DoubleArrayComparingHandler
Forward(long, DoubleArray)
Computes the next value of this indicator from the given state
protected override sealed DoubleArray Forward(long time, DoubleArray input)
Parameters
timelonginputDoubleArrayThe input given to the indicator
Returns
- DoubleArray
A new value for this indicator
Reset()
Resets this indicator to its initial state
public override void Reset()
Update(long, DoubleArray)
Updates the state of this indicator with the given value and returns true if this indicator is ready, false otherwise
public override void Update(long time, DoubleArray input)
Parameters
timelonginputDoubleArrayThe value to use to update this indicator
ValidateAndForward(long, DoubleArray)
Computes the next value of this indicator from the given state and returns an instance of the IndicatorResult class
protected virtual ((long Time, DoubleArray Array) Point, bool Changed) ValidateAndForward(long inputTime, DoubleArray input)
Parameters
inputTimelonginputDoubleArrayThe input given to the indicator