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

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

# ChartText (interface)

Represents the Text chart object. Allows place the text anywhere on the chart, bound to the chart.

Environments: Desktop supported · CLI works differently · Cloud works differently.

- CLI: Created and kept with all its properties, but never drawn: the CLI displays no chart.
- Cloud: Created and kept with all its properties, but never drawn: the cloud displays no chart.

## Definition

```csharp
public interface ChartText
```

## Examples

C#:

```csharp
using cAlgo.API;

namespace cAlgo
{
    // This sample shows how to use Chart.DrawText method to draw text
    public partial class ChartTextSample : Indicator
    {
        protected override void Initialize()
        {
            for (int iBarIndex = Chart.FirstVisibleBarIndex; iBarIndex <= Chart.LastVisibleBarIndex; iBarIndex++)
            {
                string text;

                double y;

                Color color;

                if (Bars.ClosePrices[iBarIndex] > Bars.OpenPrices[iBarIndex])
                {
                    text = "U";
                    y = Bars.LowPrices[iBarIndex];
                    color = Color.Green;
                }
                else
                {
                    text = "D";
                    y = Bars.HighPrices[iBarIndex];
                    color = Color.Red;
                }

                Chart.DrawText("Text_" + iBarIndex, text, iBarIndex, y, color);
            }
        }

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

Python:

```python
for barIndex in range(api.Chart.FirstVisibleBarIndex, api.Chart.LastVisibleBarIndex + 1):
    if api.Bars.ClosePrices[barIndex] > api.Bars.OpenPrices[barIndex]:
        api.Chart.DrawText(f"Text_{barIndex}", "U", barIndex, api.Bars.LowPrices[barIndex], Color.Green)
    else:
        api.Chart.DrawText(f"Text_{barIndex}", "D", barIndex, api.Bars.HighPrices[barIndex], Color.Red)
```

config.json:

```json
{
  "AccessRights": "None",
  "TimeZone": "UTC",
  "IsOverlay": true
}
```

## Properties

- `double Angle {get; set;}` — Gets or sets the rotation angle of the text in degrees, measured clockwise around the text anchor point. The text can be fully rotated; any value is accepted and normalized to the 0 to 360 range. The default value is 0, which renders horizontal text. [details](https://help.ctrader.com/ctrader-algo/references/Chart/Drawings/ChartText/Angle/index.md)
- `Color Color {get; set;}` — Gets or sets the text color. [details](https://help.ctrader.com/ctrader-algo/references/Chart/Drawings/ChartText/Color/index.md)
- `string FontFamily {get; set;}` — Gets or sets the font style of the text. [details](https://help.ctrader.com/ctrader-algo/references/Chart/Drawings/ChartText/FontFamily/index.md)
- `double FontSize {get; set;}` — Gets or sets the font size of text [details](https://help.ctrader.com/ctrader-algo/references/Chart/Drawings/ChartText/FontSize/index.md)
- `HorizontalAlignment HorizontalAlignment {get; set;}` — Gets or sets the horizontal alignment of the text regarding the anchor point. [details](https://help.ctrader.com/ctrader-algo/references/Chart/Drawings/ChartText/HorizontalAlignment/index.md)
- `bool IsBold {get; set;}` — Gets or sets if the text is Bold or not [details](https://help.ctrader.com/ctrader-algo/references/Chart/Drawings/ChartText/IsBold/index.md)
- `bool IsItalic {get; set;}` — Gets or sets if the text is Italic or not [details](https://help.ctrader.com/ctrader-algo/references/Chart/Drawings/ChartText/IsItalic/index.md)
- `bool IsUnderlined {get; set;}` — Gets or sets if the text is Underlined or not [details](https://help.ctrader.com/ctrader-algo/references/Chart/Drawings/ChartText/IsUnderlined/index.md)
- `string Text {get; set;}` — Gets or sets the text content. [details](https://help.ctrader.com/ctrader-algo/references/Chart/Drawings/ChartText/Text/index.md)
- `DateTime Time {get; set;}` — Gets or sets the Time line value. [details](https://help.ctrader.com/ctrader-algo/references/Chart/Drawings/ChartText/Time/index.md)
- `VerticalAlignment VerticalAlignment {get; set;}` — Gets or sets the vertical alignment of the text regarding the anchor point. [details](https://help.ctrader.com/ctrader-algo/references/Chart/Drawings/ChartText/VerticalAlignment/index.md)
- `double Y {get; set;}` — Gets or sets the Y-axis value. [details](https://help.ctrader.com/ctrader-algo/references/Chart/Drawings/ChartText/Y/index.md)

## Inherited members

- `string Name {get;}` (from ChartObject) [details](https://help.ctrader.com/ctrader-algo/references/Chart/Drawings/ChartObject/Name/index.md)
- `string Comment {get; set;}` (from ChartObject) [details](https://help.ctrader.com/ctrader-algo/references/Chart/Drawings/ChartObject/Comment/index.md)
- `ChartObjectType ObjectType {get;}` (from ChartObject) [details](https://help.ctrader.com/ctrader-algo/references/Chart/Drawings/ChartObject/ObjectType/index.md)
- `bool IsInteractive {get; set;}` (from ChartObject) [details](https://help.ctrader.com/ctrader-algo/references/Chart/Drawings/ChartObject/IsInteractive/index.md)
- `bool IsLocked {get; set;}` (from ChartObject) [details](https://help.ctrader.com/ctrader-algo/references/Chart/Drawings/ChartObject/IsLocked/index.md)
- `bool IsHidden {get; set;}` (from ChartObject) [details](https://help.ctrader.com/ctrader-algo/references/Chart/Drawings/ChartObject/IsHidden/index.md)
- `int ZIndex {get; set;}` (from ChartObject) [details](https://help.ctrader.com/ctrader-algo/references/Chart/Drawings/ChartObject/ZIndex/index.md)
- `bool IsAlive {get;}` (from ChartObject) [details](https://help.ctrader.com/ctrader-algo/references/Chart/Drawings/ChartObject/IsAlive/index.md)

