Class CompositeIndicator
- Namespace
- FinanceSharp.Indicators
- Assembly
- FinanceSharp.dll
This indicator is capable of wiring up two separate indicators into a single indicator such that the output of each will be sent to a user specified function.
public class CompositeIndicator : IndicatorBase, IIndicator, IUpdatable
- Inheritance
-
CompositeIndicator
- Implements
- Inherited Members
- Extension Methods
Remarks
This type is initialized such that there is no need to call the Update function. This indicator will have its values automatically updated each time a new piece of data is received from both the left and right indicators.
Constructors
CompositeIndicator(IIndicator, IIndicator, IndicatorComposer, CompositionMethod)
Creates a new CompositeIndicator capable of taking the output from the left and right indicators and producing a new value via the composer delegate specified
public CompositeIndicator(IIndicator left, IIndicator right, CompositeIndicator.IndicatorComposer composer, CompositionMethod method = CompositionMethod.OnBothUpdated)
Parameters
leftIIndicatorThe left indicator for the 'composer'
rightIIndicatorThe right indidcator for the 'composoer'
composerCompositeIndicator.IndicatorComposerFunction used to compose the left and right indicators
methodCompositionMethodWhat method to composite the two indicators.
CompositeIndicator(IUpdatable, IUpdatable, IndicatorComposer, CompositionMethod)
Creates a new CompositeIndicator capable of taking the output from the left and right indicators and producing a new value via the composer delegate specified
public CompositeIndicator(IUpdatable left, IUpdatable right, CompositeIndicator.IndicatorComposer composer, CompositionMethod method = CompositionMethod.OnBothUpdated)
Parameters
leftIUpdatableThe left indicator for the 'composer'
rightIUpdatableThe right indidcator for the 'composoer'
composerCompositeIndicator.IndicatorComposerFunction used to compose the left and right indicators
methodCompositionMethodWhat method to composite the two indicators.
CompositeIndicator(string, IUpdatable, IUpdatable, IndicatorComposer, CompositionMethod)
Creates a new CompositeIndicator capable of taking the output from the left and right indicators and producing a new value via the composer delegate specified
public CompositeIndicator(string name, IUpdatable left, IUpdatable right, CompositeIndicator.IndicatorComposer composer, CompositionMethod method = CompositionMethod.OnBothUpdated)
Parameters
namestringThe name of this indicator
leftIUpdatableThe left indicator for the 'composer'
rightIUpdatableThe right indidcator for the 'composoer'
composerCompositeIndicator.IndicatorComposerFunction used to compose the left and right indicators
methodCompositionMethodWhat method to composite the two indicators.
Properties
IsReady
Gets a flag indicating when this indicator is ready and fully initialized
public override bool IsReady { get; }
Property Value
Left
Gets the 'left' indicator for the delegate
public IUpdatable Left { 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
Right
Gets the 'right' indicator for the delegate
public IUpdatable Right { get; }
Property Value
Methods
Forward(long, DoubleArray)
Computes the next value of this indicator from the given state
protected override DoubleArray Forward(long time, DoubleArray input)
Parameters
timelonginputDoubleArrayThe input given to the indicator
Returns
- DoubleArray
A new value for this indicator
Remarks
Since this class overrides ValidateAndForward, this method is a no-op
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