ta.clip
Hold a series between a lower and an upper bound.
ta.clip(source, lo, hi)min(max(source, lo), hi): the source held inside two bounds, which may themselves be series. The upper clamp is applied last, so an inverted pair (lo above hi) gives hi rather than an error. The bounds are numbers you choose. ta.winsorize takes them from the data.
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 bound. |
lo | Series | number | - | - | The lower bound. |
hi | Series | number | - | - | The upper bound. |
Output
| Name | Type |
|---|---|
value | number |
Warm-up and missing values
- Warm-up
- None.
- Missing values
- na when the source or either bound is na. Pointwise: no window, no warm-up.
Example
ta.clip(ta.ret(close), -0.1, 0.1)plot(ta.clip(ta.ret(close), -0.1, 0.1), "Clipped return")