HM2 - Gann Square of Nine Levels# Gann Square of Nine Levels
This indicator draws support and resistance lines on your chart using a mathematical formula from W.D. Gann's Square of Nine. You don't need to understand the math to use it — the indicator tells you where price is likely to stall, bounce, or reverse.
---
## How to Read It
**Lines above the current price are resistance** — price may slow down or reverse when it reaches these levels. The label next to each line says "Resistance" with the price.
**Lines below the current price are support** — price may bounce when it falls to these levels. The label says "Support" with the price.
**Line thickness tells you how strong the level is:**
- **Thick solid blue lines** = Strong levels. These are full-cycle boundaries in the Gann spiral. Price respects these most often.
- **Dashed green lines** = Medium levels. Opposition points on the spiral. Reliable S/R.
- **Thin dashed red lines** = Standard levels. Square positions. Worth watching but less reliable alone.
- **Dotted grey lines** (optional, off by default) = Minor levels. Turn these on in settings if you want a finer grid.
**White dotted lines** highlight the nearest support and resistance to the current price — the two levels that matter most right now.
---
## The Info Table
The table in the top-right corner gives you the key information at a glance:
| Row | What it shows |
|-----|--------------|
| **Pivot** | The center price all levels are calculated from. |
| **Next Resistance ↑** | The nearest level above price, with the distance as a percentage. |
| **Next Support ↓** | The nearest level below price, with the distance as a percentage. |
| **Position** | Where price sits between the nearest support and resistance: "Near Support" (bottom 25%), "Mid-Range" (middle), or "Near Resistance" (top 25%). |
| **Nearest Levels** | The strength rating and angle of the nearest support (S) and resistance (R). |
The Position row is colour-coded: green when near support (potential buy zone), red when near resistance (potential caution zone), yellow when mid-range.
---
## Settings
| Setting | Default | Notes |
|---------|---------|-------|
| Pivot Mode | Auto | Auto calculates from recent price range. Manual lets you set a specific price. |
| Lookback Period | 64 | How many bars to analyze for the auto pivot. |
| Rotations | 2 | How many layers of levels to draw. 2 is usually enough. |
| Show Minor Levels | Off | Adds extra levels between the main ones. Turn on for more detail. |
| Show Zone Fills | On | Subtle shading between strong levels to show price zones. |
---
## How to Trade With It
**Near Support (green in table):** Look for buy opportunities. If other indicators also suggest a bounce (RSI oversold, bullish candle pattern, etc.), the support level gives you a natural entry and stop-loss reference.
**Near Resistance (red in table):** Be cautious with new longs. If you're already in a position, consider taking partial profits near resistance. If price breaks through a strong resistance level, that level often becomes new support.
**Mid-Range (yellow in table):** No immediate level pressure. Less useful for entries — wait for price to approach a level.
**Breakouts:** When price closes convincingly above a strong (blue) resistance level, the next strong level above becomes your target. The broken resistance often becomes support for pullback entries.
---
## Under the Hood
Levels are calculated using: `Level = (√Pivot ± degrees/360)²`. This creates non-uniformly spaced lines that widen away from the pivot — a natural property of the square root relationship. Cardinal angles (90°, 180°, 270°, 360°) produce the strongest levels; ordinal angles (45°, 135°, 225°, 315°) produce secondary ones.
Pine Script® indicator






















