Pages

Monday, May 30, 2011

The Gann square of nine

W.D. Gann's square of nine - If ever there was a bit of trading mumbo-jumbo that I counted as not worth thinking about, it was W.D. Gann's square of nine. How could I bother with century-old jargon about prices vibrating off each other, square-outs of time, prices related to degrees of a circle, producing a mystical numerology that purports to give exact dates on which particular prices must be reached?
Nonetheless, I decided to make another attempt to understand it when Jeff Cooper, a trader whom I (otherwise) respect, described his use of the Gann square in a RealMoney.com article. Something in the article jogged my memory, and it was then that I realized Gann's square of nine is in fact known to mathematicians in a context totally unrelated to the stock market. To mathematicians, the square of nine is known as Ulam's Prime Number Spiral, and displays some of the properties of the greatest unsolved mystery in mathematics the distribution of the prime numbers.

SIGNIFICANCE OF PRIME NUMBERS

What could these two fields trading the stock market and prime number theory possibly have in common? Puzzled, I could not find a writer, trader or mathematician, who had mentioned the equivalence of the spirals of Ulam and Gann; Jeff Cooper confirmed to me that he had never heard of this connection. If it has been noticed before, it is at least not well known. Is it possible there is some hidden relationship here that could profit a trader? Could prime numbers be turned into prime cash? I decided to track down the connection.
Gann's square of nine consists of the integers arranged in the form of a square spiral. One can construct it using a spreadsheet or graph paper. Place the number 1 in a central cell; to its left place the number 2; above that is 3, and move around clockwise, adding one each time: to the right of 3 is 4 and 5, then below 5 is 6 and then 7. To the left of 7 is 8 and then 9, which completes the first square. To the left of 9 place 10 to start a new square out, and above 10 place 11, and so on, around and around as large as one likes (Figure 1). Gann believed this arrangement captured a hidden law that the markets inexorably followed.


Figure 1: The Gann square of nine. The mathematician Stanislaw Ulam discovered that the prime numbers shown in blue sometimes fall unexpectedly along lines in the square, such as in the diagonal ray extending from the center to the northeast corner.
In trading, the numbers are interpreted as prices, and their circular arrangement represents the passage of time; a full turn around the spiral takes one to the next larger square and represents a single period, such as a year. Of particular significance are lines of numbers that fall along the eight cardinal directions of a compass: the four rays emanating from the center in the directions of north, east, south and west identify the alignment of prices that occur at certain times of the year, as do the set of diagonals running from the center to northwest, northeast, southwest and southeast.
Gann traders look for prices at significant highs and lows then check along these significant rays to find other prices at which future highs and lows are expected to occur. Traders can also find price relationships by looking at angles of 90 degrees, 180 degrees, and so forth, that are formed with respect to a significant price. For example, in the first square, 9 is related to 3 by a 90-degree turn, and 7 is related to 3 by 180 degrees. With these tools, Gann traders make forecasts of the size of price oscillations and the timing of significant turning points in the markets. Gann himself apparently used these methods to predict wheat prices in 1909 that established his fame.
The figure known to mathematicians as "Ulam's prime number spiral" is constructed in exactly the same fashion as the square of nine, but its use is quite different. It was discovered by mathematician Stanislaw Ulam in 1963. While listening to a "long and very boring paper" at a science conference, Ulam drew a square grid, thinking he might set up a chess problem; instead, he began numbering the intersections of the grid by spiraling out from the center. Then he idly began to circle the prime numbers the only integers that cannot be calculated by multiplying together other integers. He was astounded to find that sets of prime numbers arranged themselves along diagonal lines in the diagram. See Figure 1, where the primes are in the shaded cells; note the sequences such as 7, 23, 47, and 79, or 5, 19, 41, 71, 109.
Subsequently programming a Maniac II computer to generate a picture of the distribution confirmed that prime numbers appeared along diagonal lines throughout the largest square spirals that could be made. For example, Gann's 45-degree line, the northeast ray, holds the primes 5, 17, 37, 101, 197, 257, 401, and so on: 70% of the numbers out to the 10th square are primes, even though only about 20% of the integers up to 401 are prime.
Prime numbers are important because they act as the "elementary particles" of the numbers: all integers can be uniquely calculated by multiplying together only primes. The distribution of the prime numbers among the other integers is considered by many to be the greatest unsolved mathematical mystery.
The patterns that leapt to the eye in Ulam's spiral indicate some underlying order to the distribution of the primes that has yet to be fully understood. Some people regard the mystery of the prime numbers with an awe that rivals Gann's mystical search for the hidden laws of the stock market. But what brings these two mysteries together into the square spiral?

