This application is a replacement for the original Square of Nine that was written for Tradestation 2000. That product has been retired and is no longer available.
This version works with TS8.x and is much easier to use and more versatile than the original application.
This document is basically the users manual so you can see what this does.
Clyde
- - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
If you are a current licensee
for Sq9 TS2000
CLICK THE Add to Cart Button TO ORDER the
Update for TS8.x @ $50.00
You must be a registered licensee for this price
- - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
To place your order with PayPal
CLICK THE Add to Cart Button TO ORDER the
Gann_SquareOfNINE @ $200.00
- - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Gann_SQofNine_TS81
By: Clyde Lee
This application (written for Tradestation) was originally developed under the direction of the author of PyraPoint (Don Hall). Don and I could not see eye to eye on the need for me to be paid for the programming I had done and he got an offer to do it for free on a different platform and he decided to go that way.
Having made that choice then I added facilities to this application to (at least for me) provided a measurable improvement over the original concept.
The input parameters and discussion of each parameter follows.
MaxSets(1),
{ Set number for number set of Squares to plot. 1..6 }
{ If GannAngl = 90 1=0->180, 2=0->360, 3=0-540..... }
NumbBars(34),
{ Number of bars for use in scan for location of pivots. }
{ Set to zero to do manual selection of turning points by }
{ entering a T at selected tops and a B at bottoms. }
{ Again, must be set to 0 (zero) for manual specification }
{ If non-zero, specifications for search length for left }
{ and right side -- left side is integer portion of value }
{ Decimal portion (if specified) is multiplied by 100 and }
{ that value is used to set right hand side length. }
{ This application uses the Swing_Lee_II pivot finding }
{ method which allows a different detection length to be }
{ specified for the left and right side of the pivot. A }
{ decimal fraction value (if given) is multiplied by 100 }
{ and the resulting value used for the length of right }
{ had detection. This value MUST be LESS than the }
{ integer portion of the specification which is the }
{ length for the left hand side. If no decimal fraction }
{ is specified then the supplied value is used for both. }
ForcePvt(true),
{ On last bar of computation, force a pivot if a pivot }
{ has not been detected very recently. }
GannAngl(45),
{ Gann Angle to use for square/rectGannAngl of interest }
ChanAngl(45),
{ Gann Angle to use for square/rectGannAngl of interest }
{ If non-zero, draw a channel of this Gann angle }
{ Channel width same as channel angle. }
ChanOnly(false),
{ Set true for only channel lines and no box lines. }
SandROnl(false),
{ Set true for angle lines. Set ChanAngl=0 for no channel }
Scaling(10);
{ A factor which is used to calculate a multiplier and }
{ divisor to cause the price seen on the chart to fall }
{ in the proper range for squaring of time and price. }
{ This is the multiplier of 10 used in the denominator }
{ of the equation: 1/pivotprice*10*DeciMult to }
{ arrive at the multiplier/divisor. This is similar to }
{ what Gann defined as shifting the decima. }
{ What this auto-scaling does is to convert all prices to }
{ values such that the current pivot/turning point has an }
{ apparent value of X and calculations are based on }
{ a Gann Square with this orientation. }
{ If you want pure Gann -- no auto shifting then: }
{ If set to zero the actual price at the pivot is used. }
FixTime(true);
{ Use a fixed time unit of one regardless of time int. }
UseClose(false);
{ Use close rather than HH/LL for takeoff of squares. }

The above is a picture showing the automatic detection of pivots/turning points by use of the internal detection method known as Swing_Lee. Given a “look back” distance in bars then within this “Lookback” window when (if prices have been going up) the current low price becomes the lowest price, the routine signals a change in direction and provides information as to the location of the highest high or pivot within the window.
The above display does not seem to have a Gann Angle specification that causes the channel to best fit the data.
What follows is another symbol and time and a walkthrough as to how to get the channel to fit the data. When I begin to work with a set of data I select the angle that I want to use to encompass the various segments of price movement. For me this is nearly always 45 degrees. This is accomplished by specifying that GannAngl and ChanAngl are 45 (degrees). Then I change the value in the NumbBars parameter until I get the routine to pick pivots as I see them. Generally I can use the default value (34) but if needed I will switch to 8, 13, 21, 55, 89, etc. Once we have the best pick for turning points then I change the Scaling parameter until the path of prices seems to best fit within the channel lines.
You can see from the following the change in apparent angle as the scaling changes.

