gannSquare
The Gann Square is a powerful tool that aligns time and price into a 1:1 square grid. By placing it between two anchor points, you can study how markets often balance when time and price move in harmony. Traders use it to project likely support/resistance levels and turning points in both horizontal (time) and vertical (price) dimensions.
Syntax
gannSquare(originPoint, targetPoint, styles?)
Parameters
originPoint (PricedData) · The first anchor (time & price) where the square begins.
targetPoint (PricedData) · The second anchor (time & price) that defines the opposite corner, setting the square size.
styles (GannSquareStyleOverrides) · Style configuration to customize look and levels:
color(RGBAColor | BaseColors): base color used for the Gann Square lines.fans(Omit<Levels, 'coeff'>): configuration for fan levels without coefficients.fillHorzBackground(boolean): fill the horizontal background areas.fillVertBackground(boolean): fill the vertical background areas.hlevel1–hlevel6(Levels): individual horizontal level configuration.horzTransparency(number): transparency applied to horizontal elements.linestyle(number): line style identifier.linewidth(number): thickness of the lines.reverse(boolean): reverse the Gann Square direction.showBottomLabels(boolean): show labels on the bottom side.showLeftLabels(boolean): show labels on the left side.showRightLabels(boolean): show labels on the right side.showTopLabels(boolean): show labels on the top side.vertTransparency(number): transparency applied to vertical elements.vlevel1–vlevel7(Levels): individual vertical level configuration.
Return Value
(string) · The drawing ID of the created Gann Square.
Example
Every 100 candles, we draw a Gann Square from a past swing low up to a more recent swing high, dividing it into simple proportional levels.
Result

Tips
Use clear swing highs/lows as anchors so the square naturally fits the market rhythm.
Start with just a few levels (
0.25, 0.5, 1) to keep the chart readable.
Warning
Do not confuse originPoint/targetPoint with raw time() or price values. Always build them using newPoint(time(offset), price).
Last updated