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

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

# Orientation (enum)

Defines the different orientations that panel layout can have.

Environments: Desktop supported · CLI supported · Cloud supported.

## Definition

```csharp
public enum Orientation
```

## Examples

C#:

```csharp
using cAlgo.API;

namespace cAlgo
{
    // This sample indicator shows how to set stack and wrap panels orientation
    public partial class OrientationSample : Indicator
    {
        protected override void Initialize()
        {
            var stackPanel = new StackPanel
            {
                Orientation = Orientation,
                HorizontalAlignment = HorizontalAlignment.Center,
                VerticalAlignment = VerticalAlignment.Center,
                BackgroundColor = Color.Gold,
                Opacity = 0.7,
            };

            stackPanel.AddChild(new TextBlock { Text = "First TextBlock", FontWeight = FontWeight.ExtraBold, Margin = 5, ForegroundColor = Color.Black });
            stackPanel.AddChild(new TextBlock { Text = "Second TextBlock", FontWeight = FontWeight.ExtraBold, Margin = 5, ForegroundColor = Color.Black });
            stackPanel.AddChild(new TextBlock { Text = "Third TextBlock", FontWeight = FontWeight.ExtraBold, Margin = 5, ForegroundColor = Color.Black });
            stackPanel.AddChild(new TextBlock { Text = "Fourth TextBlock", FontWeight = FontWeight.ExtraBold, Margin = 5, ForegroundColor = Color.Black });

            Chart.AddControl(stackPanel);
        }

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

Python:

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

from cAlgo.API import *

class Test():
    def get_text_block(self, text):
        textBlock = TextBlock()
        textBlock.Text = text
        textBlock.FontWeight = FontWeight.ExtraBold
        textBlock.ForegroundColor = Color.Black
        textBlock.Margin = Thickness(5)
        return textBlock

    def initialize(self):
        stackPanel = StackPanel()
        stackPanel.Orientation = api.Orientation
        stackPanel.HorizontalAlignment = HorizontalAlignment.Center
        stackPanel.VerticalAlignment = VerticalAlignment.Center
        stackPanel.BackgroundColor = Color.Gold
        stackPanel.Opacity = 0.7

        stackPanel.AddChild(self.get_text_block("First TextBlock"))
        stackPanel.AddChild(self.get_text_block("Second TextBlock"))
        stackPanel.AddChild(self.get_text_block("Third TextBlock"))
        stackPanel.AddChild(self.get_text_block("Fourth TextBlock"))

        api.Chart.AddControl(stackPanel)
```

config.json:

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

## Values

- `Orientation.Horizontal` — Elements in the panel layout should be horizontally oriented.
- `Orientation.Vertical` — Elements in the panel layout should be vertically oriented.

