Coefficient of Variation
The Coefficient of Variation (CV) node computes (population std / |mean|) × 100 over the rolling window. CV is a normalized volatility measure — a CV of 20% means the typical spread is 20% of the average value. Because it divides by the mean, CV allows direct volatility comparison between assets with very different price levels. Returns null when the mean is zero.
Algorithm
- ▸Compute mean (μ) and population std (σ) of non-null window values
- ▸output = (σ / |μ|) × 100
- ▸Returns null when μ = 0 or fewer than 2 non-null values
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
| period | number | 20 | Rolling window size. |
Inputs & Outputs
| Port | Type | Description |
|---|---|---|
| Inputs | ||
| input | number[] | Source numeric array |
| Outputs | ||
| values | number | null | Computed value at each bar; null before the warmup period completes |
| timestamps | number[] | Bar timestamps (UNIX ms), aligned 1-to-1 with values |
Use Cases
Cross-Asset Volatility Comparison
CV enables comparing the relative volatility of a $10 stock with a $1000 stock without needing to normalize prices first.
Regime Filter
CV above a threshold (e.g., 5%) signals a high-volatility regime; below signals low-volatility compression — useful for switching between strategy modes.
Position Sizing Adjuster
Use 1/CV as a volatility-adjusted position size multiplier to maintain equal risk across different assets and regimes.