Skip to content
Algo Trade Analytics Docs

ta.swma() - Pine Script Function

Symmetrically weighted moving average with fixed length: 4. Weights: [1/6, 2/6, 2/6, 1/6].

ta.swma(source) → series float
NameTypeDescription
sourceseries int/floatSource series.

Symmetrically weighted moving average.

  • na values in the source series are included in calculations and will produce an na result.
//@version=6
indicator("ta.swma")
plot(ta.swma(close))// same on pine, but less efficientpine_swma(x) => x[3] * 1 / 6 + x[2] * 2 / 6 + x[1] * 2 / 6 + x[0] * 1 / 6
plot(pine_swma(close))