wma

Weighted Moving Average

wma(source, periods)

Parameters

Name Type Description
source field Data series to average
periods int Number of periods for the WMA calculation

Formula

WMA = (P1 * n + P2 * (n-1) + ... + Pn * 1) / (n + (n-1) + ... + 1)

Examples

x = wma(close, 10);   # 10-period WMA of closing prices
y = wma(high, 20);    # 20-period WMA of highs
close > wma(close, 50);  # Price above 50-period WMA

Returns

float

Range

periods must be 2-400

Notes

No value for the first periods-1 bars: NULL until the window holds periods non-NULL values. The most recent value has weight n, the previous has weight n-1, and so on

References

TradingView: ta.wma(source, length)