Ulcer Index (UI)

Parameters: period = 14 (5–100)

Overview

The Ulcer Index uniquely focuses on downside risk, recognizing that investors experience stress from losses rather than gains—hence the name suggesting "stomach ulcers" from market stress. Originally designed for mutual fund analysis, the indicator calculates the root mean square of percentage drawdowns from the highest closing price over a specified period. This approach provides a single value that represents both the magnitude and persistence of price declines, making it particularly valuable for risk-averse investors and portfolio managers seeking to quantify downside exposure.

The calculation involves measuring each period's percentage decline from the highest close within the lookback window, squaring these values to emphasize larger drawdowns, averaging them, and taking the square root. A 14-day Ulcer Index near zero indicates the price is consistently making new highs, while higher values signal increasing drawdown risk. This methodology creates an indicator that rises during market declines and falls during advances, providing a clear measure of the "pain" investors might experience from holding a position.

Interpretation & Trading Signals

Risk Assessment Levels:

  • Low UI (Near 0): Price regularly making new highs, minimal drawdown risk
  • Rising UI: Increasing drawdown depth or duration, growing risk
  • High UI: Significant downside volatility, potential stress on positions
  • Peak UI: Maximum drawdown reached, possible reversal opportunity

Trading Applications:

  • Contrarian Signal: Extreme UI spikes may indicate oversold conditions
  • Position Sizing: Reduce exposure when UI rises above normal levels
  • Market Timing: Enter positions when UI drops from elevated levels
  • Risk Management: Use UI thresholds for stop-loss or hedging decisions

Portfolio Management:

  • Asset Comparison: Lower UI indicates more stable price behavior
  • Risk-Adjusted Returns: Use UI to create Ulcer Performance Index (UPI)
  • Long-term Analysis: 50-day UI for strategic allocation decisions
  • Combine with Momentum: Use with RSI or MACD for confirmation

Example Usage

Code examples will be available once the Rust implementation is complete.

Performance Analysis

Related Indicators