PROTECTED SOURCE SCRIPT

NUPL Z-Score | Vistula Labs

162
What is NUPL?
NUPL (Net Unrealized Profit/Loss) is a fundamental on-chain metric used to evaluate the profit or loss state of a cryptocurrency's market participants, such as Bitcoin (BTC) and Ethereum (ETH). It compares the current market capitalization—the total value of all coins at their current price—to the realized capitalization, which represents the average price at which all coins were last transacted on-chain.
  • Market Capitalization: Current price × circulating supply.
  • Realized Capitalization: The sum of the value of all coins based on the price at their last on-chain movement.


For Bitcoin (BTC):
NUPL = (Market Cap - Realized Cap) / Market Cap * 100

For Ethereum (ETH):
NUPL = (Market Cap - Realized Cap) / Market Cap

A positive NUPL indicates that the market holds unrealized profits, meaning the current value exceeds the price at which coins were last moved. A negative NUPL signals unrealized losses. Extreme NUPL values—high positives or low negatives—can suggest overvaluation (potential market tops) or undervaluation (potential market bottoms), respectively.

How NUPL is Calculated for BTC & ETH
This indicator calculates NUPL using data sourced from Glassnode and CoinMetrics:
For Bitcoin:
  • Market Cap: GLASSNODE:BTC_MARKETCAP
  • Realized Cap: COINMETRICS:BTC_MARKETCAPREAL
  • Formula: ((btc_market_cap - btc_market_cap_real) / btc_market_cap) * 100

For Ethereum:
  • Market Cap: GLASSNODE:ETH_MARKETCAP
  • Realized Cap: COINMETRICS:ETH_MARKETCAPREAL
  • Formula: ((eth_market_cap - eth_market_cap_real) / eth_market_cap) * 100


The indicator then transforms these NUPL values into a Z-Score, which measures how many standard deviations the current NUPL deviates from its historical average. The Z-Score calculation incorporates:
  • A customizable moving average of NUPL (options: SMA, EMA, DEMA, RMA, WMA, VWMA) over a user-defined length (default: 220 periods).
  • The standard deviation of NUPL over a specified lookback period (default: 200 periods).


Z-Score Formula:
Z-Score = (Current NUPL - Moving Average of NUPL) / Standard Deviation of NUPL

This normalization allows the indicator to highlight extreme market conditions regardless of the raw NUPL scale.

How This Indicator Can Be Used

Trend Following
The NUPL Z-Score indicator employs a trend-following system with adjustable thresholds to generate trading signals:
  • Long Signals: Triggered when the Z-Score crosses above the Long Threshold (default: 0.26).
  • Short Signals: Triggered when the Z-Score crosses below the Short Threshold (default: -0.62).


Visual Representations:

Green up-triangles: Indicate long entry points (plotted below the bar).
Red down-triangles: Indicate short entry points (plotted above the bar).
Color-coded elements:
Candles and Z-Score plot turn teal (#00ffdd) for long positions.
Candles and Z-Score plot turn magenta (#ff00bf) for short positions.


These signals leverage historical NUPL trends to identify potential momentum shifts, aiding traders in timing entries and exits.

Overbought/Oversold Conditions
The indicator flags extreme market states using additional thresholds:
  • Overbought Threshold (default: 3.0): When the Z-Score exceeds this level, the market may be significantly overvalued, hinting at potential selling pressure. Highlighted with a light magenta background (#ff00bf with 75% transparency).
  • Oversold Threshold (default: -2.0): When the Z-Score drops below this level, the market may be significantly undervalued, suggesting buying opportunities. Highlighted with a light teal background (#00ffdd with 75% transparency).


These extreme Z-Score levels have historically aligned with major market peaks and troughs, making them useful for medium- to long-term position management.

Customization Options
Traders can tailor the indicator to their preferences:
  • Cryptocurrency Source: Choose between BTC or ETH.
  • Moving Average Type: Select from SMA, EMA, DEMA, RMA, WMA, or VWMA.
  • Moving Average Length: Adjust the period for the NUPL moving average (default: 220).
  • Z-Score Lookback Period: Set the historical window for Z-Score calculation (default: 200).
  • Thresholds: Fine-tune values for: Long Threshold (default: 0.26), Short Threshold (default: -0.62), Overbought Threshold (default: 3.0), Oversold Threshold (default: -2.0)


These options enable users to adapt the indicator to various trading strategies and risk profiles.

Alerts
The indicator supports four alert conditions to keep traders informed:
  • NUPL Long Opportunity: Alerts when a long signal is triggered.
  • NUPL Short Opportunity: Alerts when a short signal is triggered.
  • NUPL Overbought Condition: Alerts when the Z-Score exceeds the overbought threshold.
  • NUPL Oversold Condition: Alerts when the Z-Score falls below the oversold threshold.


These alerts allow traders to monitor key opportunities without constantly watching the chart.

Thông báo miễn trừ trách nhiệm

Thông tin và ấn phẩm không có nghĩa là và không cấu thành, tài chính, đầu tư, kinh doanh, hoặc các loại lời khuyên hoặc khuyến nghị khác được cung cấp hoặc xác nhận bởi TradingView. Đọc thêm trong Điều khoản sử dụng.