Skip to content

ChartText

Summary

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

Signature

1
public abstract interface ChartText

Namespace

cAlgo.API

Properties

Name Description
Time { get; set; } Gets or sets the Time line value.
Y { get; set; } Gets or sets the Y-axis value.
Color { get; set; } Gets or sets the text color.
Text { get; set; } Gets or sets the text content.
FontSize { get; set; } Gets or sets the font size of text
IsBold { get; set; } Gets or sets if the text is Bold or not
IsItalic { get; set; } Gets or sets if the text is Italic or not
IsUnderlined { get; set; } Gets or sets if the text is Underlined or not
VerticalAlignment { get; set; } Gets or sets the vertical alignment of the text regarding the anchor point.
HorizontalAlignment { get; set; } Gets or sets the horizontal alignment of the text regarding the anchor point.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
 using cAlgo.API;
 namespace cAlgo
 {
     // This sample shows how to use Chart.DrawText method to draw text
     [Indicator(IsOverlay = true, TimeZone = TimeZones.UTC, AccessRights = AccessRights.None)]
     public 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)
         {
         }
     }
 }

See Also


Last update: September 26, 2022

Comments