NATURAL SQUARES CALCULATOR

The answer to this question, although only a partial one, is that Gann's square of nine is a parabola calculator. Gann referred to it as the "natural squares calculator" and may have derived it from ancient techniques for computing squares of numbers. Note that the natural squares 22 = 4, 3= 9, 5= 25 and so on fall along the southwest diagonal of the square. In fact, each of the cardinal rays extending from the center is described by a quadratic equation, which on a time-price chart forms a parabolic curve.
Let us label the ever-larger concentric squares with integers n. The center square, with just the number 1, we will label as n = 0; the next square out, with three unit cells on a side and largest number 9, will be labeled n =1, the next, with five cells on a side and largest number 25, is n = 2, and so on, so that the nth square has sides of length 2n+1 cells.
The area of the nth square is then (2n+1) 2 = 4n2 + 4n + 1, and this is also the largest number in each square (equal to the number of cells in the square). These largest numbers per square are lined up along the ray extending from the center to the southwest. Thus, the southwest ray corresponds to the quadratic expression 4n2 + 4n + 1.
All eight rays important to Gann theory are described by quadratic expressions of the form 4n2 + an + 1, where the choice of the coefficient a determines the angle of the ray. Gann called the ray pointing to the east the "zero degree ray," and so each of the others correspond to successive increments of 45 degrees; using this identification, the coefficient a that generates the parabola corresponding to the ray at angle w is given by a = 1 - w/45, where w takes on the values between 180 degrees and minus 180 degrees.
On a stock chart of price versus time, formulas of the form 4n2 + an + 1 produce a parabola, where the parameter n represents time and the expression evaluates to the corresponding price. Gann's contention that prices along the same ray "vibrate" against each other is actually a way of saying that sometimes critical prices fall along a parabola, which is a fact of trading life: blowoff tops occur when price goes parabolic. Thrusts increase in length and pullbacks decrease; parabolas can also describe the slowing down and turning of a trend as thrusts become smaller and pullbacks greater.
When Gann describes price moving between rays of different angles he is describing the motion of the stock price between members of a fanlike family of parabolas, effectively describing a parabolic trend channel. To good approximation, all linear trend channels eventually become parabolic trend channels as markets turn. Gann's square of nine and his use of esoteric language disguise genuine phenomena that traders can find useful.

APPLYING TO TRADING

What does this have to do with primes? In Ulam's spiral, the curious alignments of prime numbers is also related to the spiral's function as a parabola calculator. In the 18th century, mathematicians Legendre and Euler discovered that some sequences of primes can be generated by quadratic expressions. A particularly famous expression is x2 + x + 41, published by Euler in 1772, which has 40 consecutive primes. These prime-generating quadratic polynomials appear as lines in the square of nine.
Although most of these lines do not pass through the center, with suitable labeling of the squares they can be described by parabolas of the form 4n2 + an + b. In the case of the sequence of primes 5, 19, 41, 71, the parabola has coefficients a = 10 and b = 5, and primes are generated for n = 0, 1, 2, 3, as well as various higher n. For the sequence 7, 23, 47, 79 the corresponding coefficients are a = 7 and b = -1 for n starting at 1.
Not every number along these lines is a prime, but an unusually high proportion are. According to the prime number theorem, the chance that any randomly selected integer x is a prime is roughly one over the natural log of x; the frequency of primes along some of the lines in the Ulam spiral far exceed that random distribution.
Ulam and his coworkers showed that along some diagonals, almost half the numbers less than 10,000,000 are prime. Just why this is so is still a mystery of mathematics. There are partial explanations. For example; some diagonals across the spiral can contain no primes on them because their quadratic expressions can be factored into the product of two linear expressions, and as a consequence there must be clusters of primes elsewhere; but it's not clear this explains the consistency of the distribution.
A Gann square of nine in which any given line of primes passes through the center and falls along the Gann cardinal directions can be formed by suitable adjustment of the central and incremental numbers that generate the square. By starting with -1 in the center of the square rather than 1, the 5, 19, 41. . . sequence becomes the southeast ray while the 7, 23, 47. . . sequence becomes the southwest ray.
Adjusting the center element can generate other prime rays; placing 17 or 41 in the center square generates spirals in which every number along a diagonal is a prime out to the 16th and 40th squares, respectively. These rays correspond to two of the most famous prime-generating quadratic expressions.
A Gann trader with an eye for primes could look for market price oscillations among prime-number parabolic channels. For example, in Figure 2, the Standard & Poor's 500 from 1994 to 2000 was supported by the parabola that corresponds to the northeast ray of the standard square of nine, which happens to be the ray with the most prime numbers of the cardinal directions. The upper curve of the parabolic channel corresponded to the ray 180 degrees opposite, the southwest ray, which happens to have absolutely no primes.

