OPEN-SOURCE SCRIPT

Gann Retracement

Updated
The indicator is based on W. D. Gann's method of retracement studies. Gann looked at stock retracement action in terms of Halves (1/2), Thirds (1/3, 2/3), Fifths (1/5, 2/5, 3/5, and 4/5) and more importantly the Eighths (1/8, 2/8, 3/8, 4/8, 5/8, 6/8, and 7/8). Needless to say, {2, 3, 5, 8} are the only Fibonacci numbers between 1 to 10. These ratios can easily be visualized in the form of division of a Circle as follows :

  • Divide the circle in 12 equal parts of 30 degree each to produce the Thirds :
    30 x 4 = 120 is 1/3 of 360
    30 x 8 = 240 is 2/3 of 360

    The 30 degree retracement captures fundamental geometric shapes like a regular Triangle (120-240-360), a Square (90-180-270-360), and a regular Hexagon (60-120-180-240-300-360) inscribed inside of the circle.

  • Now, divide the circle in 10 equal parts of 36 degree each to produce the Fifths :
    36 x 2 = 72 is 1/5 of 360
    36 x 4 = 144 is 2/5 of 360
    36 x 6 = 216 is 3/5 of 360
    36 x 8 = 288 is 4/5 of 360
    where, (72-144-216-288-360) is a regular Pentagon.

  • Finally, divide the circle in 8 equal parts of 45 degree each to produce the Eighths :
    45 x 1 = 45 is 1/8 of 360
    45 x 2 = 90 is 2/8 of 360
    45 x 3 = 135 is 3/8 of 360
    45 x 4 = 180 is 4/8 of 360
    45 x 5 = 225 is 5/8 of 360
    45 x 6 = 270 is 6/8 of 360
    45 x 7 = 315 is 7/8 of 360
    where, (45-90-135-180-225-270-315-360) is a regular Octagon.



How to Use this indicator ?

The indicator generates Gann retracement levels between any two significant price points, such as a high and a low.

Input :

  • Swing High (significant high price point, such as a top)
  • Swing Low (significant low price point, such as a bottom)
  • Degree (degree of retracement)


Output :
Gann retracement levels (color coded as follows) :
  • Swing High and Swing Low (BLUE)
  • 50% retracement (ORANGE)
  • Retracements between Swing Low and 50% level (RED)
  • Retracements between 50% level and Swing High (LIME)


Release Notes
Fixed overlapping labels and alignment issues.
retracementSupport and ResistancetrednanalysisTrend Analysis

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