OPEN-SOURCE SCRIPT

Kurdistani Bitcoin Spiral - Historical Logarithmic Visualization

338
Kurdistani Bitcoin Spiral — Live Historical Logarithmic Visualization

Overview

Bitcoin Spiral is an interactive visualization of Bitcoin's complete historical price evolution, displayed as a logarithmic spiral.

Each calendar year corresponds to one full revolution around the center, while the distance from the center represents price on a logarithmic (log10) scale. This allows more than sixteen years of Bitcoin history to be explored within a single, compact chart.

Although logarithmic spiral representations of Bitcoin have appeared as static illustrations for years, this indicator brings the concept to TradingView as a fully interactive Pine Script implementation with live updates, configurable visualization layers, and efficient rendering.

This indicator is intended for historical exploration, education, and visual analysis. It is **not** a forecasting model, does **not** predict future prices, and does **not** generate buy or sell signals.

---

Features

• Complete Bitcoin history from the 2009 Genesis Block through the present in a single spiral.

• Historical Halving events displayed as ring-and-dot markers.

• Major cycle bottoms highlighted with diamond markers.

• Historical All-Time Highs shown as comet-style trails that illustrate each rally into its peak.

• Live **Now** marker using `request.security()` with a user-selectable data source (default: Bitstamp:BTCUSD).

• Optional real-time continuation connecting the curated historical backbone to the latest market price.

• Current calendar year highlighted with an eased radial gradient wedge.

• Logarithmic price grid from **$1** to **$1M**.

• Eight year spokes with four emphasized calendar axes.

• Fully configurable colors, visibility, density, line widths, glow effects, and background.

• Compact legend matching the actual marker shapes used on the chart.

---

How It Works

The indicator is generated from a manually curated historical backbone consisting of approximately one hundred reference keyframes.

Each keyframe stores an approximate historical time and price.

For any intermediate date, price is calculated using logarithmic interpolation between the two nearest keyframes. The lookup uses binary search over the sorted keyframe table, providing efficient O(log n) performance.

Each *(time, price)* pair is converted into polar coordinates:

* **Angle** represents the position within the calendar year.
* **Radius** represents the logarithm of price.

The resulting coordinates are transformed into TradingView chart coordinates using `polyline.new()`, `line.new()`, and `label.new()`.

When the historical backbone ends, an optional live continuation extends the visualization using the latest available daily close from the selected market symbol.

For performance reasons, the historical visualization is rendered only once. During realtime updates, only the live marker, live continuation, and (if applicable) a new live ATH marker are updated.

---

Curated Data vs Live Data

### Curated Historical Data

The following elements are manually maintained and remain fixed until the script is updated:

* Historical spiral
* Halving markers
* Major cycle bottoms
* Historical ATH markers
* ATH run-up trails

These elements are derived from the embedded historical keyframe dataset.

### Live Data

Only the following components update with incoming market data:

* Live "Now" marker
* Optional live continuation
* Live ATH marker (when price exceeds the latest curated ATH)

No historical data is modified or overwritten.

---

Reading the Spiral

The spiral is designed to emphasize Bitcoin's long-term structure rather than day-to-day price fluctuations.

* Angle indicates where a point falls within its calendar year.
* Radius represents price on a logarithmic scale.
* Equal radial spacing represents equal percentage changes rather than equal dollar changes.
* The highlighted wedge identifies the current calendar year.
* ATH comet trails visualize the acceleration leading into historical market peaks.

The chart is intended to help explore long-term market structure, historical cycles, and price evolution—not to predict future market behavior.

---

Engineering Notes

Version 5 focuses primarily on architecture, performance, and maintainability.

Key improvements include:

* Binary-search price lookup replacing linear scans.
* Unified marker rendering through a single reusable function.
* Centralized logarithmic radius mapping.
* Improved eased radial gradient for the current-year wedge.
* More maintainable rendering architecture for both static and live objects.

The historical dataset currently remains embedded inside the script.

The preferred long-term architecture is to publish the dataset as a separate Pine Library and import it into the indicator. The current implementation is already organized so that such a migration would require changes only within the data section.

---

Current Pine Script Limitations

Some visual behaviors are limited by the current Pine Script rendering engine rather than by the indicator itself.

These include:

* Perfect zoom-independent circular geometry is not possible because the horizontal axis is based on bar indices while the vertical axis represents price values.

* Pine Script does not provide access to viewport dimensions, zoom level, or aspect ratio, preventing automatic geometric correction.

* No visible-range API exists for dynamic label placement or clipping.

* Objects using `xloc.bar_index` cannot be positioned more than approximately 500 bars into the future, limiting outward label placement.

These are platform limitations rather than implementation limitations.

---

Future Development

Possible future improvements include:

* Migrating the historical dataset into a dedicated Pine Library.

* Extending the curated historical backbone as Bitcoin continues to evolve.

* Automatic cycle-bottom detection if a reliable forward-looking methodology becomes available.

* Additional structural refinements as Pine Script evolves.

---

Usage

Every visual layer can be enabled or disabled independently, including:

* Grid
* Year spokes
* Current-year wedge
* ATH markers
* Bottom markers
* Halvings
* Legend
* Background
* Glow effects

Colors, line widths, density, and the live data source are fully configurable.

---

Disclaimer

This indicator visualizes Bitcoin's historical price evolution using a logarithmic spiral coordinate system.

It is intended solely for visualization, historical exploration, and educational purposes.

It does **not** predict future prices, does **not** imply future cycle repetition, and should **not** be used as the sole basis for investment or trading decisions.

Past market behavior, including historical cycle geometry, is **not** indicative of future results.

Declinazione di responsabilità

Le informazioni e le pubblicazioni non sono intese come, e non costituiscono, consulenza o raccomandazioni finanziarie, di investimento, di trading o di altro tipo fornite o approvate da TradingView. Per ulteriori informazioni, consultare i Termini di utilizzo.