OPEN-SOURCE SCRIPT

Bitcoin CAGR Analysis | Astral Vision

386
Bitcoin CAGR Analysis | Astral Vision 🌠💠

The Compound Annual Growth Rate expresses Bitcoin's return over any rolling window as an annualized percentage, normalizing for the length of the period being measured.
Unlike raw percentage returns, CAGR makes every rolling window directly comparable regardless of its duration, a 6-month and a 2-year window both output an annualized rate, allowing the current growth pace to be read in consistent units across the entire price history.

This indicator computes rolling CAGR over a configurable lookback, then offers two analytical layers.
Raw CAGR plots the annualized return directly, revealing how Bitcoin's structural growth rate has evolved across cycles.
Z-Score mode standardizes the CAGR against its own rolling distribution, identifying when the current annualized return is statistically extreme relative to historical norms, either overheated or deeply compressed.
A slope-based trend mode colors by whether CAGR is accelerating or decelerating over a secondary lookback, independent of absolute level.

Calculation ⚙️

`CAGR = (close / close[length])^(365 / days elapsed) − 1`

Days elapsed is derived from the actual timestamp difference rather than a fixed bar count, ensuring accuracy regardless of gaps or non-trading days in the data.

`Z-Score = (CAGR − SMA(CAGR, length)) / StdDev(CAGR, length)`

In Trend mode, the slope is computed as the difference between the current value and its value N bars ago, coloring by whether the CAGR (or its Z-Score) is rising or falling irrespective of its absolute level.

Plots 📊
  • CAGR or Z-Score line in the indicator panel, colored by active regime
  • Zero baseline
  • High and low threshold lines in Z-Score Extremes mode
  • Fill between the signal line and the breached threshold in Z-Score Extremes mode
  • Candle coloring on the price chart by active regime (Z-Score modes only)
  • Background highlight on the price chart when a threshold is breached in Z-Score Extremes mode


Inputs 🎛️
  • `Mode`: Raw CAGR (annualized return) or Z-Score (standardized CAGR)
  • `Visualization`: Extremes (threshold-based coloring) or Trend (slope-based directional coloring)
  • `Z-Score Length`: rolling window for both CAGR calculation and Z-Score normalization (default 730)
  • `Threshold High`: Z-Score level marking overheated growth (default 3.0)
  • `Threshold Low`: Z-Score level marking compressed or negative growth (default −1.5)
  • `Slope Length`: bar offset used to compute CAGR acceleration in Trend mode (default 34)
  • `Show Background`: toggles price chart background highlighting at Z-Score extremes


Colors 🎨

5 Astral Vision presets + custom override. Default: Infinito. In Extremes mode, positive color activates below the low threshold and negative above the high threshold. In Trend mode, positive color applies when the signal is rising and negative when falling. Raw CAGR mode uses positive color throughout.

Purpose 🎯

Raw price charts and standard momentum indicators express returns as absolute price levels or bounded oscillators, neither of which answers the question of what annualized return Bitcoin is currently delivering relative to its own historical pace.

CAGR makes that question answerable directly.
The Z-Score layer adds statistical context: rather than judging whether a 200% annualized return is "high" by intuition, the Z-Score places it in the distribution of all historical CAGR values over the same window, making the assessment rigorous and cycle-independent.
The Trend visualization mode repurposes the same calculation as a momentum direction indicator, identifying inflection points in the growth rate before they become obvious in price. The two modes together cover both valuation positioning and tactical momentum within a single indicator.

Disclaimer ⭕️

It is not financial advice, not an investment recommendation, and not affiliated with any financial institution, research firm, or organization of any kind. All content is provided for educational and informational purposes only. Always conduct your own research before making any financial decision.

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

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