indicator · own pane · open source
Ulcer Index indicator
Ulcer Index is a free open-source indicator by @deepwick. Ulcer Index measures depth and duration of drawdowns from the rolling high — designed to… Deepwick Script runs a subset of Pine Script.
Running…
Loading chart…
What Ulcer Index does
Ulcer Index measures depth and duration of drawdowns from the rolling high — designed to capture how painful the ride was, not just how volatile.
- Rises during prolonged declines, falls during recoveries.
- Common alternative to StdDev for risk-adjusted return ratios (Ulcer Performance Index).
Source code
Deepwick Script, a subset of Pine Script · read-only
//@version=6
indicator("Ulcer Index", overlay=false)
len = input.int(14, "Lookback", minval=2, maxval=200)
colorBg = input.color("color.purple", "Color Bg")
hi = ta.highest(close, len)
pdd = 100 * (close - hi) / hi
uiX = math.pow(pdd, 2)
uiSum = ta.cum(uiX) - ta.cum(uiX)[len]
ui = math.sqrt(uiSum / len)
p_UI = plot(ui, "UI", color=colorBg, linewidth=2)
No comments yet.
Sign in to comment.