---
id: "M:cAlgo.API.StandardIndicator.AddToChart"
kind: "method"
type: "T:cAlgo.API.StandardIndicator"
url: "https://help.ctrader.com/ctrader-algo/references/General/StandardIndicator/AddToChart/"
---

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

# StandardIndicator.AddToChart

Member of [StandardIndicator](https://help.ctrader.com/ctrader-algo/references/General/StandardIndicator/index.md).

## AddToChart()

Adds current indicator to chart if not added yet.

Environments: Desktop supported · CLI supported · Cloud supported.

C#:

```csharp
ChartIndicator AddToChart()
```

Python:

```python
standardIndicator.AddToChart() -> ChartIndicator
```

### Returns

`ChartIndicator` — Chart Indicator

### Examples

C#:

```csharp
var sma = Indicators.SimpleMovingAverage(Bars.ClosePrices, 20);
var chartIndicator = sma.AddToChart();
if (chartIndicator != null)
    Print("Added {0} to the chart", chartIndicator.Name);
```

Python:

```python
sma = api.Indicators.SimpleMovingAverage(api.Bars.ClosePrices, 20)
chartIndicator = sma.AddToChart()
if chartIndicator is not None:
    api.Print(f"Added {chartIndicator.Name} to the chart")
```

