Skip to content

ChartArea.DrawStaticText

method · ChartArea · cAlgo.API

DesktopCLICloud

Draws the static text.

Environment behaviour

CLI — works differently. The object is created and returned, but never drawn: the CLI displays no chart.

Cloud — works differently. The object is created and returned, but never drawn: the cloud displays no chart.

Definition

ChartStaticText DrawStaticText(string name, string text, VerticalAlignment verticalAlignment, HorizontalAlignment horizontalAlignment, Color color)
chartArea.DrawStaticText(name: str, text: str, verticalAlignment: VerticalAlignment, horizontalAlignment: HorizontalAlignment, color: Color) -> ChartStaticText

Parameters

Name C# type Python type Description
name string str The chart object name - a unique name that can be only used once for a chart area. If duplicated, the chart object will be replaced with a new one of the same name.
text string str The text content.
verticalAlignment VerticalAlignment VerticalAlignment The vertical alignment.
horizontalAlignment HorizontalAlignment HorizontalAlignment The horizontal alignment.
color Color Color The color of the text.

Returns ChartStaticText

Examples

var text = Chart.DrawStaticText("info", string.Format("{0} | Spread: {1} pips", SymbolName, Symbol.Spread / Symbol.PipSize), VerticalAlignment.Top, HorizontalAlignment.Right, Color.White);
Print("Static text: {0}", text.Text);
text = api.Chart.DrawStaticText("info", f"{api.SymbolName} | Spread: {api.Symbol.Spread / api.Symbol.PipSize} pips", VerticalAlignment.Top, HorizontalAlignment.Right, Color.White)
api.Print(f"Static text: {text.Text}")