Summary
Represents the Text chart object. Allows place the text anywhere on the chart, bound to the chart.
Syntax
public interface ChartText : ChartObject
Members
Name | Type | Summary |
---|---|---|
Color | Property | Gets or sets the text color. |
FontSize | Property | |
HorizontalAlignment | Property | Gets or sets the horizontal alignment of the text regarding the anchor point. |
IsBold | Property | |
IsItalic | Property | |
IsUnderlined | Property | |
Text | Property | Gets or sets the text content. |
Time | Property | Gets or sets the Time line value. |
VerticalAlignment | Property | Gets or sets the vertical alignment of the text regarding the anchor point. |
Y | Property | Gets or sets the Y-axis value. |
Example 1
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) { } } }