Skip to content

ChartTemplateRobots.Get

method · ChartTemplateRobots · cAlgo.API Since 5.6

DesktopCLICloud

Returns a chart template robot 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.Robots).

Definition

ChartTemplateRobot Get(string id)
chartTemplateRobots.Get(id: str) -> ChartTemplateRobot | None

Parameters

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

Returns ChartTemplateRobot — ChartTemplateRobot if found otherwise null.

Examples

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