Skip to content

ChartArea.DrawGannSquare

method · ChartArea · cAlgo.API Since 5.7

DesktopCLICloud

Draws a Gann square.

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

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

Draws a Gann square.

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

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

Returns ChartGannSquare — ChartGannSquare.

Examples

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

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

Draws a Gann square.

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

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

Returns ChartGannSquare — ChartGannSquare.

Examples

var gannSquare = Chart.DrawGannSquare("gannSquare", Bars.OpenTimes.Last(30), Bars.LowPrices.Last(30), Bars.OpenTimes.LastValue, Bars.HighPrices.LastValue, Color.Blue, 2);
Print("Gann square thickness: {0}", gannSquare.Thickness);
gannSquare = api.Chart.DrawGannSquare("gannSquare", 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 square thickness: {gannSquare.Thickness}")

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

Draws a Gann square.

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

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

Returns ChartGannSquare — ChartGannSquare.

Examples

var gannSquare = Chart.DrawGannSquare("gannSquare", Bars.OpenTimes.Last(30), Bars.LowPrices.Last(30), Bars.OpenTimes.LastValue, Bars.HighPrices.LastValue, Color.Blue, 2, LineStyle.Dots);
Print("Gann square style: {0}", gannSquare.LineStyle);
gannSquare = api.Chart.DrawGannSquare("gannSquare", 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 square style: {gannSquare.LineStyle}")

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

Draws a Gann square.

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

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

Returns ChartGannSquare — ChartGannSquare.

Examples

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

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

Draws a Gann square.

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

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

Returns ChartGannSquare — ChartGannSquare.

Examples

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

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

Draws a Gann square.

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

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

Returns ChartGannSquare — ChartGannSquare.

Examples

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