You are on page 1of 4

Toggle Dark Mode Find Search

Sierra Chart
Financial Markets Charting and Trading Platform

Main ▾ Documentation ▾ Getting Started ▾ Account Management ▾ Support ▾

Home >> (Table of


Contents) Studies and
Indicators >> SC Account Name Login Login Page - Create Account
Technical Studies
Reference >> Square Of 9

Technical Studies Reference


Technical Studies Reference

Common Study Inputs (Opens a new page)

Using Studies (Opens a new page)

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.

If the Price Multiplier is set to 0, then it is automatically reset to 1.

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

For an explanation of the floor function (⌊ ⌋ ), refer to our description here.

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.

We begin by defining six functions that are used in intermediate calculations.

Base Upper: BUt (a, θ)

Base Lower: BLt (a, θ)

Upper: Ut (a, θ, l)

Mid: Mt (a, θ, l, v)

Lower: Lt (a, θ, l)

Offset: kt (θ)

These functions are initialized as follows at t = 0 .

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.

BUt (a, θ) = BUt−1 (a, θ)

BLt (a, θ) = BLt−1 (a, θ)


(+)
Ut (a, θ, l) = v ⋅ L1 (a, θ, l, v)
t

Mt (a, θ, l, v) = v ⋅ L1t−1 (a, θ, v)


(−)
Lt (a, θ, l) = v ⋅ L1 (a, θ, l, v)
t

kt (θ) = kt−1 (θ)

Once these values are set, the Auto Adjustments are made via a sequence of two while loops,
described below.

while(vCt > BUt (a, θ)) :

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 )

while(vCt < BLt (a, θ)) :

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.

Open it through File >> Open Spreadsheet .

Square_Of_9.111.scss

*Last modified Monday, 03rd October, 2022.


Service Terms and Refund Policy

You might also like