Closed Gauthamastro closed 4 years ago
Hey @Gauthamastro, good questions.
window
, for a moving average indicator like this one, allows you to specify the number of periods used in the moving average calculation. For example, a moving average using 10 periods would be more spiky than one with 200 periods. Check out the investopedia page on exponential moving average for more detail.
index
just lets you request the moving average at any point in the timeseries. If you want to know the lastest value in the moving average curve, you'd use the last index value. If you want to know the moving average value as of 10 periods ago, you might use len(ts.Candles) -10
as the index.
Hi @sdcoffey, Thanks for your reply.
Now it makes sense. I was confused about the index parameter.
ts variable has a time-period set for candles already. So what is this window parameter passed to NewEMAIndicator? Also, what is the purpose of that parameter index given to Calculate?
I couldn't find any documentation for it. Can someone please explain it to me?