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

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

# ChartIcon (interface)

Represents the Icon 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 ChartIcon
```

## Examples

C#:

```csharp
using cAlgo.API;

namespace cAlgo
{
    // This sample indicator shows how to use Chart.DrawIcon method to draw icons
    public partial class ChartIconSample : Indicator
    {
        protected override void Initialize()
        {
            for (int i = Chart.FirstVisibleBarIndex; i <= Chart.LastVisibleBarIndex; i++)
            {
                var iconName = string.Format("Icon_{0}", i);

                if (Bars.ClosePrices[i] > Bars.OpenPrices[i])
                {
                    Chart.DrawIcon(iconName, ChartIconType.UpArrow, i, Bars.LowPrices[i], Color.Green);
                }
                else
                {
                    Chart.DrawIcon(iconName, ChartIconType.DownArrow, i, Bars.HighPrices[i], Color.Red);
                }
            }
        }

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

Python:

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

from cAlgo.API import *

class Test():
    def initialize(self):
        for i in range(api.Chart.FirstVisibleBarIndex, api.Chart.LastVisibleBarIndex):
            iconName = f"Icon_{i}"
            if api.Bars.ClosePrices[i] > api.Bars.OpenPrices[i]:
                api.Chart.DrawIcon(iconName, ChartIconType.UpArrow, i, api.Bars.LowPrices[i], Color.Green)
            else:
                api.Chart.DrawIcon(iconName, ChartIconType.DownArrow, i, api.Bars.HighPrices[i], Color.Red)
```

config.json:

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

## Properties

- `Color Color {get; set;}` — Gets or sets the color of the icon. [details](https://help.ctrader.com/ctrader-algo/references/Chart/Drawings/ChartIcon/Color/index.md)
- `ChartIconType IconType {get; set;}` — Gets or sets the type of the icon. [details](https://help.ctrader.com/ctrader-algo/references/Chart/Drawings/ChartIcon/IconType/index.md)
- `DateTime Time {get; set;}` — Gets or sets the Time value of the icon location. [details](https://help.ctrader.com/ctrader-algo/references/Chart/Drawings/ChartIcon/Time/index.md)
- `double Y {get; set;}` — Gets or sets the Y-axis value of the icon location. [details](https://help.ctrader.com/ctrader-algo/references/Chart/Drawings/ChartIcon/Y/index.md)

## Inherited members

- `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)

