Professional Documents
Culture Documents
Sierra Chart
Financial Markets Charting and Trading Platform
Square of 9
This study calculates and displays Gann's Square of 9 indicator.
If you find that your price graph is getting compressed by the Square of 9 lines, then set the Scale
Range Type in the Scale settings for this study to Same As Region.
Let the Inputs Number of Days to Calculate, Anchor Value, Degrees, Level, and Price
Multiplier be denotes as D , a , θ, l, and v, respectively. These Inputs are subject to the following
restrictions.
Suppose there are N bars in the chart. If the Anchor Value is set to 0, then it is
automatically reset to v ⋅ CN −1 , which is the Price Multiplier times the Close Price at
Index t = N − 1.
The Square of 9 study calculates four Subgraphs. We denote their values at Index t as At (a, v) ,
(+) (−)
L1
t
(a, θ, l, v) , L1
t
(a, θ, l, v) , and L1t (a, θ, v) . These Subgraphs are displayed as horizontal line
segments over the last D days of the chart, with levels determined by the values of the Subgraphs
at the most recent Index t.
If the Auto Adjust Input is set to No, then these Subgraphs are calculated as follows.
a
At (a, v) =
v
2
∘
(√a + θ ⋅ ⌊l + 0.5⌋ /180 )
(+)
L1 (a, θ, l, v) =
t
v
L1t (a, θ, v) = 0
2
∘
(√a − θ ⋅ ⌊l + 0.5⌋ /180 )
(−)
L1 (a, θ, l, v) =
t
v
If the Auto Adjust Input is set to Yes, then these Subgraphs are calculated using a more
complicated set of rules, which we describe below.
Upper: Ut (a, θ, l)
Mid: Mt (a, θ, l, v)
Lower: Lt (a, θ, l)
Offset: kt (θ)
2
θ
BUt (a, θ) = (√a + )
∘
180
2
θ
BLt (a, θ) = (√a − )
∘
180
2
θ
Ut (a, θ, l) = (√a + ⌊l + 0.5⌋ ⋅ )
∘
180
Mt (a, θ, l, v) = a
2
θ
Lt (a, θ, l) = (√a − ⌊l + 0.5⌋ ⋅ )
∘
180
For t > 0 , we begin by setting the values of the six functions as follows.
Once these values are set, the Auto Adjustments are made via a sequence of two while loops,
described below.
kt (θ) = kt (θ) + θ
2
∘
BUt (a, θ) = (√a + (kt (θ) + θ)/180 )
2
∘
BLt (a, θ) = (√a + (kt (θ) − θ)/180 )
2
∘
Ut (a, θ, l) = (√a + (kt (θ) + ⌊l + 0.5⌋ ⋅ θ)/180 )
2
∘
Mt (a, θ, l, v) = (√a + kt (θ)/180 )
2
∘
Lt (a, θ, l) = (√a + (kt (θ) − ⌊l + 0.5⌋ ⋅ θ)/180 )
kt (θ) = kt (θ) − θ
2
∘
BUt (a, θ) = (√a + (kt (θ) + θ)/180 )
2
∘
BLt (a, θ) = (√a + (kt (θ) − θ)/180 )
2
∘
Ut (a, θ, l) = (√a + (kt (θ) + ⌊l + 0.5⌋ ⋅ θ)/180 )
2
∘
Mt (a, θ, l, v) = (√a + kt (θ)/180 )
2
∘
Lt (a, θ, l) = (√a + (kt (θ) − ⌊l + 0.5⌋ ⋅ θ)/180 )
Upon completion of these two while loops, the four Subgraphs are computed as follows.
a
At (a, v) =
v
Ut (a, θ, l)
(+)
L1 (a, θ, l, v) =
t
v
Mt (a, θ, l, v)
L1t (a, θ, v) =
v
Lt (a, θ, l)
(−)
L1 (a, θ, l, v) =
t
v
Inputs
Number of Days to Calculate: This sets the number of days over which the
horizontal lines from the study Subgraphs are to be drawn.
Anchor Value: The user designated starting level for the calculations. This is
usually a significant high or low in the chart.
Degrees: The degrees that you wish to use for the calculations.
Level: The degrees level for the lines. For example, if Degrees is set to 22.5 and
the Level is set to 1, then lines are drawn at positive and negative 45 degrees
from the Anchor Value. If Degrees is set to 22.5 and the Level is set to 2, then
the lines are drawn at positive and negative 90 degrees from the Anchor Value.
And so on.
Auto Adjust: This determines the calculation scheme for the study Subgraphs.
Price Multiplier
Spreadsheet
The spreadsheet below contains the formulas for this study in Spreadsheet format. Save this
Spreadsheet to the Data Files Folder.
Square_Of_9.111.scss