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

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

# ChartIndicators.Add

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

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

Adds a new indicator 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
ChartIndicator Add(string name, object[] parameterValues)
```

Python:

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

### Parameters

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

### Returns

`ChartIndicator` — An `ChartIndicator` representing the added indicator instance.

### Examples

C#:

```csharp
var sma = ChartIndicators.Add("Simple Moving Average", Bars.ClosePrices, 12);
var ema = ChartIndicators.Add("Exponential Moving Average", new { Source = Bars.ClosePrices, Periods = 26 });
Print("Added {0} and {1}", sma.Name, ema.Name);
```

Python:

```python
sma = api.ChartIndicators.Add("Simple Moving Average", api.Bars.ClosePrices, 12)
ema = api.ChartIndicators.Add("Exponential Moving Average", api.Bars.ClosePrices, 26)
api.Print(f"Added {sma.Name} and {ema.Name}")
```

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

Adds a new indicator 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
ChartIndicator Add(IndicatorType type, object[] parameterValues)
```

Python:

```python
api.ChartIndicators.Add(type: IndicatorType, parameterValues: list[object]) -> ChartIndicator
```

### Parameters

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

### Returns

`ChartIndicator` — An `ChartIndicator` representing the added indicator instance.

Available since cAlgo.API 5.2.

### Examples

C#:

```csharp
if (AlgoRegistry.Get("Simple Moving Average", AlgoKind.StandardIndicator) is IndicatorType smaType)
{
    var sma = ChartIndicators.Add(smaType, new { Source = Bars.ClosePrices, Periods = 12 });
    Print("Added indicator: {0}", sma.Name);
}
```

Python:

```python
smaType = api.AlgoRegistry.Get("Simple Moving Average", AlgoKind.StandardIndicator)
if smaType is not None:
    sma = api.ChartIndicators.Add(smaType, api.Bars.ClosePrices, 12)
    api.Print(f"Added indicator: {sma.Name}")
```

