# Crypto Stablecoin Supply - Indicator [presentTrading]

█ Introduction and How it is Different

The "Stablecoin Supply - Indicator" differentiates itself by focusing on the aggregate supply of major stablecoins—USDT, USDC, and DAI—rather than traditional price-based metrics. Its premise is that fluctuations in the total supply of these stablecoins can serve as leading indicators for broader market movements, offering traders a unique vantage point to anticipate shifts in market sentiment.

BTCUSD 6h for recent bull market

BTCUSD 8h

█ Strategy, How it Works: Detailed Explanation

🔶 Data Collection
The strategy begins with the collection of the closing supply for USDT, USDC, and DAI stablecoins. This data is fetched using a specified timeframe (**`tfInput`**), allowing for flexibility in analysis periods.

🔶 Supply Calculation
The individual supplies of USDT, USDC, and DAI are then aggregated to determine the total stablecoin supply within the market at any given time. This combined figure serves as the foundation for the subsequent statistical analysis.

🔶 Z-Score Computation
The heart of the indicator's strategy lies in the computation of the Z-Score, which is a statistical measure used to identify how far a data point is from the mean, relative to the standard deviation. The formula for the Z-Score is:

Z = (X - μ) / σ
Where:
- Z is the Z-Score
- X is the current total stablecoin supply (TotalStablecoinClose)
- μ (mu) is the mean of the total stablecoin supply over a specified length (len)
- σ (sigma) is the standard deviation of the total stablecoin supply over the same length

A moving average of the Z-Score (**`zScore_ma`**) is calculated over a short period (defaulted to 3) to smooth out the volatility and provide a clearer signal.

🔶 Signal Interpretation
The Z-Score itself is plotted, with its color indicating its relation to a defined threshold (0.382), serving as a direct visual cue for market sentiment. Zones are also highlighted to show when the Z-Score is within certain extreme ranges, suggesting overbought or oversold conditions.

Bull -> Bear

- **Entry Threshold**: A Z-Score crossing above 0.382 suggests an increase in stablecoin supply relative to its historical average, potentially indicating bullish market sentiment or incoming capital flow into cryptocurrencies.
- **Exit Threshold**: Conversely, a Z-Score dropping below -0.382 may signal a reduction in stablecoin supply, hinting at bearish sentiment or capital withdrawal.

█ Usage

Traders can leverage the "Stablecoin Supply - Indicator" to gain insights into the underlying market dynamics that are not immediately apparent through price analysis alone. It is particularly useful for identifying potential shifts in market sentiment before they are reflected in price movements. By integrating this indicator with other technical analysis tools, traders can develop a more rounded and informed trading strategy.

█ Default Settings

- Timeframe Input (`tfInput`): Allows users to specify the timeframe for data collection, adding flexibility to the analysis.
- Z-Score Length (`len`): Set to 252 by default, representing the period over which the mean and standard deviation of the stablecoin supply are calculated.
- Color Coding: Uses distinct colors (green for bullish, red for bearish) to indicate the Z-Score's position relative to its thresholds, enhancing visual clarity.
- Extreme Range Fill: Highlights areas between defined high and low Z-Score thresholds with distinct colors to indicate potential overbought or oversold conditions.

By integrating considerations of stablecoin supply into the analytical framework, the "Stablecoin Supply - Indicator" offers a novel perspective on cryptocurrency market dynamics, enabling traders to make more nuanced and informed decisions.