---
id: "M:cAlgo.API.ChartArrow.CalculateY(System.Int32)"
kind: "method"
type: "T:cAlgo.API.ChartArrow"
url: "https://help.ctrader.com/ctrader-algo/references/Chart/Drawings/ChartArrow/CalculateY/"
---

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

# ChartArrow.CalculateY

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

## CalculateY(int barIndex)

Calculates Y-axis value corresponding the specified bar index.

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.

C#:

```csharp
double CalculateY(int barIndex)
```

Python:

```python
chartArrow.CalculateY(barIndex: int) -> float
```

### Parameters

- `barIndex` (`int`, Python `int`): Index of the bar.

### Returns

`double` — System.Double.

### Examples

C#:

```csharp
var arrow = Chart.DrawArrow("arrow", Bars.OpenTimes.Last(20), Bars.LowPrices.Last(20), Bars.OpenTimes.Last(10), Bars.HighPrices.Last(10), Color.Red);
arrow.ExtendToInfinity = true;
Print("Arrow value at the last bar: {0}", arrow.CalculateY(Bars.Count - 1));
```

Python:

```python
arrow = api.Chart.DrawArrow("arrow", api.Bars.OpenTimes.Last(20), api.Bars.LowPrices.Last(20), api.Bars.OpenTimes.Last(10), api.Bars.HighPrices.Last(10), Color.Red)
arrow.ExtendToInfinity = True
api.Print(f"Arrow value at the last bar: {arrow.CalculateY(api.Bars.Count - 1)}")
```

## CalculateY(DateTime time)

Calculates Y-axis value corresponding the specified time value.

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.

C#:

```csharp
double CalculateY(DateTime time)
```

Python:

```python
chartArrow.CalculateY(time: DateTime) -> float
```

### Parameters

- `time` (`DateTime`, Python `DateTime`): The time.

### Returns

`double` — System.Double.

### Examples

C#:

```csharp
var arrow = Chart.DrawArrow("arrow", Bars.OpenTimes.Last(20), Bars.LowPrices.Last(20), Bars.OpenTimes.Last(10), Bars.HighPrices.Last(10), Color.Red);
arrow.ExtendToInfinity = true;
Print("Arrow value at {0}: {1}", Bars.OpenTimes.LastValue, arrow.CalculateY(Bars.OpenTimes.LastValue));
```

Python:

```python
arrow = api.Chart.DrawArrow("arrow", api.Bars.OpenTimes.Last(20), api.Bars.LowPrices.Last(20), api.Bars.OpenTimes.Last(10), api.Bars.HighPrices.Last(10), Color.Red)
arrow.ExtendToInfinity = True
api.Print(f"Arrow value at {api.Bars.OpenTimes.LastValue}: {arrow.CalculateY(api.Bars.OpenTimes.LastValue)}")
```

