pub struct UlcerIndexCore { /* private fields */ }Expand description
Streaming Ulcer Index over any series of positive values.
Two questions, kept apart:
- How far below its own high was the series at each point? For every value the running
maximum of the last
lenvalues up to and including that point is taken, and the percentage below it recorded:100 * (value - running_max) / running_max, at most zero. A past drawdown is never recomputed against a later high — what it felt like then is what it was, and rewriting it against today’s peak would flatter or worsen history depending on what happened afterwards. - How deep and how persistent were those drawdowns? The squared percentages over the last
lenpoints are averaged and the root taken.
Squaring is what separates this from an average drawdown: it weighs one deep, long decline more heavily than a series of shallow dips, which is the property the measure exists for.
Unit: percent. Zero means the series never traded below its running high in the window; there is no upper bound.
First value: after 2 * len - 1 observations — len to fill the running-maximum window, then
another len - 1 so that every squared drawdown being averaged is itself fully formed.
The series must be positive: a percentage below a non-positive high has no meaning. Such a value is refused rather than folded in, and the state is left untouched.
Works on prices, on an equity curve, or on any other positive series — nothing here is specific to bars.
Implementations§
Trait Implementations§
Source§impl Clone for UlcerIndexCore
impl Clone for UlcerIndexCore
Source§fn clone(&self) -> UlcerIndexCore
fn clone(&self) -> UlcerIndexCore
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more