INVITE-ONLY SCRIPT
Aggiornato

TT Square of 9 Inner

280
Display price and time lines derived from WD Gann's Square of 9.

The Square of 9 is an infinite sequence of numbers arranged in a clockwise pattern around a square.

This can be used to calculate price and time lines based on the angle of the price or time value relative to the center cell.

Adding to a Chart
After adding the script to your chart, you are prompted to confirm the price and time to anchor the indicator to. Click on a major pivot high or low price to get the best results.

Anchor Point

The anchor time and price identify where the script starts counting time and price from. You can change it on the Settings dialog, or by right-clicking the indicator on the chart and choosing 'Reset Points'.

Price Lines

Price Lines display horizontal lines at specific prices, relative to the anchor price, and are calculated based on the following inputs:

Price per Cell is used to scale the Square of 9 and allows it to work on both low priced securities like SHIB and high priced assets like $BTC.

The price of the security divided by the price per cell should be in the 3-4 digit range.

For example Bitcoin (currently +/- $100,000) should have a price per cell of around 100, because 100,000 / 100 = 1,000 which is 4 digits. There is no hard and fast rule here. You could use 50 or 200 depending on your use case.

Price Angles allow you to choose how many lines to show with each lap that price makes around the Square of 9.
  • 0° prices shows a price line with every completed cycle around the Square of 9.
  • 180° prices shows a price line with every half cycle around the Square of 9.
  • 120° and 240° prices shows a price line with every 1/3 of a cycle around the Square of 9.
  • 90° and 270° prices shows a price line with every 1/4 of a cycle around the Square of 9.


To get more price lines on the chart, reduce the Price Per Cell.
To get fewer price lines on the chart, increase the Price Per Cell.

This is an example of price lines effectively identifying support and resistance levels, anchored to the low of the lowest wick. The red (0°) and yellow (180°) lines identify good support/resistance lines.

Time Lines

Time Lines are more complex than price lines because there are multiple ways to count time, whereas there's only one way to count price.

Time Lines display vertical lines at calculated based on the following inputs:

  • 0° times shows a time line with every completed Square of 9 cycle that the selected Time Factors make.
  • 180° times show a time line with every half-cycle around the Square of 9 for the selected Time Factors.
  • 120° and 240° times show a time line with every 1/3 of a cycle around the Square of 9.
  • 90° and 270° times show a time line with every 1/4 of a cycle around the Square of 9.


Time Factors

Time Factors are used to measure time.

This script supports the following time factors:

  • Calendar Days: The number of calendar days from the anchor point.
  • Weeks: The number of weeks from the anchor point.
  • Ascendant: The degrees of movement of the ascendant at the specified location from the anchor point.
  • Sidereal Moon: The degrees of movement of the Moon relative to the background stars (sidereal) from the anchor point.
  • Synodic Moon: The degrees of movement of the Moon relatie to the Sun (Moon/Sun Synodic) from the anchor point. This is the same as the lunar phase.
  • Mercury Helio: The degrees of movement of heliocentric Mercury from the anchor point.
  • Venus Helio: The degrees of movement of heliocentric Venus from the anchor point.
  • Sun: The degrees of movement of the Sun from the anchor point.
  • Mars Helio: The degrees of movement of heliocentric Mars from the anchor point.
  • Mercury/Venus Synodic: The degrees of movement of the Mercury/Venus synodic pair from the anchor point.
  • Mercury/Earth Synodic: The degrees of movement of the Mercury/Earth synodic pair from the anchor point.
  • Mercury/Mars Synodic: The degrees of movement of the Mercury/Mars synodic pair from the anchor point.
  • Venus/Earth Synodic: The degrees of movement of the Venus/Earth synodic pair from the anchor point.
  • Venus/Mars Synodic: The degrees of movement of the Venus/Mars synodic pair from the anchor point.
  • Earth/Mars Synodic: The degrees of movement of the Earth/Mars synodic pair from the anchor point.


Use time lines to look for potential changes in trend around those times.

Troubleshooting

Missing Price Lines

Sometimes you will notice price lines are missing. This usually means that the Price per Cell is too large. For example, you may have a Price per Cell of 1 for a security that trades at $1.50. You can solve this by ensuring the security price divided by Price per Cell has 3 or 4 digits. So in this example, change Price per Cell to 0.001

Another explanation for missing price lines is that no price lines are selected. You'll need to select at least one of the 4 price line options to see a price line.

Missing Time Lines

If all time lines are missing, that could be due to the following reasons:
* No time lines are selected.
* The time line selected doesn't align with the chart timeframe. For example if you choose a slow time line like 'Weeks' for an intraday chart, you likely won't see a line.

Uneven Price Lines

Price lines are drawn based on the progress of price around the square of 9, and the size of the square increases as price increases. So the distance between price lines will increase as price goes up, and decrease as price goes down.

This is expected behaviour.

Uneven Time Lines

Time lines are drawn based on the progress of time (calendar days, weeks, or degrees) around the square of 9, and the size of the square increases as price increases. Plus some of the time factors are elliptical like the Ascendant (moves faster during some parts of the day than others), and Mercury. This fact combined with the increasing size of the square of 9 can make the time lines appear asymmetric with some closer and others farther apart.

This is expected behaviour.

Runtime Error

You will occasionally see a runtime error like below:

This happens when a Square of 9 indicator is anchored to a point say 6 months ago, and you drop down to a 4 minute chart. There's simply too many bars between the anchor point and the current point in time.

To workaround this issue, change your chart interval to a higher timeframe like 30 minutes or 4 hours to reduce the number of bars the script needs to analyze.
Note di rilascio
Minor performance updates.
Note di rilascio
Fix bug when the most recent bar sets an ATH.
Note di rilascio
Fix bug affecting the line style of price lines.
Note di rilascio
Add more price lines below the lowest price.
Note di rilascio
Add more price lines above the highest high and below the lowest low.
Note di rilascio
Add seconds, minutes, and hours as time factors.
Note di rilascio
Add optional labels to identify square out points.
Note di rilascio
Performance improvements
Note di rilascio
Use optimized Moon library
Note di rilascio
Correct bug affecting the display of the square out points when the anchor point is not visible on the chart.
Note di rilascio
Correct bug preventing the display of synodic time factors.
Note di rilascio
Add bar count as a supported time factor
Display the time factor values and Square of 9 angles in the Data Window
Note di rilascio
Correct error by upgrading the Venus helio library to v6
Note di rilascio
Update method of drawing future time lines.
Note di rilascio
Update to calculate square of 9 time bars based on the timestamp of the end time of the bar.
Note di rilascio
Correct issue with counting degrees on the first bar.
Note di rilascio
Correct bug in calculating calendar days and calendar weeks.
Note di rilascio
Correct issue with bar count time factor.
Note di rilascio
Use the latest Moon library with a minor calculation correction.
Note di rilascio
Update with data through 2026

Declinazione di responsabilità

Le informazioni ed i contenuti pubblicati non costituiscono in alcun modo una sollecitazione ad investire o ad operare nei mercati finanziari. Non sono inoltre fornite o supportate da TradingView. Maggiori dettagli nelle Condizioni d'uso.