---
id: "M:cAlgo.API.ChartRobots.Add(System.String,System.Object[])"
kind: "method"
type: "T:cAlgo.API.ChartRobots"
url: "https://help.ctrader.com/ctrader-algo/references/Chart/Robots/ChartRobots/Add/"
---

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

# ChartRobots.Add

Member of [ChartRobots](https://help.ctrader.com/ctrader-algo/references/Chart/Robots/ChartRobots/index.md).

## Add(string name, object[] parameterValues)

Adds a new Robot instance 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.

C#:

```csharp
ChartRobot Add(string name, object[] parameterValues)
```

Python:

```python
api.ChartRobots.Add(name: str, parameterValues: list[object]) -> ChartRobot
```

### Parameters

- `name` (`string`, Python `str`): The name of a Robot.
- `parameterValues` (`object[]`, Python `list[object]`): The Robot parameter values or an anonymous object that contains Robot parameter values.

### Returns

`ChartRobot` — An `ChartRobot` representing the added Robot instance.

### Examples

C#:

```csharp
var martingaleBot = ChartRobots.Add("Sample Martingale cBot", 0.01, 10, 10);
var trendBot = ChartRobots.Add("Sample Trend cBot", new { Quantity = 0.01 });
martingaleBot.Start();
Print("Added {0} and {1}", martingaleBot.Name, trendBot.Name);
```

Python:

```python
martingaleBot = api.ChartRobots.Add("Sample Martingale cBot", 0.01, 10, 10)
martingaleBot.Start()
api.Print(f"Added {martingaleBot.Name}")
```

## Add(RobotType type, object[] parameterValues)

Adds a new Robot instance 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.

C#:

```csharp
ChartRobot Add(RobotType type, object[] parameterValues)
```

Python:

```python
api.ChartRobots.Add(type: RobotType, parameterValues: list[object]) -> ChartRobot
```

### Parameters

- `type` (`RobotType`, Python `RobotType`): The type of Robot, you can get RobotType from AlgoRegistry.
- `parameterValues` (`object[]`, Python `list[object]`): The Robot parameter values or an anonymous object that contains Robot parameter values.

### Returns

`ChartRobot` — An `ChartRobot` representing the added Robot instance.

Available since cAlgo.API 5.2.

### Examples

C#:

```csharp
if (AlgoRegistry.Get("Sample Martingale cBot", AlgoKind.Robot) is RobotType martingaleBotType)
{
    var martingaleBot = ChartRobots.Add(martingaleBotType, new { InitialQuantity = 0.01, StopLoss = 10, TakeProfit = 10 });
    Print("Added cBot: {0}", martingaleBot.Name);
}
```

Python:

```python
martingaleBotType = api.AlgoRegistry.Get("Sample Martingale cBot", AlgoKind.Robot)
if martingaleBotType is not None:
    martingaleBot = api.ChartRobots.Add(martingaleBotType, 0.01, 10, 10)
    api.Print(f"Added cBot: {martingaleBot.Name}")
```

