---
id: "M:cAlgo.API.ChartArea.DrawArrow(System.String,System.DateTime,System.Double,System.DateTime,System.Double,cAlgo.API.Color)"
kind: "method"
type: "T:cAlgo.API.ChartArea"
url: "https://help.ctrader.com/ctrader-algo/references/Chart/ChartArea/DrawArrow/"
---

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

# ChartArea.DrawArrow

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

## DrawArrow(string name, DateTime time1, double y1, DateTime time2, double y2, Color color)

Draws an arrow.

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

- CLI: The object is created and returned, but never drawn: the CLI displays no chart.
- Cloud: The object is created and returned, but never drawn: the cloud displays no chart.

C#:

```csharp
ChartArrow DrawArrow(string name, DateTime time1, double y1, DateTime time2, double y2, Color color)
```

Python:

```python
chartArea.DrawArrow(name: str, time1: DateTime, y1: float, time2: DateTime, y2: float, color: Color) -> ChartArrow
```

### Parameters

- `name` (`string`, Python `str`): The chart object name - a unique name that can be only used once for a chart area. If duplicated, the chart object will be replaced with a new one of the same name.
- `time1` (`DateTime`, Python `DateTime`): The time value of the trend line start point location on the X-axis.
- `y1` (`double`, Python `float`): The Y-axis value of the trend line start location.
- `time2` (`DateTime`, Python `DateTime`): The time value of the trend line end point location on the X-axis.
- `y2` (`double`, Python `float`): The Y-axis value of the trend line end location.
- `color` (`Color`, Python `Color`): The color of the trend line.

### Returns

`ChartArrow` — 

### Examples

C#:

```csharp
var arrow = Chart.DrawArrow("arrow", Bars.OpenTimes.Last(20), Bars.LowPrices.Last(20), Bars.OpenTimes.LastValue, Bars.HighPrices.LastValue, Color.Red);
Print("Arrow drawn from {0} to {1}", arrow.Time1, arrow.Time2);
```

Python:

```python
arrow = api.Chart.DrawArrow("arrow", api.Bars.OpenTimes.Last(20), api.Bars.LowPrices.Last(20), api.Bars.OpenTimes.LastValue, api.Bars.HighPrices.LastValue, Color.Red)
api.Print(f"Arrow drawn from {arrow.Time1} to {arrow.Time2}")
```

## DrawArrow(string name, DateTime time1, double y1, DateTime time2, double y2, Color color, int thickness)

Draws an arrow.

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

- CLI: The object is created and returned, but never drawn: the CLI displays no chart.
- Cloud: The object is created and returned, but never drawn: the cloud displays no chart.

C#:

```csharp
ChartArrow DrawArrow(string name, DateTime time1, double y1, DateTime time2, double y2, Color color, int thickness)
```

Python:

```python
chartArea.DrawArrow(name: str, time1: DateTime, y1: float, time2: DateTime, y2: float, color: Color, thickness: int) -> ChartArrow
```

### Parameters

- `name` (`string`, Python `str`): The chart object name - a unique name that can be only used once for a chart area. If duplicated, the chart object will be replaced with a new one of the same name.
- `time1` (`DateTime`, Python `DateTime`): The time value of the trend line start point location on the X-axis.
- `y1` (`double`, Python `float`): The Y-axis value of the trend line start location.
- `time2` (`DateTime`, Python `DateTime`): The time value of the trend line end point location on the X-axis.
- `y2` (`double`, Python `float`): The Y-axis value of the trend line end location.
- `color` (`Color`, Python `Color`): The color of the trend line.
- `thickness` (`int`, Python `int`): The thickness of the trend line.

### Returns

`ChartArrow` — 

### Examples

C#:

```csharp
var arrow = Chart.DrawArrow("arrow", Bars.OpenTimes.Last(20), Bars.LowPrices.Last(20), Bars.OpenTimes.LastValue, Bars.HighPrices.LastValue, Color.Red, 2);
Print("Arrow thickness: {0}", arrow.Thickness);
```

Python:

