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

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

# ChartTemplates.Duplicate

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

## Duplicate(string chartTemplateName, ChartTemplate chartTemplate)

Duplicates or creates a copy of an existing 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 Duplicate(string chartTemplateName, ChartTemplate chartTemplate)
```

Python:

```python
api.ChartTemplates.Duplicate(chartTemplateName: str, chartTemplate: ChartTemplate) -> ChartTemplate
```

### Parameters

- `chartTemplateName` (`string`, Python `str`): New chart template name.
- `chartTemplate` (`ChartTemplate`, Python `ChartTemplate`): Existing chart template.

### Returns

`ChartTemplate` — ChartTemplate

Available since cAlgo.API 5.6.

### Examples

C#:

```csharp
var copy = ChartTemplates.Duplicate("Default Copy", ChartTemplates.DefaultTemplate);
Print("Duplicated template: {0}", copy.Name);
```

Python:

```python
copy = api.ChartTemplates.Duplicate("Default Copy", api.ChartTemplates.DefaultTemplate)
api.Print(f"Duplicated template: {copy.Name}")
```

