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

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

# ChartHorizontalLine (interface)

Represents the Horizontal Line chart object. Used to mark a certain value on the Y-axis throughout the whole chart.

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

## Examples

C#:

```csharp
using cAlgo.API;

namespace cAlgo
{
    // This sample indicator shows how to use Chart.DrawHorizontalLine method to draw an horizontal line
    public partial class HorizontalLineSample : Indicator
    {
        protected override void Initialize()
        {
            Chart.DrawHorizontalLine("horizontalLine", Bars.ClosePrices.LastValue, 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):
        api.Chart.DrawHorizontalLine("horizontalLine", api.Bars.ClosePrices.LastValue, Color.Red)
```

config.json:

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

## Properties

- `Color Color {get; set;}` — Gets or sets the line color. [details](https://help.ctrader.com/ctrader-algo/references/Chart/Drawings/ChartHorizontalLine/Color/index.md)
- `LineStyle LineStyle {get; set;}` — Gets or sets the line style. [details](https://help.ctrader.com/ctrader-algo/references/Chart/Drawings/ChartHorizontalLine/LineStyle/index.md)
- `int Thickness {get; set;}` — Gets or sets the line thickness. [details](https://help.ctrader.com/ctrader-algo/references/Chart/Drawings/ChartHorizontalLine/Thickness/index.md)
- `double Y {get; set;}` — Gets or sets the Y-axis value of the line location. [details](https://help.ctrader.com/ctrader-algo/references/Chart/Drawings/ChartHorizontalLine/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)

