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

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

# ChartArea.MoveControl

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

## MoveControl(ControlBase control, int barIndex, double y)

Moves a chart control to chart / indicator area on absolute bar index and price (x,y) coordinates.

Environments: Desktop supported · CLI supported · Cloud supported.

C#:

```csharp
void MoveControl(ControlBase control, int barIndex, double y)
```

Python:

```python
chartArea.MoveControl(control: ControlBase, barIndex: int, y: float) -> None
```

### Parameters

- `control` (`ControlBase`, Python `ControlBase`): The control that will be added
- `barIndex` (`int`, Python `int`): Bar Index
- `y` (`double`, Python `float`): Price

### Examples

C#:

```csharp
var label = new TextBlock { Text = "High", ForegroundColor = Color.Yellow };
Chart.AddControl(label, Bars.Count - 2, Bars.HighPrices.Last(1));
Chart.MoveControl(label, Bars.Count - 1, Bars.HighPrices.LastValue);
```

Python:

```python
label = TextBlock()
label.Text = "High"
api.Chart.AddControl(label, api.Bars.Count - 2, api.Bars.HighPrices.Last(1))
api.Chart.MoveControl(label, api.Bars.Count - 1, api.Bars.HighPrices.LastValue)
```

## MoveControl(ControlBase control, DateTime time, double y)

Moves a chart control to chart / indicator area on absolute time and price (x,y) coordinates.

Environments: Desktop supported · CLI supported · Cloud supported.

C#:

```csharp
void MoveControl(ControlBase control, DateTime time, double y)
```

Python:

```python
chartArea.MoveControl(control: ControlBase, time: DateTime, y: float) -> None
```

### Parameters

- `control` (`ControlBase`, Python `ControlBase`): The control that will be added
- `time` (`DateTime`, Python `DateTime`): Time
- `y` (`double`, Python `float`): Price

### Examples

C#:

```csharp
var label = new TextBlock { Text = "Close", ForegroundColor = Color.White };
Chart.AddControl(label, Bars.OpenTimes.Last(1), Bars.ClosePrices.Last(1));
Chart.MoveControl(label, Bars.OpenTimes.LastValue, Bars.ClosePrices.LastValue);
```

Python:

```python
label = TextBlock()
label.Text = "Close"
api.Chart.AddControl(label, api.Bars.OpenTimes.Last(1), api.Bars.ClosePrices.Last(1))
api.Chart.MoveControl(label, api.Bars.OpenTimes.LastValue, api.Bars.ClosePrices.LastValue)
```

## MoveControl(ControlBase control, DateTime time)

Moves a chart control to chart / indicator area on absolute time (x) coordinate.

Environments: Desktop supported · CLI supported · Cloud supported.

C#:

```csharp
void MoveControl(ControlBase control, DateTime time)
```

Python:

```python
chartArea.MoveControl(control: ControlBase, time: DateTime) -> None
```

### Parameters

- `control` (`ControlBase`, Python `ControlBase`): The control that will be added
- `time` (`DateTime`, Python `DateTime`): Time

### Examples

C#:

```csharp
var label = new TextBlock { Text = "Now", VerticalAlignment = VerticalAlignment.Top };
Chart.AddControl(label, Bars.OpenTimes.Last(1));
Chart.MoveControl(label, Bars.OpenTimes.LastValue);
```

Python:

```python
label = TextBlock()
label.Text = "Now"
api.Chart.AddControl(label, api.Bars.OpenTimes.Last(1))
api.Chart.MoveControl(label, api.Bars.OpenTimes.LastValue)
```

## MoveControl(ControlBase control, int barIndex)

Moves a chart control to chart / indicator area on absolute bar index (x) coordinate.

Environments: Desktop supported · CLI supported · Cloud supported.

C#:

```csharp
void MoveControl(ControlBase control, int barIndex)
```

Python:

```python
chartArea.MoveControl(control: ControlBase, barIndex: int) -> None
```

### Parameters

- `control` (`ControlBase`, Python `ControlBase`): The control that will be added
- `barIndex` (`int`, Python `int`): Bar Index

### Examples

C#:

```csharp
var label = new TextBlock { Text = "Last bar", VerticalAlignment = VerticalAlignment.Bottom };
Chart.AddControl(label, Bars.Count - 2);
Chart.MoveControl(label, Bars.Count - 1);
```

Python:

```python
label = TextBlock()
label.Text = "Last bar"
api.Chart.AddControl(label, api.Bars.Count - 2)
api.Chart.MoveControl(label, api.Bars.Count - 1)
```

## MoveControl(ControlBase control, double y)

Moves a chart control to chart / indicator area on absolute price (y) coordinate.

Environments: Desktop supported · CLI supported · Cloud supported.

C#:

```csharp
void MoveControl(ControlBase control, double y)
```

Python:

```python
chartArea.MoveControl(control: ControlBase, y: float) -> None
```

### Parameters

- `control` (`ControlBase`, Python `ControlBase`): The control that will be added
- `y` (`double`, Python `float`): Price

### Examples

C#:

```csharp
var label = new TextBlock { Text = "Bid", HorizontalAlignment = HorizontalAlignment.Right };
Chart.AddControl(label, Symbol.Bid);
Chart.MoveControl(label, Symbol.Ask);
```

Python:

```python
label = TextBlock()
label.Text = "Bid"
api.Chart.AddControl(label, api.Symbol.Bid)
api.Chart.MoveControl(label, api.Symbol.Ask)
```