OK, the apparent angle is too low (scaling=300) so change the scaling to 200 and see what happens.

That was considerably better – now we know that if we lower the scaling factor it causes the apparent angle to increase – so let us try another one, this time 150
.

I doubt that we need anything better. However, let us take a look at what is needed if we were to select an apparent angle of 30. We are also going to use a set of manually determined points rather than the “auto” points picked previously. Here we put a T over the highest bar of a price run and a B below the lowest bar of a price run. By setting the NumbBars parameter to zero, the program knows to go searching for B and T characters that have been put on the chart by use of the alpha tool in Tradestation.
We are going to assume that the science of mathematics really works. If I use an angle of 45 and a scaling factor of 150 then if I want to specify an angle of 30 (30/45=0.6666667) then by multiplying 150 by this factor I should get a scaling factor that will make things work. The scaling factor that is computed is 100 and the results of the 30/100 picture is:

Just a couple more interesting displays possible. First we show CHANNELS ONLY.

And then the Support and Resistance lines based on Gann Angles.

The amazing thing is that this is a two month period and yet throughout this time it is quite clear that the path of price movement tends to follow the Gann lines that have been defined. Maybe Gann did have something after all.
Now for a bit different look.


These pictures show a situation where we first established a set of manually determined turning points. It is clear that in the first one, the very first low turning point we picked did not cause the Gann channel to fit the data. However, by looking forward in time we find the solution.


First two of several in which we change the auto detection length.


We will take a look one step further.

