---
id: "M:cAlgo.API.ChartTemplates.Create(System.String,cAlgo.API.Chart)"
kind: "method"
type: "T:cAlgo.API.ChartTemplates"
url: "https://help.ctrader.com/ctrader-algo/references/Chart/Templates/ChartTemplates/Create/"
---

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

# ChartTemplates.Create

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

## Create(string chartTemplateName, Chart chart)

Creates a new chart template based on a chart.

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

- CLI: No templates are listed; Create works for this run only and is not saved; Remove returns false; DefaultTemplate throws NullReferenceException.
- Cloud: Empty: Get returns null, Contains and Remove return false, Create and Duplicate throw, DefaultTemplate throws NullReferenceException.

C#:

```csharp
ChartTemplate Create(string chartTemplateName, Chart chart)
```

Python:

```python
api.ChartTemplates.Create(chartTemplateName: str, chart: Chart) -> ChartTemplate
```

### Parameters

- `chartTemplateName` (`string`, Python `str`): Unique name of new chart template
- `chart` (`Chart`, Python `Chart`): Chart that will be used for creation of chart template.

### Returns

`ChartTemplate` — ChartTemplate

Available since cAlgo.API 5.6.

### Examples

C#:

```csharp
var template = ChartTemplates.Create("EURUSD Daily Setup", Chart);
Print("Created template {0} with {1} indicators", template.Name, template.Indicators.Count);
```

Python:

```python
template = api.ChartTemplates.Create("EURUSD Daily Setup", api.Chart)
api.Print(f"Created template {template.Name} with {template.Indicators.Count} indicators")
```

## Create(string chartTemplateName)

Creates a new chart template.

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

- CLI: No templates are listed; Create works for this run only and is not saved; Remove returns false; DefaultTemplate throws NullReferenceException.
- Cloud: Empty: Get returns null, Contains and Remove return false, Create and Duplicate throw, DefaultTemplate throws NullReferenceException.

C#:

```csharp
ChartTemplate Create(string chartTemplateName)
```

Python:

```python
api.ChartTemplates.Create(chartTemplateName: str) -> ChartTemplate
```

### Parameters

- `chartTemplateName` (`string`, Python `str`): Unique name of new chart template

### Returns

`ChartTemplate` — ChartTemplate

Available since cAlgo.API 5.6.

### Examples

C#:

```csharp
if (!ChartTemplates.Contains("Clean Chart"))
{
    var template = ChartTemplates.Create("Clean Chart");
    template.DisplaySettings.Grid = false;
    Print("Created empty template {0}", template.Name);
}
```

Python:

```python
if not api.ChartTemplates.Contains("Clean Chart"):
    template = api.ChartTemplates.Create("Clean Chart")
    template.DisplaySettings.Grid = False
    api.Print(f"Created empty template {template.Name}")
```

