OPEN-SOURCE SCRIPT
Bitcoin Yardstick Valuation And Trend | Astral Vision

Bitcoin Yardstick Valuation and Trend | Astral Vision 🌠💠
The Bitcoin Yardstick divides market capitalization by hashrate, producing a ratio that expresses how much the market is paying per unit of computational security the network provides.
When this ratio is elevated, Bitcoin is expensive relative to the mining power securing it, a condition historically associated with speculative excess.
When compressed, the market is undervaluing the network relative to its security infrastructure, historically marking accumulation opportunities.
This indicator standardizes the Yardstick in log space over a rolling window, producing a Z-Score that makes cycle-to-cycle comparisons statistically rigorous regardless of Bitcoin's absolute price or the long-term growth of hashrate.
Two visualization modes expose different analytical perspectives on the same signal:
Calculation ⚙️
`Yardstick = Market Cap / Hashrate`
`Z-Score = (log(Yardstick) − SMA(log(Yardstick), window)) / StdDev(log(Yardstick), window)`
The Z-Score is then smoothed with a 50-bar EMA for the Trend mode, and its slope is computed over a configurable lookback to determine directional momentum.
Plots 📊
Inputs 🎛️
Colors 🎨
5 Astral Vision presets + custom override for Trend mode. Default: Paradiso. In Extremes mode, a fixed independent color scale applies: orange at +2σ, red at +3σ, blue at −2σ. In Trend mode, positive color applies when the EMA slope is rising and negative when falling.
Purpose 🎯
Standard Yardstick implementations plot the raw ratio as an absolute value, which grows monotonically over time as both market cap and hashrate expand, making visual cycle comparison across different price epochs unreliable.
Log transformation and Z-Score standardization solve this by expressing the current ratio purely as a deviation from its own rolling norm, keeping every cycle on the same statistical scale.
The dual-mode structure separates two distinct use cases: Extremes is suited for identifying macro cycle tops and bottoms where the Yardstick has reached historically rare territory, while Trend provides an earlier directional signal based on the momentum of the smoothed Z-Score before any threshold is breached.
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.
The Bitcoin Yardstick divides market capitalization by hashrate, producing a ratio that expresses how much the market is paying per unit of computational security the network provides.
When this ratio is elevated, Bitcoin is expensive relative to the mining power securing it, a condition historically associated with speculative excess.
When compressed, the market is undervaluing the network relative to its security infrastructure, historically marking accumulation opportunities.
This indicator standardizes the Yardstick in log space over a rolling window, producing a Z-Score that makes cycle-to-cycle comparisons statistically rigorous regardless of Bitcoin's absolute price or the long-term growth of hashrate.
Two visualization modes expose different analytical perspectives on the same signal:
- "Extremes" identifies statistically significant deviations from the mean with color-coded severity levels.
- "Trend" tracks the direction of the smoothed signal's slope to identify momentum shifts before they reach extreme territory.
Calculation ⚙️
`Yardstick = Market Cap / Hashrate`
`Z-Score = (log(Yardstick) − SMA(log(Yardstick), window)) / StdDev(log(Yardstick), window)`
The Z-Score is then smoothed with a 50-bar EMA for the Trend mode, and its slope is computed over a configurable lookback to determine directional momentum.
Plots 📊
- Z-Score line in the indicator panel with threshold fills at +2σ, +3σ and −2σ (Extremes mode)
- Smoothed EMA of the Z-Score (Trend mode)
- +3σ, +2σ, −2σ reference lines and zero mean line (Extremes mode)
- Candle coloring on the price chart by active regime in both modes
- Background highlight on the price chart at +3σ and −2σ extremes (Extremes mode)
Inputs 🎛️
- `Z-Score Window (bars)`: rolling lookback for mean and standard deviation calculation
- `Slope Length`: bar offset for EMA slope computation in Trend mode
- `Visualization Mode`: Extremes (threshold-based severity coloring) or Trend (slope-based directional coloring)
Colors 🎨
5 Astral Vision presets + custom override for Trend mode. Default: Paradiso. In Extremes mode, a fixed independent color scale applies: orange at +2σ, red at +3σ, blue at −2σ. In Trend mode, positive color applies when the EMA slope is rising and negative when falling.
Purpose 🎯
Standard Yardstick implementations plot the raw ratio as an absolute value, which grows monotonically over time as both market cap and hashrate expand, making visual cycle comparison across different price epochs unreliable.
Log transformation and Z-Score standardization solve this by expressing the current ratio purely as a deviation from its own rolling norm, keeping every cycle on the same statistical scale.
The dual-mode structure separates two distinct use cases: Extremes is suited for identifying macro cycle tops and bottoms where the Yardstick has reached historically rare territory, while Trend provides an earlier directional signal based on the momentum of the smoothed Z-Score before any threshold is breached.
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.
Mã nguồn mở
Theo đúng tinh thần TradingView, tác giả của tập lệnh này đã công bố nó dưới dạng mã nguồn mở, để các nhà giao dịch có thể xem xét và xác minh chức năng. Chúc mừng tác giả! Mặc dù bạn có thể sử dụng miễn phí, hãy nhớ rằng việc công bố lại mã phải tuân theo Nội quy.
My premium indicators are available on Whop:
whop.com/astralvision
Astral Vision 🌠💠
whop.com/astralvision
Astral Vision 🌠💠
Thông báo miễn trừ trách nhiệm
Thông tin và các ấn phẩm này không nhằm mục đích, và không cấu thành, lời khuyên hoặc khuyến nghị về tài chính, đầu tư, giao dịch hay các loại khác do TradingView cung cấp hoặc xác nhận. Đọc thêm tại Điều khoản Sử dụng.
Mã nguồn mở
Theo đúng tinh thần TradingView, tác giả của tập lệnh này đã công bố nó dưới dạng mã nguồn mở, để các nhà giao dịch có thể xem xét và xác minh chức năng. Chúc mừng tác giả! Mặc dù bạn có thể sử dụng miễn phí, hãy nhớ rằng việc công bố lại mã phải tuân theo Nội quy.
My premium indicators are available on Whop:
whop.com/astralvision
Astral Vision 🌠💠
whop.com/astralvision
Astral Vision 🌠💠
Thông báo miễn trừ trách nhiệm
Thông tin và các ấn phẩm này không nhằm mục đích, và không cấu thành, lời khuyên hoặc khuyến nghị về tài chính, đầu tư, giao dịch hay các loại khác do TradingView cung cấp hoặc xác nhận. Đọc thêm tại Điều khoản Sử dụng.