ta.ulcer
Measure how deep and how long a series has sat below its recent highs, as a single percentage.
ta.ulcer(source, length)Ulcer index in its rolling form: the percentage drawdown of each bar from the highest value over the trailing length bars, then the root of the mean of the squared drawdowns over length bars. The maximum is taken over the trailing length bars, not over the whole run. It reads 0 on a series that never falls below its recent high.
Parameters
A series parameter takes a value on every bar. A constant parameter must be known before the first bar, such as a number or an input.
| Name | Kind | Type | Default | Range | Description |
|---|---|---|---|---|---|
source | Series | number | - | - | The series to read. |
length | Constant | number | 14 | 1 to 10000 | Window in observed bars. |
Output
| Name | Type |
|---|---|
value | number |
Warm-up and missing values
- Warm-up
2 * length - 1bars. Names in the warm-up are this operator’s parameters.- Missing values
- Returns na until
2 * length - 1consecutive non-na observations are in the window. An na resets the accumulation. Also na where the highest value in a window is zero or below.
Example
ta.ulcer(close, 14)plot(ta.ulcer(close, 14), "Ulcer 14")