Ulcer Index
systemic:core-uiIndicatorsfunction1 crInputs
| Name | Type | Description |
|---|---|---|
| Window | integer | - **Description**: The window parameter represents the number of periods over which the Ulcer Index is calculated. It defines the look-back period for assessing price drawdowns and volatility. |
| Price | floatarray | - **Description**: This refers to the historical price data of the security or asset for which the Ulcer Index is being computed. The price data typically includes daily, weekly, or monthly closing prices. |
Outputs
| Name | Type | Description |
|---|---|---|
| UI | floatarray | - **Description**: The Ulcer Index (UI) itself is the primary output of the Ulcer Index calculation. It measures the degree of drawdown or volatility of an asset's price over a specified window. |
The Ulcer Index measures downside volatility by quantifying the depth and duration of drawdowns. Unlike standard deviation, it focuses exclusively on price declines, making it a true measure of investment pain.
Where = Percentage drawdown from the highest high over the period.
How It Works
flowchart TD
subgraph Input["Price Series"]
P["Closing Prices"]
end
subgraph Calc["Calculation Steps"]
HH["Track rolling highest high"]
DD["Drawdown = (High - Price) / High × 100"]
SQ["Square each drawdown"]
AVG["Average of squared drawdowns"]
SQRT["Square root"]
end
subgraph Output["Result"]
UI["Ulcer Index"]
end
P --> HH --> DD --> SQ --> AVG --> SQRT --> UI
Interpreting UI
| UI Value | Interpretation |
|---|---|
| < 5 | Low stress — shallow drawdowns |
| 5-10 | Moderate drawdown risk |
| 10-20 | Elevated volatility |
| > 20 | High stress — deep/prolonged drawdowns |
flowchart LR
subgraph Stress["Ulcer Index Levels"]
LOW["<5<br/>Low stress"]
MOD["5-10<br/>Moderate"]
HIGH["10-20<br/>Elevated"]
VHIGH[">20<br/>High stress"]
end
LOW --> MOD --> HIGH --> VHIGH
Why Ulcer Index?
Traditional volatility measures (like standard deviation) treat upside and downside equally. But for investors:
| Measure | Captures |
|---|---|
| Standard Deviation | All price movement |
| Ulcer Index | Only drawdown pain |
Most investors don't mind upside volatility — they worry about losses.
Applications
1. Risk Assessment
Compare UI across different assets to identify which have historically caused more investor distress.
2. UPI (Ulcer Performance Index)
A risk-adjusted return metric:
Higher UPI = better return per unit of drawdown pain.
3. Position Sizing
Lower UI assets can warrant larger position sizes in a portfolio.
UI vs Other Risk Metrics
| Metric | Focus | Treats Up/Down |
|---|---|---|
| Ulcer Index | Drawdowns | Downside only |
| Std Dev | All volatility | Equally |
| Max Drawdown | Worst decline | Single event |
| Sortino Ratio | Downside deviation | Downside only |
Advantages
- Investor-aligned — Measures what actually hurts portfolios
- Captures duration — Prolonged drawdowns penalized more
- Risk-adjusted returns — Foundation for UPI metric
- Comparable — Works across asset classes
Disadvantages
- Backward-looking — Based on historical drawdowns
- Period sensitive — Depends on lookback window
- Less known — Not as standard as Sharpe ratio
- Requires high prices — Needs continuous price series
Further Reading
Missing Data
A closed-market or missing-data bar (null) is never fabricated — not padded with 0.0 ("no stress"), not held stale across a gap. The rolling max-drawdown RMS runs over the observed bars only (window-bar UI = window observed bars, weekends bridged), then the result is placed back at the original grid slots:
| Scenario | Output |
|---|---|
| Closed-market gap | None at that slot; the surrounding observed bars bridge the gap as adjacent bars (Friday→Monday), never a stale ffilled UI value |
Warm-up (< window observed bars seen) | None — never the retired 0.0 ("no stress") fill |
| All bars missing | Every slot None, no crash |
| Live tick on a gap slot | [None] — correct and non-starving, not the retired ffilled value |
Indicator Assessment
The following chart positions the Ulcer Index based on its complexity (ease of understanding and implementation) versus reliability (consistency of signals across market conditions). Points closer to the top indicate higher reliability; points to the left indicate lower complexity.
quadrantChart
title Ulcer Index Assessment
x-axis Low Complexity --> High Complexity
y-axis Low Reliability --> High Reliability
quadrant-1 Complex & Reliable
quadrant-2 Simple & Reliable
quadrant-3 Simple & Unreliable
quadrant-4 Complex & Unreliable
Stocks: [0.40, 0.75]
Crypto: [0.40, 0.65]
Assessment Breakdown
| Dimension | Stocks | Crypto | Notes |
|---|---|---|---|
| Popularity | 5/10 | 4/10 | Niche but respected; more common in fund analysis than retail trading |
| Reliability | 7.5/10 | 6.5/10 | Excellent for measuring downside risk; crypto's extreme volatility causes higher UI readings |
| Complexity | 4/10 | 4/10 | Conceptually simple—drawdown squared and averaged; straightforward to interpret |
| Versatility | 6/10 | 5/10 | Excellent for risk comparison and portfolio construction; less applicable as a trading signal |
| Recent Interest | 5/10 | 4/10 | Steady adoption in risk-adjusted analysis; growing interest post-2022 market declines |