ta.swma
Smooth a series with a fixed four bar weighted average.
ta.swma(source)Symmetrically weighted moving average over a fixed four-bar window: source[3]/6 + source[2]/3 + source[1]/3 + source[0]/6, weights 1:2:2:1. It takes no length. The four bars and their weights are the definition.
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. |
Output
| Name | Type |
|---|---|
value | number |
Warm-up and missing values
- Warm-up
- 4 bars.
- Missing values
- Returns na until four consecutive non-na observations are in the window. An na resets the accumulation.
Example
ta.swma(close)plot(ta.swma(close), "Four bar average")