```python
arrow = api.Chart.DrawArrow("arrow", api.Bars.OpenTimes.Last(20), api.Bars.LowPrices.Last(20), api.Bars.OpenTimes.LastValue, api.Bars.HighPrices.LastValue, Color.Red, 2)
api.Print(f"Arrow thickness: {arrow.Thickness}")
```

## DrawArrow(string name, DateTime time1, double y1, DateTime time2, double y2, Color color, int thickness, LineStyle lineStyle)

Draws an arrow.

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

- CLI: The object is created and returned, but never drawn: the CLI displays no chart.
- Cloud: The object is created and returned, but never drawn: the cloud displays no chart.

C#:

```csharp
ChartArrow DrawArrow(string name, DateTime time1, double y1, DateTime time2, double y2, Color color, int thickness, LineStyle lineStyle)
```

Python:

```python
chartArea.DrawArrow(name: str, time1: DateTime, y1: float, time2: DateTime, y2: float, color: Color, thickness: int, lineStyle: LineStyle) -> ChartArrow
```

### Parameters

- `name` (`string`, Python `str`): The chart object name - a unique name that can be only used once for a chart area. If duplicated, the chart object will be replaced with a new one of the same name.
- `time1` (`DateTime`, Python `DateTime`): The time value of the trend line start point location on the X-axis.
- `y1` (`double`, Python `float`): The Y-axis value of the trend line start location.
- `time2` (`DateTime`, Python `DateTime`): The time value of the trend line end point location on the X-axis.
- `y2` (`double`, Python `float`): The Y-axis value of the trend line end location.
- `color` (`Color`, Python `Color`): The color of the trend line.
- `thickness` (`int`, Python `int`): The thickness of the trend line.
- `lineStyle` (`LineStyle`, Python `LineStyle`): The trend line style.

### Returns

`ChartArrow` — 

### Examples

C#:

```csharp
var arrow = Chart.DrawArrow("arrow", Bars.OpenTimes.Last(20), Bars.LowPrices.Last(20), Bars.OpenTimes.LastValue, Bars.HighPrices.LastValue, Color.Red, 2, LineStyle.Dots);
Print("Arrow style: {0}", arrow.LineStyle);
```

Python:

```python
arrow = api.Chart.DrawArrow("arrow", api.Bars.OpenTimes.Last(20), api.Bars.LowPrices.Last(20), api.Bars.OpenTimes.LastValue, api.Bars.HighPrices.LastValue, Color.Red, 2, LineStyle.Dots)
api.Print(f"Arrow style: {arrow.LineStyle}")
```

## DrawArrow(string name, int barIndex1, double y1, int barIndex2, double y2, Color color)

Draws an arrow.

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

- CLI: The object is created and returned, but never drawn: the CLI displays no chart.
- Cloud: The object is created and returned, but never drawn: the cloud displays no chart.

C#:

```csharp
ChartArrow DrawArrow(string name, int barIndex1, double y1, int barIndex2, double y2, Color color)
```

Python:

```python
chartArea.DrawArrow(name: str, barIndex1: int, y1: float, barIndex2: int, y2: float, color: Color) -> ChartArrow
```

### Parameters

- `name` (`string`, Python `str`): The chart object name - a unique name that can be only used once for a chart area. If duplicated, the chart object will be replaced with a new one of the same name.
- `barIndex1` (`int`, Python `int`): The bar index of the trend line start point location on the X-axis.
- `y1` (`double`, Python `float`): The Y-axis value of the trend line start location.
- `barIndex2` (`int`, Python `int`): The bar index of the trend line end point location on the X-axis.
- `y2` (`double`, Python `float`): The Y-axis value of the trend line end location.
- `color` (`Color`, Python `Color`): The color of the trend line.

### Returns

`ChartArrow` — 

### Examples

C#:

```csharp
var index = Bars.Count - 1;
var arrow = Chart.DrawArrow("arrow", index - 20, Bars.LowPrices[index - 20], index, Bars.HighPrices[index], Color.Red);
Print("Arrow drawn from {0} to {1}", arrow.Time1, arrow.Time2);
```

Python:

```python
index = api.Bars.Count - 1
arrow = api.Chart.DrawArrow("arrow", index - 20, api.Bars.LowPrices[index - 20], index, api.Bars.HighPrices[index], Color.Red)
api.Print(f"Arrow drawn from {arrow.Time1} to {arrow.Time2}")
```

