Skip to content

ChartArea.DrawGannBox

method · ChartArea · cAlgo.API Since 5.7

DesktopCLICloud

Draws a Gann box.

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

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

Draws a Gann box.

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

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

Returns ChartGannBox — ChartGannBox.

Examples

var gannBox = Chart.DrawGannBox("gannBox", Bars.OpenTimes.Last(30), Bars.LowPrices.Last(30), Bars.OpenTimes.LastValue, Bars.HighPrices.LastValue, Color.Blue);
Print("Gann box levels: {0}", gannBox.GannLevels.Count);
gannBox = api.Chart.DrawGannBox("gannBox", api.Bars.OpenTimes.Last(30), api.Bars.LowPrices.Last(30), api.Bars.OpenTimes.LastValue, api.Bars.HighPrices.LastValue, Color.Blue)
api.Print(f"Gann box levels: {gannBox.GannLevels.Count}")

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

Draws a Gann box.

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

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

Returns ChartGannBox — ChartGannBox.

Examples

var gannBox = Chart.DrawGannBox("gannBox", Bars.OpenTimes.Last(30), Bars.LowPrices.Last(30), Bars.OpenTimes.LastValue, Bars.HighPrices.LastValue, Color.Blue, 2);
Print("Gann box thickness: {0}", gannBox.Thickness);
gannBox = api.Chart.DrawGannBox("gannBox", api.Bars.OpenTimes.Last(30), api.Bars.LowPrices.Last(30), api.Bars.OpenTimes.LastValue, api.Bars.HighPrices.LastValue, Color.Blue, 2)
api.Print(f"Gann box thickness: {gannBox.Thickness}")

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

Draws a Gann box.

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

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

Returns ChartGannBox — ChartGannBox.

Examples

var gannBox = Chart.DrawGannBox("gannBox", Bars.OpenTimes.Last(30), Bars.LowPrices.Last(30), Bars.OpenTimes.LastValue, Bars.HighPrices.LastValue, Color.Blue, 2, LineStyle.Dots);
Print("Gann box style: {0}", gannBox.LineStyle);
gannBox = api.Chart.DrawGannBox("gannBox", api.Bars.OpenTimes.Last(30), api.Bars.LowPrices.Last(30), api.Bars.OpenTimes.LastValue, api.Bars.HighPrices.LastValue, Color.Blue, 2, LineStyle.Dots)
api.Print(f"Gann box style: {gannBox.LineStyle}")

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

Draws a Gann box.

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

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

Returns ChartGannBox — ChartGannBox.

Examples

var index = Bars.Count - 1;
var gannBox = Chart.DrawGannBox("gannBox", index - 30, Bars.LowPrices[index - 30], index, Bars.HighPrices[index], Color.Blue);
Print("Gann box levels: {0}", gannBox.GannLevels.Count);
index = api.Bars.Count - 1
gannBox = api.Chart.DrawGannBox("gannBox", index - 30, api.Bars.LowPrices[index - 30], index, api.Bars.HighPrices[index], Color.Blue)
api.Print(f"Gann box levels: {gannBox.GannLevels.Count}")

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

Draws a Gann box.

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

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

Returns ChartGannBox — ChartGannBox.

Examples

var index = Bars.Count - 1;
var gannBox = Chart.DrawGannBox("gannBox", index - 30, Bars.LowPrices[index - 30], index, Bars.HighPrices[index], Color.Blue, 2);
Print("Gann box thickness: {0}", gannBox.Thickness);
index = api.Bars.Count - 1
gannBox = api.Chart.DrawGannBox("gannBox", index - 30, api.Bars.LowPrices[index - 30], index, api.Bars.HighPrices[index], Color.Blue, 2)
api.Print(f"Gann box thickness: {gannBox.Thickness}")

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

Draws a Gann box.

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

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

Returns ChartGannBox — ChartGannBox.

Examples

var index = Bars.Count - 1;
var gannBox = Chart.DrawGannBox("gannBox", index - 30, Bars.LowPrices[index - 30], index, Bars.HighPrices[index], Color.Blue, 2, LineStyle.Dots);
Print("Gann box style: {0}", gannBox.LineStyle);
index = api.Bars.Count - 1
gannBox = api.Chart.DrawGannBox("gannBox", index - 30, api.Bars.LowPrices[index - 30], index, api.Bars.HighPrices[index], Color.Blue, 2, LineStyle.Dots)
api.Print(f"Gann box style: {gannBox.LineStyle}")