Skip to content

ChartArea.DrawArrow

method · ChartArea · cAlgo.API

DesktopCLICloud

Draws an arrow.

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

DrawArrow(string name, DateTime time1, double y1, DateTime time2, double y2, Color color)

Draws an arrow.

ChartArrow DrawArrow(string name, DateTime time1, double y1, DateTime time2, double y2, Color color)
chartArea.DrawArrow(name: str, time1: DateTime, y1: float, time2: DateTime, y2: float, color: Color) -> ChartArrow

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.
time1 DateTime DateTime The time value of the trend line start point location on the X-axis.
y1 double float The Y-axis value of the trend line start location.
time2 DateTime DateTime The time value of the trend line end point location on the X-axis.
y2 double float The Y-axis value of the trend line end location.
color Color Color The color of the trend line.

Returns ChartArrow

Examples

var arrow = Chart.DrawArrow("arrow", Bars.OpenTimes.Last(20), Bars.LowPrices.Last(20), Bars.OpenTimes.LastValue, Bars.HighPrices.LastValue, Color.Red);
Print("Arrow drawn from {0} to {1}", arrow.Time1, arrow.Time2);
arrow = api.Chart.DrawArrow("arrow", api.Bars.OpenTimes.Last(20), api.Bars.LowPrices.Last(20), api.Bars.OpenTimes.LastValue, api.Bars.HighPrices.LastValue, Color.Red)
api.Print(f"Arrow drawn from {arrow.Time1} to {arrow.Time2}")

DrawArrow(string name, DateTime time1, double y1, DateTime time2, double y2, Color color, int thickness)

Draws an arrow.

ChartArrow DrawArrow(string name, DateTime time1, double y1, DateTime time2, double y2, Color color, int thickness)
chartArea.DrawArrow(name: str, time1: DateTime, y1: float, time2: DateTime, y2: float, color: Color, thickness: int) -> ChartArrow

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.
time1 DateTime DateTime The time value of the trend line start point location on the X-axis.
y1 double float The Y-axis value of the trend line start location.
time2 DateTime DateTime The time value of the trend line end point location on the X-axis.
y2 double float The Y-axis value of the trend line end location.
color Color Color The color of the trend line.
thickness int int The thickness of the trend line.

Returns ChartArrow

Examples

var arrow = Chart.DrawArrow("arrow", Bars.OpenTimes.Last(20), Bars.LowPrices.Last(20), Bars.OpenTimes.LastValue, Bars.HighPrices.LastValue, Color.Red, 2);
Print("Arrow thickness: {0}", arrow.Thickness);
arrow = api.Chart.DrawArrow("arrow", api.Bars.OpenTimes.Last(20), api.Bars.LowPrices.Last(20), api.Bars.OpenTimes.LastValue, api.Bars.HighPrices.LastValue, Color.Red, 2)
api.Print(f"Arrow thickness: {arrow.Thickness}")

DrawArrow(string name, DateTime time1, double y1, DateTime time2, double y2, Color color, int thickness, LineStyle lineStyle)

Draws an arrow.

ChartArrow DrawArrow(string name, DateTime time1, double y1, DateTime time2, double y2, Color color, int thickness, LineStyle lineStyle)
chartArea.DrawArrow(name: str, time1: DateTime, y1: float, time2: DateTime, y2: float, color: Color, thickness: int, lineStyle: LineStyle) -> ChartArrow

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.
time1 DateTime DateTime The time value of the trend line start point location on the X-axis.
y1 double float The Y-axis value of the trend line start location.
time2 DateTime DateTime The time value of the trend line end point location on the X-axis.
y2 double float The Y-axis value of the trend line end location.
color Color Color The color of the trend line.
thickness int int The thickness of the trend line.
lineStyle LineStyle LineStyle The trend line style.

Returns ChartArrow

Examples

var arrow = Chart.DrawArrow("arrow", Bars.OpenTimes.Last(20), Bars.LowPrices.Last(20), Bars.OpenTimes.LastValue, Bars.HighPrices.LastValue, Color.Red, 2, LineStyle.Dots);
Print("Arrow style: {0}", arrow.LineStyle);
arrow = api.Chart.DrawArrow("arrow", api.Bars.OpenTimes.Last(20), api.Bars.LowPrices.Last(20), api.Bars.OpenTimes.LastValue, api.Bars.HighPrices.LastValue, Color.Red, 2, LineStyle.Dots)
api.Print(f"Arrow style: {arrow.LineStyle}")