Figure 2: A Gann parabolic channel for the S&P 500 from 1994 to 2000. The upper parabola corresponds to the southwest ray in the square of nine, starting at the 10th square; the lower parabola is the northeast ray, starting at the ninth square. Time is scaled so that one complete turn of the square is equal to nine months.

Personally, I find it difficult to believe that prime numbers can be particularly useful in trading unless they have a psychological effect: traders of any methodology might instinctively see prime numbers as special or offbeat (as they do not appear as results in multiplication tables learned in school), and thus provide a more attractive place for entry and exit stops than the more obvious numbers ending in zero or the simple fractions of 10.
A better lesson to be drawn is that both Ulam and Gann were able to use this unusual arrangement of numbers to visually detect patterns that otherwise might be difficult to find. This is a technique that any seeker of hidden relationships can put to use. Whatever its meaning, I can't help but believe Gann would have been pleased to find his square of nine vibrating with a deeply hidden order of mathematics.

Gann numbers

Gann numbers - There is no simplistic explanation for Gann numbers, but it basically charts a relationship between price movements and time. Although it is increasingly used in stock trading, there is every chance you could find a reference to it in forex trading too. As you can see from the chart below, Gann numbers are calculated by using angles in charts. This helps in determining the support and resistance areas and could be used to predict the timing of future trend changes.
can-numbers

Fibonacci numbers

Fibonacci numbers! Doesn't that sound a lot like an enormous chapter in high school mathematics' book? If that's what you think then you are absolutely right. We are indeed talking about those kinds of numbers. Fibonacci numbers are a sequence of numbers formed as follows:
0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55… etc
The sequence begins with 0 and 1.  Then keep adding the last two numbers to get the next. Meaning that:
0+1=1
1+1=2
1+2=3
2+3=5
3+5=8
5+8=13
well, you have got the picture now!
Why this sequence is called Fibonacci? The sequence of numbers was discovered by Leonardo de Pisa, also known as Fibonacci. He lived in 12th century and was lucky enough to be the one to discover this amazing mathematical sequence. Off the topic Fibonacci numbers can be found EVERYWHERE! Scary enough these numbers represent the natural proportions of things in our enormous universe. And since forex is a part of the universe – Fibonacci numbers are applied here as well in search of a simple proportional solution for trading profits!
Speaking of trading, lets get to the main issue here – forex. You don't have to learn how to calculate any of this by yourself. The forex broker of your choice will provide you with software that calculates everything for you. 
Now here is the mystery – with major ratios calculated from Fibonacci numbers forex traders can actually predict a behavior of trend and countertrend movements in forex market. Spooky!!! 
Here is a set of numbers to remember: 38%, 50% and 62%  
If you take these percentages and apply them to the trending price you will notice not only a certain amount ofretracement, but also where new high and low could go. These marks are very important to forex traders since they are support and resistance areas where the price will either hesitate for a while or will reverse. 
Before grabbing the charts there is one more thing you have to know. The primary trends move all together in 5 waves. First there are 3 forward waves, and then there are 2 backward waves. Now countertrends move differently – 3 waves at a time. First there are 2 forward waves, followed by 1 backward wave.  
Now you are officially eligible to get some charts to "play" with and test your knowledge. Once you figure out how to place the marks correctly (every trading platform is different), you will definitely notice Fibonacci ratios in the price movements as it changes the position from support to resistance and back to support. Then you will realize that looking at certain time frames the trends tend to have similar proportionality. Wow!!

