Docs

ta.swma

Smooth a series with a fixed four bar weighted average.

itm
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.

NameKindTypeDefaultRangeDescription
sourceSeriesnumber--The series to read.

Output

NameType
valuenumber

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

itm
ta.swma(close)
itm
plot(ta.swma(close), "Four bar average")