ChartArea.DrawHorizontalLine
method · ChartArea · cAlgo.API
DesktopCLICloud
Draws a horizontal line.
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.
Overloads
DrawHorizontalLine(string name, double y, Color color)
Draws a horizontal line.
ChartHorizontalLine DrawHorizontalLine(string name, double y, Color color)
chartArea.DrawHorizontalLine(name: str, y: float, color: Color) -> ChartHorizontalLine
Parameters
| Name | C# type | Python type | Description |
|---|---|---|---|
name | string | str | The chart object name - a unique name that can be only used once on a chart area. If duplicated, the chart object will be replaced with a new one of the same name. |
y | double | float | The Y-axis value of the line location. |
color | Color | Color | The line color. |
Returns ChartHorizontalLine — ChartHorizontalLine.
Examples
var line = Chart.DrawHorizontalLine("support", Bars.LowPrices.Minimum(50), Color.Green);
Print("Support line drawn at {0}", line.Y);
line = api.Chart.DrawHorizontalLine("support", Functions.Minimum(api.Bars.LowPrices, 50), Color.Green)
api.Print(f"Support line drawn at {line.Y}")
DrawHorizontalLine(string name, double y, Color color, int thickness)
Draws a horizontal line.
ChartHorizontalLine DrawHorizontalLine(string name, double y, Color color, int thickness)
chartArea.DrawHorizontalLine(name: str, y: float, color: Color, thickness: int) -> ChartHorizontalLine
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. |
y | double | float | The Y-axis value of the line location. |
color | Color | Color | The line color. |
thickness | int | int | The line thickness. |
Returns ChartHorizontalLine — ChartHorizontalLine.
Examples
var line = Chart.DrawHorizontalLine("resistance", Bars.HighPrices.Maximum(50), Color.Red, 2);
Print("Resistance line drawn at {0} with thickness {1}", line.Y, line.Thickness);
line = api.Chart.DrawHorizontalLine("resistance", Functions.Maximum(api.Bars.HighPrices, 50), Color.Red, 2)
api.Print(f"Resistance line drawn at {line.Y} with thickness {line.Thickness}")
DrawHorizontalLine(string name, double y, Color color, int thickness, LineStyle lineStyle)
Draws a horizontal line.
ChartHorizontalLine DrawHorizontalLine(string name, double y, Color color, int thickness, LineStyle lineStyle)
chartArea.DrawHorizontalLine(name: str, y: float, color: Color, thickness: int, lineStyle: LineStyle) -> ChartHorizontalLine
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. |
y | double | float | The Y-axis value of the line location. |
color | Color | Color | The line color. |
thickness | int | int | The line thickness. |
lineStyle | LineStyle | LineStyle | The line style. |
Returns ChartHorizontalLine — ChartHorizontalLine.
Examples
var line = Chart.DrawHorizontalLine("target", Symbol.Bid + 50 * Symbol.PipSize, Color.Gold, 1, LineStyle.Dots);
Print("Target line drawn at {0} with style {1}", line.Y, line.LineStyle);
line = api.Chart.DrawHorizontalLine("target", api.Symbol.Bid + 50 * api.Symbol.PipSize, Color.Gold, 1, LineStyle.Dots)
api.Print(f"Target line drawn at {line.Y} with style {line.LineStyle}")