---
id: "T:cAlgo.API.ChartTriangle"
kind: "interface"
namespace: "cAlgo.API"
url: "https://help.ctrader.com/ctrader-algo/references/Chart/Drawings/Shapes/ChartTriangle/"
---

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

# ChartTriangle (interface)

Represents the Triangle chart object.

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

- CLI: Created and kept with all its properties, but never drawn: the CLI displays no chart.
- Cloud: Created and kept with all its properties, but never drawn: the cloud displays no chart.

## Definition

```csharp
public interface ChartTriangle
```

## Examples

C#:

```csharp
using cAlgo.API;

namespace cAlgo
{
    // This sample shows how to draw a triangle on chart with Chart.DrawTriangle method
    public partial class ChartTriangleSample : Indicator
    {
        protected override void Initialize()
        {
            var x1 = Chart.FirstVisibleBarIndex;
            var x2 = Chart.FirstVisibleBarIndex + ((Chart.LastVisibleBarIndex - Chart.FirstVisibleBarIndex) / 2);
            var x3 = Chart.LastVisibleBarIndex;

            var y1 = Bars.LowPrices[x1];
            var y2 = Bars.LowPrices.Minimum(Chart.LastVisibleBarIndex - Chart.FirstVisibleBarIndex);
            var y3 = Bars.HighPrices[x3];

            var triangle = Chart.DrawTriangle("triangle_sample", x1, y1, x2, y2, x3, y3, Color.FromArgb(100, Color.Red), 2, LineStyle.Dots);

            triangle.IsInteractive = true;
            triangle.IsFilled = true;
        }

        public override void Calculate(int index)
        {
        }
    }
}
```

Python:

```python
import clr
clr.AddReference("cAlgo.API")

from cAlgo.API import *

class Test():
    def initialize(self):
        x1 = api.Chart.FirstVisibleBarIndex
        x2 = api.Chart.FirstVisibleBarIndex + ((api.Chart.LastVisibleBarIndex - api.Chart.FirstVisibleBarIndex) // 2)
        x3 = api.Chart.LastVisibleBarIndex

        y1 = api.Bars.LowPrices[x1]
        y2 = Functions.Minimum(api.Bars.LowPrices, api.Chart.LastVisibleBarIndex - api.Chart.FirstVisibleBarIndex)
        y3 = api.Bars.HighPrices[x3]

        triangle = api.Chart.DrawTriangle("triangle_sample", x1, y1, x2, y2, x3, y3, Color.FromArgb(100, Color.Red), 2, LineStyle.Dots)
        triangle.IsInteractive = True
        triangle.IsFilled = True
```

config.json:

```json
{
  "AccessRights": "None",
  "TimeZone": "UTC",
  "IsOverlay": true
}
```

## Properties

- `DateTime Time1 {get; set;}` — Gets or sets the value 1 on the Time line. [details](https://help.ctrader.com/ctrader-algo/references/Chart/Drawings/Shapes/ChartTriangle/Time1/index.md)
- `DateTime Time2 {get; set;}` — Gets or sets the value 2 on the Time line. [details](https://help.ctrader.com/ctrader-algo/references/Chart/Drawings/Shapes/ChartTriangle/Time2/index.md)
- `DateTime Time3 {get; set;}` — Gets or sets the value 3 on the Time line. [details](https://help.ctrader.com/ctrader-algo/references/Chart/Drawings/Shapes/ChartTriangle/Time3/index.md)
- `double Y1 {get; set;}` — Gets or sets the value 1 on the Y-axis. [details](https://help.ctrader.com/ctrader-algo/references/Chart/Drawings/Shapes/ChartTriangle/Y1/index.md)
- `double Y2 {get; set;}` — Gets or sets the value 2 on the Y-axis. [details](https://help.ctrader.com/ctrader-algo/references/Chart/Drawings/Shapes/ChartTriangle/Y2/index.md)
- `double Y3 {get; set;}` — Gets or sets the value 3 on the Y-axis. [details](https://help.ctrader.com/ctrader-algo/references/Chart/Drawings/Shapes/ChartTriangle/Y3/index.md)

## Inherited members

- `int Thickness {get; set;}` (from ChartShape) [details](https://help.ctrader.com/ctrader-algo/references/Chart/Drawings/Shapes/ChartShape/Thickness/index.md)
- `LineStyle LineStyle {get; set;}` (from ChartShape) [details](https://help.ctrader.com/ctrader-algo/references/Chart/Drawings/Shapes/ChartShape/LineStyle/index.md)
- `Color Color {get; set;}` (from ChartShape) [details](https://help.ctrader.com/ctrader-algo/references/Chart/Drawings/Shapes/ChartShape/Color/index.md)
- `bool IsFilled {get; set;}` (from ChartShape) [details](https://help.ctrader.com/ctrader-algo/references/Chart/Drawings/Shapes/ChartShape/IsFilled/index.md)
- `string Name {get;}` (from ChartObject) [details](https://help.ctrader.com/ctrader-algo/references/Chart/Drawings/ChartObject/Name/index.md)
- `string Comment {get; set;}` (from ChartObject) [details](https://help.ctrader.com/ctrader-algo/references/Chart/Drawings/ChartObject/Comment/index.md)
- `ChartObjectType ObjectType {get;}` (from ChartObject) [details](https://help.ctrader.com/ctrader-algo/references/Chart/Drawings/ChartObject/ObjectType/index.md)
- `bool IsInteractive {get; set;}` (from ChartObject) [details](https://help.ctrader.com/ctrader-algo/references/Chart/Drawings/ChartObject/IsInteractive/index.md)
- `bool IsLocked {get; set;}` (from ChartObject) [details](https://help.ctrader.com/ctrader-algo/references/Chart/Drawings/ChartObject/IsLocked/index.md)
- `bool IsHidden {get; set;}` (from ChartObject) [details](https://help.ctrader.com/ctrader-algo/references/Chart/Drawings/ChartObject/IsHidden/index.md)
- `int ZIndex {get; set;}` (from ChartObject) [details](https://help.ctrader.com/ctrader-algo/references/Chart/Drawings/ChartObject/ZIndex/index.md)
- `bool IsAlive {get;}` (from ChartObject) [details](https://help.ctrader.com/ctrader-algo/references/Chart/Drawings/ChartObject/IsAlive/index.md)

