ChartTemplates.Create
method · ChartTemplates · cAlgo.API Since 5.6
DesktopCLICloud
Creates a new chart template based on a chart.
Environment behaviour
CLI — works differently. No templates are listed; Create works for this run only and is not saved; Remove returns false; DefaultTemplate throws NullReferenceException.
Cloud — not supported. Empty: Get returns null, Contains and Remove return false, Create and Duplicate throw, DefaultTemplate throws NullReferenceException.
Overloads
| Signature | Description |
|---|---|
Create(string chartTemplateName, Chart chart) | Creates a new chart template based on a chart. |
Create(string chartTemplateName) | Creates a new chart template. |
Create(string chartTemplateName, Chart chart)
Creates a new chart template based on a chart.
ChartTemplate Create(string chartTemplateName, Chart chart)
api.ChartTemplates.Create(chartTemplateName: str, chart: Chart) -> ChartTemplate
Parameters
| Name | C# type | Python type | Description |
|---|---|---|---|
chartTemplateName | string | str | Unique name of new chart template |
chart | Chart | Chart | Chart that will be used for creation of chart template. |
Returns ChartTemplate — ChartTemplate
Examples
var template = ChartTemplates.Create("EURUSD Daily Setup", Chart);
Print("Created template {0} with {1} indicators", template.Name, template.Indicators.Count);
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.
ChartTemplate Create(string chartTemplateName)
api.ChartTemplates.Create(chartTemplateName: str) -> ChartTemplate
Parameters
| Name | C# type | Python type | Description |
|---|---|---|---|
chartTemplateName | string | str | Unique name of new chart template |
Returns ChartTemplate — ChartTemplate
Examples
if (!ChartTemplates.Contains("Clean Chart"))
{
var template = ChartTemplates.Create("Clean Chart");
template.DisplaySettings.Grid = false;
Print("Created empty template {0}", template.Name);
}
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}")