indicator · on price · open source
Weighted Moving Average
Running…
Loading chart…
About
Weighted Moving Average applies a linear weighting to the lookback window so the most recent bar has the heaviest weight and the oldest the lightest.
- More responsive than an SMA at the same length, less than an EMA.
- Useful when you want the line to react to the latest print faster than an SMA but stay less jittery than an EMA.
- Raise N for smoother swings; lower it for tighter tracking.
Source code
//@version=5
indicator("Weighted Moving Average", overlay=true)
len = input.int(20, "Length", minval=1, maxval=500)
src = input.source("close", "Source")
wma = ta.wma(src, len)
p_WMA = plot(wma, "WMA", color=color.orange, linewidth=2)
alertcondition(ta.crossover(close, wma), "Price crosses above WMA", "Price crossed above the WMA")
alertcondition(ta.crossunder(close, wma), "Price crosses below WMA", "Price crossed below the WMA")
No comments yet.
Sign in to comment.