pub fn ulcer<T: ToPrimitive>(
data: &[T],
window: usize,
) -> impl Iterator<Item = f64> + '_Expand description
Ulcer Index
Measures downside risk in terms of both the depth and duration of price declines. The index increases in value as the price moves farther away from a recent high and falls as the price rises to new highs.
§Usage
Value decreases during uptrends.
§Sources
§Examples
use traquer::trend;
trend::ulcer(
&[1.0,2.0,3.0,4.0,5.0,6.0,4.0,5.0],
6).collect::<Vec<f64>>();