## DrawArrow(string name, int barIndex1, double y1, int barIndex2, double y2, Color color, int thickness)

Draws an arrow.

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

- CLI: The object is created and returned, but never drawn: the CLI displays no chart.
- Cloud: The object is created and returned, but never drawn: the cloud displays no chart.

C#:

```csharp
ChartArrow DrawArrow(string name, int barIndex1, double y1, int barIndex2, double y2, Color color, int thickness)
```

Python:

```python
chartArea.DrawArrow(name: str, barIndex1: int, y1: float, barIndex2: int, y2: float, color: Color, thickness: int) -> ChartArrow
```

### Parameters

- `name` (`string`, Python `str`): The chart object name - a unique name that can be only used once for a chart area. If duplicated, the chart object will be replaced with a new one of the same name.
- `barIndex1` (`int`, Python `int`): The bar index of the trend line start point location on the X-axis.
- `y1` (`double`, Python `float`): The Y-axis value of the trend line start location.
- `barIndex2` (`int`, Python `int`): The bar index of the trend line end point location on the X-axis.
- `y2` (`double`, Python `float`): The Y-axis value of the trend line end location.
- `color` (`Color`, Python `Color`): The color of the trend line.
- `thickness` (`int`, Python `int`): The thickness of the trend line.

### Returns

`ChartArrow` — 

### Examples

C#:

```csharp
var index = Bars.Count - 1;
var arrow = Chart.DrawArrow("arrow", index - 20, Bars.LowPrices[index - 20], index, Bars.HighPrices[index], Color.Red, 2);
Print("Arrow thickness: {0}", arrow.Thickness);
```

Python:

```python
index = api.Bars.Count - 1
arrow = api.Chart.DrawArrow("arrow", index - 20, api.Bars.LowPrices[index - 20], index, api.Bars.HighPrices[index], Color.Red, 2)
api.Print(f"Arrow thickness: {arrow.Thickness}")
```

## DrawArrow(string name, int barIndex1, double y1, int barIndex2, double y2, Color color, int thickness, LineStyle lineStyle)

Draws an arrow.

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

- CLI: The object is created and returned, but never drawn: the CLI displays no chart.
- Cloud: The object is created and returned, but never drawn: the cloud displays no chart.

C#:

```csharp
ChartArrow DrawArrow(string name, int barIndex1, double y1, int barIndex2, double y2, Color color, int thickness, LineStyle lineStyle)
```

Python:

```python
chartArea.DrawArrow(name: str, barIndex1: int, y1: float, barIndex2: int, y2: float, color: Color, thickness: int, lineStyle: LineStyle) -> ChartArrow
```

### Parameters

- `name` (`string`, Python `str`): The chart object name - a unique name that can be only used once for a chart area. If duplicated, the chart object will be replaced with a new one of the same name.
- `barIndex1` (`int`, Python `int`): The bar index of the trend line start point location on the X-axis.
- `y1` (`double`, Python `float`): The Y-axis value of the trend line start location.
- `barIndex2` (`int`, Python `int`): The bar index of the trend line end point location on the X-axis.
- `y2` (`double`, Python `float`): The Y-axis value of the trend line end location.
- `color` (`Color`, Python `Color`): The color of the trend line.
- `thickness` (`int`, Python `int`): The thickness of the trend line.
- `lineStyle` (`LineStyle`, Python `LineStyle`): The trend line style.

### Returns

`ChartArrow` — 

### Examples

C#:

```csharp
var index = Bars.Count - 1;
var arrow = Chart.DrawArrow("arrow", index - 20, Bars.LowPrices[index - 20], index, Bars.HighPrices[index], Color.Red, 2, LineStyle.Dots);
Print("Arrow style: {0}", arrow.LineStyle);
```

Python:

```python
index = api.Bars.Count - 1
arrow = api.Chart.DrawArrow("arrow", index - 20, api.Bars.LowPrices[index - 20], index, api.Bars.HighPrices[index], Color.Red, 2, LineStyle.Dots)
api.Print(f"Arrow style: {arrow.LineStyle}")
```

