I calculate simple moving average:
def sma(data_frame, length=15):
# TODO: Be sure about default values of length.
smas = data_frame.Close.rolling(window=length, center=False).mean()
return smas
Using the rolling function is it possible to calculate weighted moving average? As I read in the documentation, I think that I have to pass win_type parameter. But I'm not sure which one I have to choose.
Here is a definition for weighted moving average.
Thanks in advance,