Ulcer Index

PortfolioOptimisers.UlcerIndex — Type
struct UlcerIndex{__T_settings, __T_w} <: RiskMeasure

Measures the Ulcer Index, the root mean square of the uncompounded drawdown over the sample.

The drawdown series is the one of absolute_drawdown_vec: the cumulative return is a sum of the returns, and its running peak starts at $c_0 = 0$. The square gives a deep drawdown more weight than AverageDrawdown does, and a long drawdown adds one term for each period that it lasts. RelativeUlcerIndex takes the same root mean square of the compounded drawdown series.

Mathematical definition

\[\begin{align} \mathrm{UI}(\boldsymbol{x}) &= \sqrt{\frac{1}{T} \sum_{t=1}^{T} d_t^2} = \frac{\lVert \boldsymbol{d} \rVert_2}{\sqrt{T}}\,. \end{align}\]

Where:

  • $\mathrm{UI}(\boldsymbol{x})$: Ulcer Index (root-mean-square drawdown).
  • $\boldsymbol{x}$: Portfolio returns vector $T \times 1$.
  • $d_t \leq 0$: Absolute drawdown at period $t$. absolute_drawdown_vec states the series.
  • $\boldsymbol{d}$: Absolute drawdown series vector $T \times 1$.
  • $T$: Number of observations.

With observation weights, the index takes the weighted mean of the squared drawdowns:

\[\begin{align} \mathrm{UI}(\boldsymbol{x}) &= \sqrt{\frac{1}{W_{T}} \sum_{t=1}^{T} w_{t} d_t^2}\,. \end{align}\]

Where:

  • $w_{t}$: Observation weight of observation $t$.
  • $W_{T} = \sum_{t=1}^{T} w_{t}$: Total observation weight.

The drawdown series reads the full return path, so an observation with zero weight still moves every later drawdown. A path that never falls below its running peak has an Ulcer Index of zero. The index is never below AverageDrawdown on the same path and weights, because a root mean square is never below a mean of the same nonnegative values.

Equation 7.88 of [12] states the index without weights. The weighted mean of the squares is the library's extension of that form.

Algorithm

  1. Compute the drawdown series with absolute_drawdown_vec.
  2. Resolve the observation weights with checked_observation_weights.
  3. Return ulcer_index of the series and the weights.

Fields

  • settings: Risk measure settings.
  • w: Optional observation weights vector observations × 1, or a concrete subtype of DynamicAbstractWeights. If nothing, the computation is unweighted.

Constructors

UlcerIndex(;    settings::RiskMeasureSettings = RiskMeasureSettings(),    w::Option{<:ObsWeights} = nothing) -> UlcerIndex

Keywords correspond to the struct's fields.

Validation

Propagated parameters

factory passes its arguments on to these @fprop fields:

Observation weight parameters

obs_weights_view indexes these fields to the selected observations:

Functor

(r::UlcerIndex)(x::VecNum)

Computes the Ulcer Index of a portfolio returns vector x.

Arguments

  • x::VecNum: Portfolio returns vector.

Examples

julia> UlcerIndex()UlcerIndex  settings ┼ RiskMeasureSettings           │   scale ┼ Float64: 1.0           │      ub ┼ nothing           │     rke ┴ Bool: true         w ┴ nothing

On the path of AverageDrawdown, the drawdown series is [0, -0.25, -0.1875, -0.3125, 0], so the sum of the squares is 0.1953125.

julia> x = [0.125, -0.25, 0.0625, -0.125, 0.375];julia> UlcerIndex()(x) ≈ sqrt(0.1953125 / 5)truejulia> UlcerIndex(; w = pweights([1.0, 1.0, 1.0, 1.0, 4.0]))(x)0.15625

Related

References

  • [214] P. G. Martin and B. B. McCann. The Investor's Guide to Fidelity Funds (John Wiley & Sons, 1989).
  • [12] D. Cajas. Advanced Portfolio Optimization: A Cutting-edge Quantitative Approach (Springer Nature Switzerland, 2025). Section 7.2.4.2, Equation 7.88. The original source of this formulation was not found. The formulation follows this work and is not checked against the original.