The above examples should give you a good start on how to use this indicator.
Remember:
Pick your pivots.
Pick your angle.
Adjust scaling to make channel fit data.
Lean back and be amazed.
Clyde Lee
The following is the frontend of the program and can be kept as a guide on what the parameters mean.
{
Indicator: Gann_SQofNine_TS81
Author: Clyde Lee (clydelee@swbell.net) Copyrighted 2000-2006
Purpose: Provide a TS implementation of the drawing of lines
and squares based on the Gann Square of 9. Originally
coded for author of PyraPoint but he could not understand
the concept of scaling nor the need for paying a royalty
for the programming that was done.
This is not a PERFECT implementation of the Gann Square
of Nine UNLESS YOU SET THE ANGLE TO 45 AND ADJUST THE
SCALING TO FIT THE DATA. In such a case it is right on.
Gann Square
37 36 35 34 33 32 31
38 17 16 15 14 13 30
39 18 5 4 3 12 29
40 19 6 [1] 2 11 28
41 20 7 8 [9] 10 27
42 21 22 23 24[25]26
43 44 45 46 47 48[49]
If we take a portion of the familar Gann Square and look at the
315 or 45 degree line (depending on whether we measure Gann Angles
clockwise or counterclockwise) we find the series of numbers
enumerated below. To see how these numbers fit the square of
nine see the above small portion of a square with brackets around
the key 45/315 degree numbers.
45/315 degree line numbers:
1 9 25 49 81 121 169 225 289 361 441 529 625 729 841 961
the above numbers are the square of the following series:
1 3 5 7 9 11 13 15 17 19 21 23 25 27 29 31
If a turn around the Gann Square of 9 is considered to be a 360
degree trip then using this relationship:
1. Given some value of price termed Price1,
2. To arrive at Price2 which is 360 degrees
away from Price1, calculate:
Price2 = Square(SquareRoot(Price1)+2)
Example: Above square root of 81 is 9 and
Above square root of 121 is 11 which
is 9 plus 2 and when squared is equal
to 121 so 121 is 360 degrees from 81;
Therefore: Price2 = 360 degree price of Price1.
That being true then the squareroot difference for Gann Angles of
180=1 and 90=0.5 , and any Gann Angle
desired can be calculated from this relationship ! ! ! !
The Gann_SQUAREofNINE application is based on a concept that the
number of TIME units for a 360 degree movement of price is equal
to the SQUAREROOT of price at the inflection/turning point from
which we wish to project the forthcoming time price relationships
and that the 360 degree rotation of price is based on the above
noted relationship of adding/subtracting a value to/from the
squareroot of the price value at an inflection/turning point.
This concept has been offered first by Gann (so far as I can
tell), then by Dunnigan and, recently by Don Hall.
The Gann_SQUAREofNINE program can automatically pick turning
points and will apply the specified GannAngl and ChanAngl
parameters at each such point.
If it is desired to indicate to the program where the user wants
the top and bottom of price swings to be assigned, set the
NumbBars parameter to zero (0), and do the following:
Use the text tool to label swing tops (high price in swing) and
bottoms (lowest price in swing) with the letters "T" for top of
swing or "B" for bottom of swing. (Note: A maximum of 1000 tops
and/or bottoms can be used). Once the T and B indications
are in place, refresh the indicator (clicking "Status" twice causes
the indicator to recalculate).
Be sure to put the T label(s) above the bar's high for a swing
top/high, and the B label(s) below the swing bottom/low.
The angle to be used can also be specified by following the
T and/or B with a numeric value. T90 means angle here should
be 90. You do not have to specify ALL angles. The GannAngl
parameter sets all angles to that value as a default.
The code to allow the use of alphabetic characters for setting the
turning points is a major modification of code from a non-copyrighted
program by: Gregory Wood.
Note that you can use the pointer tool to move the points anytime. Then
to view the new pivot/turningpoint results, refresh the indicator.
}
MaxSets(1),
{ Set number for number set of Squares to plot. 1..6 }
{ If GannAngl = 90 1=0->180, 2=0->360, 3=0-540..... }
NumbBars(34),
{ Number of bars for use in scan for location of pivots. }
{ Set to zero to do manual selection of turning points by }
{ entering a T at selected tops and a B at bottoms. }
{ Again, must be set to 0 (zero) for manual specification }
{ If non-zero, specifications for search length for left }
{ and right side -- left side is integer portion of value }
{ Decimal portion (if specified) is multiplied by 100 and }
{ that value is used to set right hand side length. }
{ This application uses the Swing_Lee_II pivot finding }
{ method which allows a different detection length to be }
{ specified for the left and right side of the pivot. A }
{ decimal fraction value (if given) is multiplied by 100 }
{ and the resulting value used for the length of right }
{ had detection. This value MUST be LESS than the }
{ integer portion of the specification which is the }
{ length for the left hand side. If no decimal fraction }
{ is specified then the supplied value is used for both. }
ForcePvt(true),
{ On last bar of computation, force a pivot if a pivot }
{ has not been detected very recently. }
GannAngl(45),
{ Gann Angle to use for square/rectGannAngl of interest }
ChanAngl(45),
{ Gann Angle to use for square/rectGannAngl of interest }
{ If non-zero, draw a channel of this Gann angle }
{ Channel width same as channel angle. }
ChanOnly(false),
{ Set true for only channel lines and no box lines. }
SandROnl(false),
{ Set true for angle lines. Set ChanAngl=0 for no channel }
Scaling(10);
{ A factor which is used to calculate a multiplier and }
{ divisor to cause the price seen on the chart to fall }
{ in the proper range for squaring of time and price. }
{ This is the multiplier of 10 used in the denominator }
{ of the equation: 1/pivotprice*10*DeciMult to }
{ arrive at the multiplier/divisor. This is similar to }
{ what Gann defined as shifting the decima. }
{ What this auto-scaling does is to convert all prices to }
{ values such that the current pivot/turning point has an }
{ apparent value of X and calculations are based on }
{ a Gann Square with this orientation. }
{ If you want pure Gann -- no auto shifting then: }
{ If set to zero the actual price at the pivot is used. }
FixTime(true);
{ Use a fixed time unit of one regardless of time int. }
UseClose(false);
{ Use close rather than HH/LL for takeoff of squares. }
- - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
If you are a current licensee
for Sq9 TS2000
CLICK THE
Add to Cart Button TO ORDER the
Update for TS8.x @ $50.00
You must be a registered licensee for this price
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
To place your order
for new license with PayPal
CLICK THE Add to Cart Button TO ORDER the
GannSqOfNINE_TS8 @ $200.00
- - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -