Skip to content

ChartIndicators

Summary

The interface representing a chart indicator instances collection.Provides properties and events that allow for accessing various information about indicators attached to a chart.

Signature

1
public abstract interface ChartIndicators

Namespace

cAlgo.API

Methods

Add (2)

Add (1 of 2)

Summary

Adds a new indicator to a chart.

Signature

1
public abstract ChartIndicator Add(string name, object[] parameterValues)

Parameters

Name Type Description
name string The name of an indicator.
parameterValues object[] The indicator parameter values or an anonymous object that contains indicator parameter values.

Return Value

ChartIndicator

Examples

1
2
3
4
 protected override void Initialize()
 {
     var sma = ChartIndicators.Add("Simple Moving Average", Bars.ClosePrices, 12);
 }
1
2
3
4
 protected override void Initialize()
 {
     var sma = ChartIndicators.Add("Simple Moving Average", new {Source = Bars.ClosePrices, Periods = 12});
 }

Add (2 of 2)

Summary

Adds a new indicator to a chart.

Signature

1
public abstract ChartIndicator Add(IndicatorType type, object[] parameterValues)

Parameters

Name Type Description
type IndicatorType The type of Indicator, you can get IndicatorType from AlgoRegistry.
parameterValues object[] The indicator parameter values or an anonymous object that contains indicator parameter values.

Return Value

ChartIndicator

Examples

1
2
3
4
5
 protected override void Initialize()
 {
     var smaType = AlgoRegistry.Get("Simple Moving Average", AlgoKind.Robot) as IndicatorType;
     var sma = ChartIndicators.Add(smaType, Bars.ClosePrices, 12);
 }
1
2
3
4
5
 protected override void Initialize()
 {
     var smaType = AlgoRegistry.Get("Simple Moving Average", AlgoKind.Robot) as IndicatorType;
     var sma = ChartIndicators.Add(smaType, new {Source = Bars.ClosePrices, Periods = 12});
 }

See Also

Remove

Summary

Removes an indicator from a chart.

Signature

1
public abstract bool Remove(ChartIndicator indicator)

Parameters

Name Type Description
indicator ChartIndicator The ChartIndicator to be removed from a chart.

Return Value

bool

Properties

Item

Signature

1
public abstract ChartIndicator Item {get;}

Return Value

ChartIndicator

Standard

Summary

Gets the list of chart standard indicators.

Signature

1
public abstract IReadonlyList<ChartIndicator> Standard {get;}

Return Value

IReadonlyList

Custom

Summary

Gets the list of chart custom indicators.

Signature

1
public abstract IReadonlyList<ChartIndicator> Custom {get;}

Return Value

IReadonlyList

Count

Summary

Gets the number of all indicators attached to a chart.

Signature

1
public abstract int Count {get;}

Return Value

int

Events

IndicatorAdded

Summary

Occurs when a new indicator is added to a chart.

Signature

1
public abstract event Action<ChartIndicatorAddedEventArgs> IndicatorAdded;

IndicatorRemoved

Summary

Occurs when an indicator is removed from a chart.

Signature

1
public abstract event Action<ChartIndicatorRemovedEventArgs> IndicatorRemoved;

IndicatorModified

Summary

Occurs when an indicator attached to a chart is modified.

Signature

1
public abstract event Action<ChartIndicatorModifiedEventArgs> IndicatorModified;