source
PortfolioOptimisers.RelativeUlcerIndex — Type
struct RelativeUlcerIndex{__T_settings, __T_w} <: HierarchicalRiskMeasure

Measures the Relative Ulcer Index, the root mean square of the compounded drawdown over the sample.

The drawdown series is the one of relative_drawdown_vec: the wealth compounds the returns, and its running peak starts at $C_0 = 1$. Each drawdown is thus a fraction of the peak wealth. UlcerIndex takes the same root mean square of the uncompounded series. The compounded wealth is a product of linear functions of the weights, so the library states no JuMP formulation of the measure, and it is a HierarchicalRiskMeasure.

Mathematical definition

\[\begin{align} \mathrm{RUI}(\boldsymbol{x}) &= \frac{\lVert \boldsymbol{rd} \rVert_2}{\sqrt{T}}\,. \end{align}\]

Where:

  • $\mathrm{RUI}(\boldsymbol{x})$: Relative Ulcer Index (root-mean-square relative drawdown).
  • $\boldsymbol{x}$: Portfolio returns vector $T \times 1$.
  • $rd_t \leq 0$: Relative drawdown at period $t$. relative_drawdown_vec states the series.
  • $\boldsymbol{rd}$: Relative drawdown series vector $T \times 1$.
  • $T$: Number of observations.

With observation weights, the index takes the weighted mean of the squares, as UlcerIndex states, with $rd_t$ in place of $d_t$.

Equation 7.88 of [12] states the index on the uncompounded drawdown. The root mean square of the relative drawdown series is the library's extension of that form.

Algorithm

  1. Compute the relative drawdown series with relative_drawdown_vec.
  2. Resolve the observation weights with checked_observation_weights.
  3. Return ulcer_index of the series and the weights.

Fields

  • settings: Risk measure settings.
  • w: Optional observation weights vector observations × 1, or a concrete subtype of DynamicAbstractWeights. If nothing, the computation is unweighted.

Constructors

RelativeUlcerIndex(;    settings::HierarchicalRiskMeasureSettings = HierarchicalRiskMeasureSettings(),    w::Option{<:ObsWeights} = nothing) -> RelativeUlcerIndex

Keywords correspond to the struct's fields.

Validation

Propagated parameters

factory passes its arguments on to these @fprop fields:

Observation weight parameters

obs_weights_view indexes these fields to the selected observations:

Functor

(r::RelativeUlcerIndex)(x::VecNum)

Computes the Relative Ulcer Index of a portfolio returns vector x.

Arguments

  • x::VecNum: Portfolio returns vector.

Examples

julia> RelativeUlcerIndex()RelativeUlcerIndex  settings ┼ HierarchicalRiskMeasureSettings           │   scale ┴ Float64: 1.0         w ┴ nothing

On the path of AverageDrawdown, the relative drawdown series is [0, -0.25, -0.203125, -0.302734375, -0.041259765625].

julia> x = [0.125, -0.25, 0.0625, -0.125, 0.375];julia> rd = [0, -0.25, -0.203125, -0.302734375, -0.041259765625];julia> RelativeUlcerIndex()(x) ≈ sqrt(sum(abs2, rd) / 5)true

Related

References

  • [214] P. G. Martin and B. B. McCann. The Investor's Guide to Fidelity Funds (John Wiley & Sons, 1989).
  • [12] D. Cajas. Advanced Portfolio Optimization: A Cutting-edge Quantitative Approach (Springer Nature Switzerland, 2025). Section 7.2.4.2, Equation 7.88. The original source of this formulation was not found. The formulation follows this work and is not checked against the original.
source

References

[12]
D. Cajas. Advanced Portfolio Optimization: A Cutting-edge Quantitative Approach (Springer Nature Switzerland, 2025).
[214]
P. G. Martin and B. B. McCann. The Investor's Guide to Fidelity Funds (John Wiley & Sons, 1989).