Editors' picks
OPEN-SOURCE SCRIPT

Gann Square of 144

Updated
This indicator will create lines on the chart based on W.D. Gann's Square of 144. All the inputs will be detailed below

Why create this indicator?
I didn't find it on Tradingview (at least with open source). But the main reason is to study the strategy and be able to draw it fast. Manually drawing the square is not hard, but moving all together to the right spots and scale was time-consuming.

It has a lot of inputs...
Yes, each square point divisible by 6 has information with some options, so the user can create any configuration he wants. Also, it has the advantage of having the square built in seconds and adjusting itself on each new calculation.

About the inputs

Starting Date
This input will be used when the "Set Upper/Lower Prices and Start Bar Automatically" checkbox is not selected. The indicator will calculate all the line locations on the chart using the selected start date. When selecting this input, change the Manual Max and Min Prices to the better calculation

Manual Max/Min Price
This input will be used when the "Set Upper/Lower Prices and Start Bar Automatically" checkbox is not selected. The indicator will calculate all the line's locations on the chart using these prices

Set Upper/Lower Prices and Start Bar Automatically
Selects if the starting date will be automatically selected by the system or based on the input data. When it's set, the indicator will use the most recent bar as the middle point of the square, using the higher price as the Upper Price and the lowest price as the Lower Price in the latest 72 bars (or more based on the Candles Per Division parameter)

Update at a new bar
When this option is market, the indicator will update all created lines to match the new bar position, together with all the possible new Upper/Lower prices. Let it unchecked to watch the progression of the price while the square remains fixed in the chart.

Top X-Axis
When checked, it will display the labels on the Top of the square

Bottom X-Axis
When checked, it will display the labels on the Bottom of the square

Left X-Axis
When checked, it will display the labels on the left of the square

Right X-Axis
When checked, it will display the labels on the right of the square

Show Prices on the Right Y-Axis
When checked, it will display the prices together with the labels on the right of the square

Show Vertical Divisions
Show the lines that will divide the square into 9 equal parts

Show Extra Lines
Show unique lines that will come from the Top and bottom middle of the square, connecting the center to the 36 and 108 levels

Show Grid
When selected, it will display a grid in the square

Line Patterns
A selector with some options of built-in lines configuration. When any option besides None is selected, it will override the lines inputs below

Numbers Color
Select the color of each number on the Axis

Vertical Lines Color
Select the color of the vertical lines

Grid Color
Select the grid line color

Connections from corners to N
Each corner is represented by 2 characters, so they all fit in a single line
It will indicate where the line starts and where it ends
  • ┏ ↓ = Top Left to Bottom
  • ┏ → = Top Left to Right
  • ┗ ↑ = Bottom Left to Top
  • ┗ → = Bottom Left to Right
  • ┓ ← = Top Right to Left
  • ┓ ↓ = Top Right to Bottom
  • ┛ ← = Bottom Right to Left
  • ┛ ↑ = Bottom Right to Top

Besides selecting what line will be created, it's possible to select the color, the style, and the extension

How to use this indicator
When you dig into Gann's books for more information about the square of 144, you find that it was part of his setup with multiple indicators (technical and fundamental, and astrological). It is not a "one indicator" setup, so it's hard to say that you will find entries, exits, stop loss, and take profit in this. Still, it will help see trendiness, support, and resistance levels.

Mixing this with other indicators is probably a good idea, but some may find this indicator the only one needed.

Some aspects of the square
The end of the square is important, so where it starts is crucial. The end is important because it is where the price and time expire. The other parts of the square are defined based on their start and end, so placing them right is essential.

So, where to set the start of the square?
The last major low is the most indicated. The minimum price will be the lowest, and the max price will be the last major Top. Note that the indicator uses 1 candle on each point.

After finding the start, the minimum, and the maximum prices for the square, it will draw all lines. Another essential part of the square is The Midpoint.

The midpoint is the most crucial part of the square and is the best way to see if you positioned the square correctly. When the price is inside the square, using the starting candle as the start, a second higher low or a lower high occurs in that spot. When using the Vertical lines in the indicator, it's the middle square inside Gann's square.

The other divisions will be opposing each other most of the time. So if the price is rising in the 1/3 of the square, it's common to see the price fall in the 3/3 of the square.

More information about these aspects here

Considerations
This indicator was meant for price targets and a time calculator for possible support/resistances in the chart. It was created by William Delbert Gann and was part of his setup for trading almost a century ago. The lines will form geometric figures, which Gann used with high accuracy to predict tops/bottoms and when they would occur.
Release Notes
changed the array.push on the inputs to array.from + array.concat to reduce the method repetition (thanks HeWhoMustNotBeNamed for the suggestion)
Release Notes
• Added the parameters to change the background of the squares
• Organized parts of the code for readability and to make changes easier
Release Notes
Fixed error when disabling "Set Upper/Lower Prices and Start Bar Automatically" and using start date for the entry bar
144forecastingforecastingtechniquesGannPivot points and levelssquare

Open-source script

In true TradingView spirit, the author of this script has published it open-source, so traders can understand and verify it. Cheers to the author! You may use it for free, but reuse of this code in publication is governed by House rules. You can favorite it to use it on a chart.

Want to use this script on a chart?


Also on:

Disclaimer