Skip to content

ChartTemplateIndicators.Get

method · ChartTemplateIndicators · cAlgo.API Since 5.6

DesktopCLICloud

Returns a chart template indicator by type if exists otherwise null.

Environment behaviour

Cloud — not supported. Never available in the cloud: it is only returned by members that do not work there (ChartTemplate.Indicators).

Definition

ChartTemplateIndicator Get(string id)
chartTemplateIndicators.Get(id: str) -> ChartTemplateIndicator | None

Parameters

Name C# type Python type Description
id string str The id of Indicator, you can get.

Returns ChartTemplateIndicator — ChartTemplateIndicator if found otherwise null.

Examples

var template = ChartTemplates.Get("My Template");
var indicatorId = template?.Indicators.FirstOrDefault()?.Id;
var indicator = indicatorId != null ? template.Indicators.Get(indicatorId) : null;
if (indicator != null)
    Print("Found template indicator: {0}", indicator.Type.Name);
template = api.ChartTemplates.Get("My Template")
if template is not None:
    for item in template.Indicators:
        indicator = template.Indicators.Get(item.Id)
        if indicator is not None:
            api.Print(f"Found template indicator: {indicator.Type.Name}")