DrawArrow(string name, int barIndex1, double y1, int barIndex2, double y2, Color color)

Draws an arrow.

ChartArrow DrawArrow(string name, int barIndex1, double y1, int barIndex2, double y2, Color color)
chartArea.DrawArrow(name: str, barIndex1: int, y1: float, barIndex2: int, y2: float, color: Color) -> ChartArrow

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.
barIndex1 int int The bar index of the trend line start point location on the X-axis.
y1 double float The Y-axis value of the trend line start location.
barIndex2 int int The bar index of the trend line end point location on the X-axis.
y2 double float The Y-axis value of the trend line end location.
color Color Color The color of the trend line.

Returns ChartArrow

Examples

var index = Bars.Count - 1;
var arrow = Chart.DrawArrow("arrow", index - 20, Bars.LowPrices[index - 20], index, Bars.HighPrices[index], Color.Red);
Print("Arrow drawn from {0} to {1}", arrow.Time1, arrow.Time2);
index = api.Bars.Count - 1
arrow = api.Chart.DrawArrow("arrow", index - 20, api.Bars.LowPrices[index - 20], index, api.Bars.HighPrices[index], Color.Red)
api.Print(f"Arrow drawn from {arrow.Time1} to {arrow.Time2}")

DrawArrow(string name, int barIndex1, double y1, int barIndex2, double y2, Color color, int thickness)

Draws an arrow.

ChartArrow DrawArrow(string name, int barIndex1, double y1, int barIndex2, double y2, Color color, int thickness)
chartArea.DrawArrow(name: str, barIndex1: int, y1: float, barIndex2: int, y2: float, color: Color, thickness: int) -> ChartArrow

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.
barIndex1 int int The bar index of the trend line start point location on the X-axis.
y1 double float The Y-axis value of the trend line start location.
barIndex2 int int The bar index of the trend line end point location on the X-axis.
y2 double float The Y-axis value of the trend line end location.
color Color Color The color of the trend line.
thickness int int The thickness of the trend line.

Returns ChartArrow

Examples

var index = Bars.Count - 1;
var arrow = Chart.DrawArrow("arrow", index - 20, Bars.LowPrices[index - 20], index, Bars.HighPrices[index], Color.Red, 2);
Print("Arrow thickness: {0}", arrow.Thickness);
index = api.Bars.Count - 1
arrow = api.Chart.DrawArrow("arrow", index - 20, api.Bars.LowPrices[index - 20], index, api.Bars.HighPrices[index], Color.Red, 2)
api.Print(f"Arrow thickness: {arrow.Thickness}")

DrawArrow(string name, int barIndex1, double y1, int barIndex2, double y2, Color color, int thickness, LineStyle lineStyle)

Draws an arrow.

ChartArrow DrawArrow(string name, int barIndex1, double y1, int barIndex2, double y2, Color color, int thickness, LineStyle lineStyle)
chartArea.DrawArrow(name: str, barIndex1: int, y1: float, barIndex2: int, y2: float, color: Color, thickness: int, lineStyle: LineStyle) -> ChartArrow

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.
barIndex1 int int The bar index of the trend line start point location on the X-axis.
y1 double float The Y-axis value of the trend line start location.
barIndex2 int int The bar index of the trend line end point location on the X-axis.
y2 double float The Y-axis value of the trend line end location.
color Color Color The color of the trend line.
thickness int int The thickness of the trend line.
lineStyle LineStyle LineStyle The trend line style.

Returns ChartArrow

Examples

var index = Bars.Count - 1;
var arrow = Chart.DrawArrow("arrow", index - 20, Bars.LowPrices[index - 20], index, Bars.HighPrices[index], Color.Red, 2, LineStyle.Dots);
Print("Arrow style: {0}", arrow.LineStyle);
index = api.Bars.Count - 1
arrow = api.Chart.DrawArrow("arrow", index - 20, api.Bars.LowPrices[index - 20], index, api.Bars.HighPrices[index], Color.Red, 2, LineStyle.Dots)
api.Print(f"Arrow style: {arrow.LineStyle}")