---
id: "T:cAlgo.API.ChartDraggable"
kind: "interface"
namespace: "cAlgo.API"
url: "https://help.ctrader.com/ctrader-algo/references/Chart/Draggables/ChartDraggable/"
---

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

# ChartDraggable (interface)

Represents a draggable box that can host a control and shown over a chart.

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

- CLI: Never displayed: starts at X=0, Y=0; property changes are kept locally only and LocationChanged never fires.
- Cloud: Never displayed: starts at X=0, Y=0; property changes are kept locally only and LocationChanged never fires.

## Definition

```csharp
public interface ChartDraggable
```

Available since cAlgo.API 5.2.

## Examples

C#:

```csharp
public partial class TestExample : Robot
{
   private const string Label = "Draggable";

   protected override void OnStart()
   {
       var openPositionButton = new Button {Text = "Open Position"};

       openPositionButton.Click += _ => ExecuteMarketOrder(TradeType.Buy, SymbolName, Symbol.VolumeInUnitsMin, Label);

       var closePositionsButton = new Button {Text = "Close Position"};

       closePositionsButton.Click += _ => Positions.Find(Label)?.Close();

       var panel = new StackPanel {Orientation = Orientation.Vertical, BackgroundColor = Color.Red};

       panel.AddChild(openPositionButton);
       panel.AddChild(closePositionsButton);

       var draggable = Chart.Draggables.Add();

       draggable.ShowGrip = true;
       draggable.Child = panel;

       draggable.LocationChanged += args => Print($"Draggable Location Changed: {args.Draggable.X}, {args.Draggable.Y}");
   }
}
```

Python:

```python
import clr

clr.AddReference("cAlgo.API")

# Import cAlgo API types
from cAlgo.API import *

# Import trading wrapper functions
from robot_wrapper import *

class Test():
    Label = "Test"
    def on_start(self):
        openPositionButton = Button()
        openPositionButton.Text = "Open Position"
        openPositionButton.Click += lambda _ : api.ExecuteMarketOrder(TradeType.Buy, api.SymbolName, api.Symbol.VolumeInUnitsMin, self.Label)

        closePositionsButton = Button()
        closePositionsButton.Text = "Close Position"
        closePositionsButton.Click += lambda _ : api.Positions.Find(self.Label).Close()

        panel = StackPanel()
        panel.Orientation = Orientation.Vertical
        panel.BackgroundColor = Color.Red

        panel.AddChild(openPositionButton)
        panel.AddChild(closePositionsButton)

        draggable = api.Chart.Draggables.Add()
        draggable.ShowGrip = True
        draggable.Child = panel
        draggable.LocationChanged += lambda args : print(f"Draggable Location Changed: {args.Draggable.X}, {args.Draggable.Y}")
```

config.json:

```json
{
  "AccessRights": "None"
}
```

## Properties

- `ControlBase Child {get; set;}` — Get / set the content control inside the draggable. [details](https://help.ctrader.com/ctrader-algo/references/Chart/Draggables/ChartDraggable/Child/index.md)
- `string Id {get;}` — Get unique ID of the Draggable. [details](https://help.ctrader.com/ctrader-algo/references/Chart/Draggables/ChartDraggable/Id/index.md)
- `bool IsVisible {get; set;}` — Get / set visibility of draggable. [details](https://help.ctrader.com/ctrader-algo/references/Chart/Draggables/ChartDraggable/IsVisible/index.md)
- `bool ShowGrip {get; set;}` — Get / set move grip visibility (default: true). [details](https://help.ctrader.com/ctrader-algo/references/Chart/Draggables/ChartDraggable/ShowGrip/index.md)
- `double X {get; set;}` — Get / set X coordinate (default: 0). [details](https://help.ctrader.com/ctrader-algo/references/Chart/Draggables/ChartDraggable/X/index.md)
- `double Y {get; set;}` — Get / set Y coordinate (default: 0). [details](https://help.ctrader.com/ctrader-algo/references/Chart/Draggables/ChartDraggable/Y/index.md)

## Events

- `event Action<ChartDraggableLocationChangedEventArgs> LocationChanged;` — Occurs when the draggable's location is changed. [details](https://help.ctrader.com/ctrader-algo/references/Chart/Draggables/ChartDraggable/LocationChanged/index.md)

