# Ulcer Index

Ulcer Index is an indicator on [Vela](https://vela.luxalgo.com/chart), our next-generation charting platform, written in Pine Script®.

Plots the Ulcer Index, squaring each bar's percentage drawdown from the running high across a 14-bar window and rooting the averaged result, as a gradient-filled line with a dashed alert threshold at 5.0 and an optional Drawdown % column plot. Four alerts cover threshold crosses in both directions, fresh drawdowns and reclaimed highs, for traders who define risk as time spent underwater.

- Indicator in the LuxAlgo Library, by LuxAlgo, published Apr 11, 2026.
- Access: free.
- Concepts: [Ulcer Index](https://www.luxalgo.com/library/concept/ulcer-index/) (primary)
- Open on Vela: https://vela.luxalgo.com/chart?pineScriptCodeId=gheyhkn9kb45mutbzsvjrs7d
- Page: https://www.luxalgo.com/library/indicator/ulcer-index/

**Ulcer Index** turns drawdown pain into a single plotted number, the library's first faithful build of the classic construction. Across a rolling window, each bar's percentage decline from the window's running high is squared, the squares averaged and the result rooted, so both how deep and how long price sits underwater feed the reading. The [Ulcer Index](https://www.luxalgo.com/library/concept/ulcer-index/) line rises over a gradient fill anchored at zero, a dashed line marks the alert threshold, and an optional column plot exposes the raw drawdowns being averaged.

## How to Trade the Ulcer Index?

- **Rising line**: drawdowns are deepening, lengthening or both. Holding stress is building even when individual bars bounce.
- **Threshold crosses**: crossing above the dashed Alert Threshold flags elevated drawdown stress, crossing back below flags easing; both directions carry alerts.
- **Drawdown % columns**: the optional plot shows the current decline from the window high (zero at fresh highs, negative below them), and the Drawdown Started and Lookback High Reclaimed alerts fire on exactly those transitions.

Readings are always positive: this is a risk meter, not a direction signal.

## Ulcer Index Settings

- **Length** (default 14): the lookback window. Short windows track tactical stress; fund-style analysis runs far longer ones.
- **Source** (default close): the series the drawdowns are measured on.
- **Alert Threshold** (default 5.0): the dashed reference level. Readings scale with the instrument and the window, so set the level against the symbol's own history.
- Style: **Gradient Fill** (default on) and **Drawdown %** (default off) toggle the optional layers.

## Frequently Asked Questions

### Why use the Ulcer Index instead of standard deviation?

[Standard Deviation](https://www.luxalgo.com/library/indicator/standard-deviation/) charges every fluctuation as risk, including rallies to new highs. The Ulcer Index only registers bars trading below a prior peak and squares the declines, so it matches how holding through a drawdown actually feels.

### What is a sensible Alert Threshold?

There is no universal number: the reading scales with both the window and the instrument. Study the index's own range on the symbol and timeframe you trade and place the threshold where past readings marked genuinely stressed stretches.

### Why does the index stay elevated after price makes a new high?

The current drawdown resets to zero the bar a high is reclaimed, but the window still averages the declines that came before it, decaying over the next Length bars. That memory is deliberate: a market that just spent weeks underwater carried more risk than one that never dipped.

## Related indicators

- [Hot Zone Radar](https://www.luxalgo.com/library/indicator/hot-zone-radar/) (Volatility Percentile/rank): markdown at https://www.luxalgo.com/library/indicator/hot-zone-radar.md
- [Volatility Signature Plot](https://www.luxalgo.com/library/indicator/volatility-signature-plot/) (Volatility): markdown at https://www.luxalgo.com/library/indicator/volatility-signature-plot.md
- [The Range Indicator](https://www.luxalgo.com/library/indicator/the-range-indicator/) (Volatility): markdown at https://www.luxalgo.com/library/indicator/the-range-indicator.md
- [Jump Detection](https://www.luxalgo.com/library/indicator/jump-detection/) (Volatility): markdown at https://www.luxalgo.com/library/indicator/jump-detection.md
- [Volatility of Volatility](https://www.luxalgo.com/library/indicator/volatility-of-volatility/) (Volatility): markdown at https://www.luxalgo.com/library/indicator/volatility-of-volatility.md
- [Garman-Klass–Yang-Zhang Hybrid](https://www.luxalgo.com/library/indicator/garman-klass-yang-zhang-hybrid/) (Volatility): markdown at https://www.luxalgo.com/library/indicator/garman-klass-yang-zhang-hybrid.md
- [GARCH-family Clustering](https://www.luxalgo.com/library/indicator/garch-family-clustering/) (Volatility): markdown at https://www.luxalgo.com/library/indicator/garch-family-clustering.md
- [Kase Studies](https://www.luxalgo.com/library/indicator/kase-studies/) (Volatility): markdown at https://www.luxalgo.com/library/indicator/kase-studies.md

---

Source: https://www.luxalgo.com/library/indicator/ulcer-index/ (LuxAlgo Library). Free to use with attribution: https://www.luxalgo.com/library/license/
