Rolling median
Middle value of the last N values, so one spike cannot move it.
Inputs
| Name | Type | Default | Range |
|---|---|---|---|
| source | source | close | |
| period | int | 20 | 1 to 5000 |
Outputs
| Name | Type | Required | Description |
|---|---|---|---|
| median | value | Optional | color theme.accent, style line, width 1 |
- Warm-up
- period - 1 bars (19 at the defaults)
- Repaints
- No
- Parity
- None
Formula
Median[i] = the middle of the sorted values x[i-period+1] to x[i]
With an even period it is the mean of the two middle values. A window holding a missing value has no value.