OPEN-SOURCE SCRIPT

Sattam | Gann Tools

9 377
SATTAM | GANN TOOLS - a complete Gann geometry toolkit on two clicks

Four independent Gann constructions, all built from a single anchor you place
yourself: the Cycle Star, the Gann Grid, four Gann Fans, and tiling Gann
Squares. Each turns on or off without disturbing the others.


=== HOW TO PLACE IT ===

Add the indicator and it asks for two points:

1. THE ANCHOR - one click sets both the starting price and the starting date.
2. THE FIRST LEVEL DATE - one click sets the time unit.

Everything else is derived. The gap between the two clicks becomes the box's
time unit, and the starting price becomes the head of the cycle.


=== THE CORE IDEA: THE CYCLE LIVES IN SQUARE-ROOT SPACE ===

The cycle's reach is measured in the SQUARE ROOT of price, not in price:

end = ( sqrt(startPrice) +/- 2 * sqrt(Space) * totalDegrees / 360 ) ^ 2

With Space = 100 one full turn spans exactly 20 units of sqrt(price). Because
the travel is linear in the root, the price gaps compress as price falls and
open up as it rises - the Square-of-Nine behaviour Gann worked in.

Space is the only input that sets the reach:
2*sqrt(50) = 14.1421
2*sqrt(100) = 20.0000
2*sqrt(200) = 28.2843


=== CYCLE SHAPE: A POLYGON'S ANGLE SUM ===

Cycle shape decides how far around the cycle travels and in how many steps.
Each polygon is walked in 2n steps covering its interior angle sum,
(n-2)*180, so a single step is (n-2)*90/n:

SHAPE SIDES STEP STEPS TOTAL SWEEP
Triangular 3 30 6 180
Circular / Square 4 45 8 360
Pentagon 5 54 10 540
Hexagon 6 60 12 720
Heptagon 7 64.2857 14 900
Octagon 8 67.5 16 1080
Nonagon 9 70 18 1260
Decagon 10 72 20 1440
Straight line - 90 4 360
Custom - your Angle derived derived

The root-space reach scales with the total sweep, so a Decagon travels four
whole turns and reaches four times as far as a Circular cycle. Circular and
Square are the same figure - both are the four-sided case.

Custom takes its step straight from the Angle input: set 60 and you get a
Hexagon; leave it at 0 and it falls back to 45.


=== ANGLES, SECONDARY ANGLES AND TIME LEVELS ===

สแนปชอต

Two ways to distribute the levels:

Calculate Angles by Averages ON
Levels spaced EQUALLY IN PRICE. Even ladder, constant gaps.

Calculate Angles by Averages OFF
Levels spaced EQUALLY IN SQRT(PRICE). The gaps shrink steadily as the
cycle descends and grow as it rises - the truer Gann reading.

Main and secondary levels alternate by index: even-numbered levels take the
main style and colour, odd-numbered ones the secondary. Draw Secondary Angles
hides the odd ones on their own.

TIME DIVISIONS - the box is (steps / 2) units wide.
- Solid time levels on 0, 1/4, 1/2, 3/4, 1 of the width.
- Dashed levels on 1/2 +/- {1/10, 1/6, 1/4, 3/10, 1/3} - the very same five
fractions the price levels use, mirrored about the middle of time instead
of the middle of price.


=== THE STAR ===

สแนปชอต

The signature figure: the box frame, its mid vertical and mid horizontal, and
FOURTEEN diagonals - corner to opposite corner, corner to the far side's
middle, corner to the mid vertical's opposite end, and the mid vertical's ends
back to both side middles. Twenty lines that mark every internal crossing of
the range.

INTERNAL PRICE LEVELS - five pairs mirrored about the box centre at
1/10, 1/6, 1/4, 3/10 and 1/3 of the span, drawn dotted with their prices
labelled. The quarter pair lands exactly on the 90 and 270 degree levels.


=== THE GANN GRID ===

Full grid สแนปชอต
Main channel สแนปชอต

A 4 x 4 lattice over the box: the time quarters against the price quarters,
which are the 0/90/180/270/360 degree levels. Every cell carries both of its
diagonals - 32 lines, and nothing else; the grid draws no frame of its own.

Draw only main channel keeps the 1x1 band alone: the diagonal cells keep both
diagonals, the cells directly above and below keep the main one. Fourteen
lines instead of thirty-two.


=== THE GANN FANS ===

1st fan สแนปชอต
2nd fan สแนปชอต
3rd fan สแนปชอต
4th fan สแนปชอต
All four สแนปชอต
Extra Angles สแนปชอต
Extend สแนปชอต

A fan from any of the four corners of the box, each on or off independently.

Every fan carries the nine classic Gann angles - 1x8, 1x4, 1x3, 1x2, 1x1,
2x1, 3x1, 4x1, 8x1. Each ratio is drawn as two lines: one crossing the full
width and landing on that fraction of the price span, one crossing the full
span and landing on that fraction of the width. The 1x1 belongs to both
families, so a fan is ten lines.

- Extra Angles adds 5x8, 8x5, 7x8 and 8x7 - four more lines.
- Extend turns the fan into rays that carry on past the box.


=== THE GANN SQUARE ===

One square สแนปชอต
Tiled squares สแนปชอต

A square of price against time, drawn as the same twenty-line figure the Star
uses, at its own size.

- Box Size is the width in CALENDAR DAYS.
- Height = Box Size x Price Unit.
- Leave Price Unit at 0 and it resolves automatically to one hundred ticks
of the symbol - 10 on a 0.1-tick future, 1 on a 0.01-tick stock.
- Boxes Left / Right / Up / Down tile the identical square in each
direction, so you can carry the grid of squares across the chart.

The square runs the way the cycle runs: down from the anchor on a falling
cycle, up on a rising one.


=== DIRECTION ===

Trend decides which way the cycle travels from the anchor.

- Bullish - up.
- Bearish - down.
- Auto - compares your anchor price with the LAST CLOSE: an anchor above the
market runs down, an anchor below it runs up.


=== EXTENDING THE CYCLE ===

- Extra whole cycle multiplies the walk. On a Circular cycle, 1 takes it
from 360 to 720 degrees and doubles the reach.
- Extra primary angle adds one primary angle - 90 degrees, so two steps. On
a Circular cycle, 1 takes it from 360 to 450 degrees.
- Time space, when set, replaces the First-Level unit with a plain span of
calendar days.


=== STYLING ===

Every family has its own style, width and colour: main angles, secondary
angles, time levels, the star, the star's time levels, the star's price
levels, the grid, the fans and the squares. Label size follows the Size input.


=== NOTES ===

- The two anchor points are interactive inputs. If you edit and recompile
the script, TradingView clears them and asks for the two clicks again.
- The drawing is placed by date, so it keeps the same calendar position
across timeframes.
- On very long sweeps (Decagon, or a large Extra whole cycle) the root can
cross zero and square back up. That is the geometry doing what it is
defined to do, not an error.

คำจำกัดสิทธิ์ความรับผิดชอบ

ข้อมูลและบทความไม่ได้มีวัตถุประสงค์เพื่อก่อให้เกิดกิจกรรมทางการเงิน, การลงทุน, การซื้อขาย, ข้อเสนอแนะ หรือคำแนะนำประเภทอื่น ๆ ที่ให้หรือรับรองโดย TradingView อ่านเพิ่มเติมใน ข้อกำหนดการใช้งาน