Whether on a hourly or a daily chart the Fibonacci lines that you draw are relevant until the price action has either confirmed or rejected them. Lets say if the price retraces to 38% line and then suddenly reverses again back to its original path crossing over the 0% line then you can for sure say that the cycle is over.    

Wednesday, May 25, 2011

Standard Deviation Channel

Standard Deviation Channel is built on base of Linear Regression Trend representing a ussual trendline built between two points on the price chart using the method of least squares. As a result, this line proves to be the exact median line of the changing price. It can be considered as an equilibrium price line, and any deflection up or down indicates the superactivity of buyers or sellers respectively.

Standard Deviation Channel consists of two parallel lines, equidistant up and down from the Linear Regression Trend. The distance between frame of the channel and regression line equals to the value of standard close price deviation from the regression line. All price changes take place within Standard Deviation Channel, where the lower frame works as support line, and the upper one does as resistance line. Prices usually exceed the channel frames for a short time. If they keep outside of the channel frames for a longer time than usually, it forecasts the possibility of trend turn.

Equidistant Channel


Equidistant Channel represents two parallel trend lines connecting extreme maximum and minimum close prices. Market price jumps, draws peaks and troughs forming the channel in the trend direction. Early identification of the channel can give a valuable information including that about changes in the trend direction what allows to estimate possible profits and losses. It is necessary to give the direction of the channel and its width to build the instrument.

Linear Regression Channel


The linear regression channel, similar to the Bollinger Bands, is a technical analysis tool that can be used to trade the binary options market.  The linear regression channel is a statistical technical analysis tool that captures the recent ranges and creates a statistical boundary where prices are likely to trade over a specific period of time.
Linear regression is a statistical approach to determining (via modeling) the relationship between one or more variables, where the model depends linearly on the unknown parameters to be estimated from the data.   The conditional mean of the given values (say prices of a financial instrument) are a function of that particular instrument or another instrument.  In essence, one specific variable is dependent, to a degree, on another specific variable.  The degree of dependence is called the R (squared), which is denoted in a percent format.
The linear regression channel is a channel that is created using a specific amount of data points where a regression line is created using the R (squared).  Parallel lines are then drawn that are one or two standard deviations away from the mean line.  The channel incorporates a larger percentage of the recent range of prices and theoretically will be bound where most of the price action over a future period of time.  This is accomplished by increasing or decreasing the standard deviation.  The larger the standard deviation, the more price and potentially future prices will be incorporated into the bands.  The linear regression channel can be used as a mean reverting indicator, where the bands on each end are support and resistance for price action.  In the hourly chart of USD/JPY, the linear regression channel incorporates the majority of price actions during a 20 period range.
  
The linear regression channel can be used successfully to trade hit or miss options, range options, one-touch options or above or below options.  For above or below options, an investor can use the high end of the linear regression channel to buy below options, and the low end of the linear regression channel to purchase above options.  For range trading, the channel should be an excellent strategy.  Placing a trade, this pays off if price action trades in a range in the future should be statistically significant.  This strategy is based on the idea that the current range will continue to perpetuate in the future is not other news is added to the market.  A two standard deviation range will incorporate 95% of the current prices, which should act as a very strong guide for future trading.  For example, a range box can be placed in front of the price action with a length that is similar to the trend channel.  
These strategies using the linear regression channels have a lot of statistical merit and should be tested using numerous financial instruments to find the binary option and instrument that match an investor’s risk profile.

Channel


There are line studies being largely used in technical analysis and helping to define channels and trend changes. These instruments are: