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

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

# ChartArea.BarIndexToX

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

## BarIndexToX(double barIndex)

Converts Bar Index to X coordinate.

Environments: Desktop supported · CLI not supported · Cloud not supported.

- CLI: Always returns 0; no conversion is done.
- Cloud: Always returns 0; no conversion is done.

C#:

```csharp
double BarIndexToX(double barIndex)
```

Python:

```python
chartArea.BarIndexToX(barIndex: float) -> float
```

### Parameters

- `barIndex` (`double`, Python `float`): Bar Index

### Returns

`double` — X Coordinate

### Examples

C#:

```csharp
var x = Chart.BarIndexToX(Chart.LastVisibleBarIndex);
Print("Last visible bar is at X: {0}", x);
```

Python:

```python
x = api.Chart.BarIndexToX(api.Chart.LastVisibleBarIndex)
api.Print(f"Last visible bar is at X: {x}")
```

