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

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

# ChartEquidistantChannel.CalculateY

Member of [ChartEquidistantChannel](https://help.ctrader.com/ctrader-algo/references/Chart/Drawings/ChartEquidistantChannel/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
chartEquidistantChannel.CalculateY(barIndex: int) -> float
```

### Parameters

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

### Returns

`double` — Y-axis value

Available since cAlgo.API 5.8.

### Examples

C#:

```csharp
var channel = Chart.DrawEquidistantChannel("channel", Bars.OpenTimes.Last(30), Bars.LowPrices.Last(30), Bars.OpenTimes.Last(10), Bars.LowPrices.Last(10), 20 * Symbol.PipSize, Color.Red);
channel.ExtendToInfinity = true;
Print("Channel base line at the last bar: {0}", channel.CalculateY(Bars.Count - 1));
```

Python:

```python
channel = api.Chart.DrawEquidistantChannel("channel", api.Bars.OpenTimes.Last(30), api.Bars.LowPrices.Last(30), api.Bars.OpenTimes.Last(10), api.Bars.LowPrices.Last(10), 20 * api.Symbol.PipSize, Color.Red)
channel.ExtendToInfinity = True
api.Print(f"Channel base line at the last bar: {channel.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
chartEquidistantChannel.CalculateY(time: DateTime) -> float
```

### Parameters

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

### Returns

`double` — Y-axis value

Available since cAlgo.API 5.8.

### Examples

C#:

```csharp
var channel = Chart.DrawEquidistantChannel("channel", Bars.OpenTimes.Last(30), Bars.LowPrices.Last(30), Bars.OpenTimes.Last(10), Bars.LowPrices.Last(10), 20 * Symbol.PipSize, Color.Red);
channel.ExtendToInfinity = true;
var baseLine = channel.CalculateY(Bars.OpenTimes.LastValue);
Print("Channel base line: {0} | Upper line: {1}", baseLine, baseLine + channel.ChannelHeight);
```

Python:

```python
channel = api.Chart.DrawEquidistantChannel("channel", api.Bars.OpenTimes.Last(30), api.Bars.LowPrices.Last(30), api.Bars.OpenTimes.Last(10), api.Bars.LowPrices.Last(10), 20 * api.Symbol.PipSize, Color.Red)
channel.ExtendToInfinity = True
baseLine = channel.CalculateY(api.Bars.OpenTimes.LastValue)
api.Print(f"Channel base line: {baseLine} | Upper line: {baseLine + channel.ChannelHeight}")
```

