Table of Contents

Class BaseIndicator

Namespace
StockSharp.Algo.Indicators
Assembly
StockSharp.Algo.dll

The base Indicator.

public abstract class BaseIndicator : Cloneable<IIndicator>, IIndicator, IPersistable, ICloneable<IIndicator>, ICloneable
Inheritance
BaseIndicator
Implements
IPersistable
ICloneable<IIndicator>
Derived
Extension Methods

Constructors

BaseIndicator()

Initialize BaseIndicator.

protected BaseIndicator()

Properties

Color

Indicator color. If null then the color will be automatically selected.

[Browsable(false)]
public virtual Color? Color { get; }

Property Value

Color?

Container

The container storing indicator data.

[Browsable(false)]
public IIndicatorContainer Container { get; }

Property Value

IIndicatorContainer

Id

Unique ID.

[Browsable(false)]
public Guid Id { get; }

Property Value

Guid

InputType

Input values type.

[Browsable(false)]
public virtual Type InputType { get; }

Property Value

Type

IsFormed

Whether the indicator is set.

[Browsable(false)]
public bool IsFormed { get; protected set; }

Property Value

bool

Measure

[Browsable(false)]
public virtual IndicatorMeasures Measure { get; }

Property Value

IndicatorMeasures

Name

Indicator name.

[Display(ResourceType = typeof(LocalizedStrings), Name = "Name", Description = "IndicatorName", GroupName = "General")]
public string Name { get; set; }

Property Value

string

NumValuesToInitialize

Number of values that need to be processed in order for the indicator to initialize (be IsFormed equals true). null if undefined.

[Browsable(false)]
public virtual int NumValuesToInitialize { get; }

Property Value

int

ResultType

Result values type.

[Browsable(false)]
public virtual Type ResultType { get; }

Property Value

Type

Style

Chart indicator draw style.

[Browsable(false)]
public virtual DrawStyles Style { get; }

Property Value

DrawStyles

Methods

CalcIsFormed()

Calc IsFormed.

protected virtual bool CalcIsFormed()

Returns

bool

IsFormed

Clone()

Create a copy of IIndicator.

public override IIndicator Clone()

Returns

IIndicator

Copy.

CreateValue(DateTimeOffset, object[])

Convert to indicator value.

public virtual IIndicatorValue CreateValue(DateTimeOffset time, object[] values)

Parameters

time DateTimeOffset

Time

values object[]

ToValues()

Returns

IIndicatorValue

IIndicatorValue

Load(SettingsStorage)

Load settings.

public virtual void Load(SettingsStorage storage)

Parameters

storage SettingsStorage

Settings storage.

LoadValues(SettingsStorage)

Load settings.

protected void LoadValues(SettingsStorage storage)

Parameters

storage SettingsStorage

Settings storage.

OnProcess(IIndicatorValue)

To handle the input value.

protected abstract IIndicatorValue OnProcess(IIndicatorValue input)

Parameters

input IIndicatorValue

The input value.

Returns

IIndicatorValue

The resulting value.

Process(IIndicatorValue)

To handle the input value.

public virtual IIndicatorValue Process(IIndicatorValue input)

Parameters

input IIndicatorValue

The input value.

Returns

IIndicatorValue

The new value of the indicator.

RaiseChangedEvent(IIndicatorValue, IIndicatorValue)

To call the event Changed.

protected void RaiseChangedEvent(IIndicatorValue input, IIndicatorValue result)

Parameters

input IIndicatorValue

The input value of the indicator.

result IIndicatorValue

The resulting value of the indicator.

Reset()

To reset the indicator status to initial. The method is called each time when initial settings are changed (for example, the length of period).

public virtual void Reset()

Save(SettingsStorage)

Save settings.

public virtual void Save(SettingsStorage storage)

Parameters

storage SettingsStorage

Settings storage.

SaveValues(SettingsStorage)

Save settings.

protected void SaveValues(SettingsStorage storage)

Parameters

storage SettingsStorage

Settings storage.

ToString()

public override string ToString()

Returns

string

Events

Changed

The indicator change event (for example, a new value is added).

public event Action<IIndicatorValue, IIndicatorValue> Changed

Event Type

Action<IIndicatorValue, IIndicatorValue>

Reseted

The event of resetting the indicator status to initial. The event is called each time when initial settings are changed (for example, the length of period).

public event Action Reseted

Event Type

Action