---
id: "T:cAlgo.API.VerticalAlignment"
kind: "enum"
namespace: "cAlgo.API"
url: "https://help.ctrader.com/ctrader-algo/references/Chart/VerticalAlignment/"
---

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

# VerticalAlignment (enum)

Describes vertical position related to an anchor point or a parent element.

Environments: Desktop supported · CLI supported · Cloud supported.

## Definition

```csharp
public enum VerticalAlignment
```

## Examples

C#:

```csharp
using cAlgo.API;

namespace cAlgo
{
    // This sample shows how to use the VerticalAlignment
    public partial class VerticalAlignmentSample : Indicator
    {
        protected override void Initialize()
        {
            var textBlock = new TextBlock
            {
                Text = string.Format("Alignment: {0}", VerticalAlignment),
                VerticalAlignment = VerticalAlignment,
                HorizontalAlignment = HorizontalAlignment.Center
            };

            Chart.AddControl(textBlock);
        }

        public override void Calculate(int index)
        {
        }
    }
}
```

Python:

```python
import clr
clr.AddReference("cAlgo.API")

from cAlgo.API import *

class Test():
    def initialize(self):
        textBlock = TextBlock()
        textBlock.Text = f"Alignment: {api.VerticalAlignment}"
        textBlock.VerticalAlignment = api.VerticalAlignment
        textBlock.HorizontalAlignment = HorizontalAlignment.Center

        api.Chart.AddControl(textBlock)
```

config.json:

```json
{
  "AccessRights": "None",
  "TimeZone": "UTC",
  "IsOverlay": true,
  "Parameters": [
    {
      "Name": "VerticalAlignment",
      "DisplayName": "Vertical Alignment",
      "Type": "Enum",
      "EnumTypeFullName": "cAlgo.API.VerticalAlignment",
      "DefaultValue": "Center"
    }
  ]
}
```

## Values

- `VerticalAlignment.Center` — Center vertical alignment.
- `VerticalAlignment.Top` — Top vertical alignment.
- `VerticalAlignment.Bottom` — Bottom vertical alignment.
- `VerticalAlignment.Stretch` — Stretch vertical alignment.

