---
id: "T:cAlgo.API.ChartRobots"
kind: "interface"
namespace: "cAlgo.API"
url: "https://help.ctrader.com/ctrader-algo/references/Chart/Robots/ChartRobots/"
---

> Documentation index for agents: https://help.ctrader.com/ctrader-algo/llms.txt · machine index: https://help.ctrader.com/ctrader-algo/api.json

# ChartRobots (interface)

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

Environments: Desktop supported · CLI supported · Cloud not supported.

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

## Definition

```csharp
public interface ChartRobots
```

## Examples

C#:

```csharp
using cAlgo.API;

namespace cAlgo.Robots;

public partial class TestExample : Robot
{
   protected override void OnStart()
   {
       foreach (var chartRobot in ChartRobots)
       {
            Print($"Name: {chartRobot.Name} | InstanceId: {chartRobot.InstanceId} | State: {chartRobot.State} | Type Name: {chartRobot.Type.Name}");
       }

        ChartRobots.RobotAdded += args => Print($"Robot added, {args.Robot.Name}");
        ChartRobots.RobotRemoved += args => Print($"Robot removed, {args.Robot.Name}");
        ChartRobots.RobotModified += args => Print($"Robot modified, {args.Robot.Name}");
        ChartRobots.RobotStarted += args => Print($"Robot started, {args.Robot.Name}");
        ChartRobots.RobotStopped += args => Print($"Robot stopped, {args.Robot.Name}");

       var addedChartRobot = ChartRobots.Add("Sample Break Even");

       addedChartRobot.Start();
   }
}
```

Python:

```python
import clr

clr.AddReference("cAlgo.API")

# Import cAlgo API types
from cAlgo.API import *

# Import trading wrapper functions
from robot_wrapper import *

class Test():
    def on_start(self):
        for chartRobot in api.ChartRobots:
            print(f"Name: {chartRobot.Name} | InstanceId: {chartRobot.InstanceId} | State: {chartRobot.State} | Type Name: {chartRobot.Type.Name}")

        api.ChartRobots.RobotAdded += lambda args: print(f"Robot added, {args.Robot.Name}")
        api.ChartRobots.RobotRemoved += lambda args: print(f"Robot removed, {args.Robot.Name}")
        api.ChartRobots.RobotModified += lambda args: print(f"Robot modified, {args.Robot.Name}")
        api.ChartRobots.RobotStarted += lambda args: print(f"Robot started, {args.Robot.Name}")
        api.ChartRobots.RobotStopped += lambda args: print(f"Robot stopped, {args.Robot.Name}")

        addedChartRobot = api.ChartRobots.Add("Sample Break Even")
        addedChartRobot.Start()
```

config.json:

```json
{
  "AccessRights": "None"
}
```

## Methods

- `ChartRobot Add(string name, object[] parameterValues)` — Adds a new Robot instance to a chart. [details](https://help.ctrader.com/ctrader-algo/references/Chart/Robots/ChartRobots/Add/index.md)
- `ChartRobot Add(RobotType type, object[] parameterValues)` — Adds a new Robot instance to a chart. [details](https://help.ctrader.com/ctrader-algo/references/Chart/Robots/ChartRobots/Add/index.md)
- `bool Remove(ChartRobot robot)` — Removes a Robot instance from a chart. [details](https://help.ctrader.com/ctrader-algo/references/Chart/Robots/ChartRobots/Remove/index.md)

## Properties

- `int Count {get;}` — Gets the number of all Robots attached to a chart. [details](https://help.ctrader.com/ctrader-algo/references/Chart/Robots/ChartRobots/Count/index.md)
- `ChartRobot Item {get;}` — Gets a Robot attached instance to a chart by its instance ID. [details](https://help.ctrader.com/ctrader-algo/references/Chart/Robots/ChartRobots/Item/index.md)

## Events

- `event Action<ChartRobotAddedEventArgs> RobotAdded;` — Occurs when a Robot is added to a chart. [details](https://help.ctrader.com/ctrader-algo/references/Chart/Robots/ChartRobots/RobotAdded/index.md)
- `event Action<ChartRobotModifiedEventArgs> RobotModified;` — Occurs when a chart Robot instance is modified. [details](https://help.ctrader.com/ctrader-algo/references/Chart/Robots/ChartRobots/RobotModified/index.md)
- `event Action<ChartRobotRemovedEventArgs> RobotRemoved;` — Occurs when a Robot is removed from a chart. [details](https://help.ctrader.com/ctrader-algo/references/Chart/Robots/ChartRobots/RobotRemoved/index.md)
- `event Action<ChartRobotStartedEventArgs> RobotStarted;` — Occurs when a chart Robot instance is started. [details](https://help.ctrader.com/ctrader-algo/references/Chart/Robots/ChartRobots/RobotStarted/index.md)
- `event Action<ChartRobotStoppedEventArgs> RobotStopped;` — Occurs when a chart Robot instance is stopped. [details](https://help.ctrader.com/ctrader-algo/references/Chart/Robots/ChartRobots/RobotStopped/index.md)

