Skip to content

ChartIndicators.Item

property · ChartIndicators · cAlgo.API

DesktopCLICloud

Gets an indicator attached to a chart by its instance ID.

Environment behaviour

Cloud — not supported. Always empty: Count is 0, Add returns null, Remove returns false, and the events never fire.

Definition

ChartIndicator Item {get;}
api.ChartIndicators[instanceId: str] -> ChartIndicator

Parameters

Name C# type Python type Description
instanceId string str The instance ID of an indicator attached to a chart.

Returns ChartIndicator

Examples

var sma = ChartIndicators.Add("Simple Moving Average", Bars.ClosePrices, 20);
var indicator = ChartIndicators[sma.InstanceId];
if (indicator != null)
    Print("Found indicator: {0}", indicator.Name);
sma = api.ChartIndicators.Add("Simple Moving Average", api.Bars.ClosePrices, 20)
indicator = api.ChartIndicators[sma.InstanceId]
if indicator is not None:
    api.Print(f"Found indicator: {indicator.Name}")