# df.to_csv(r'C:\Users\***\PycharmProjects\***\pandas.txt', header=True, index=None, sep='\t', mode='a') # pdb.set_trace() n = 20 #where n is the time period as described smoothingConstant = 2/(n+1) EMAprice = 0 EMAvalues = [] # declaring variables and finding mean for price in adjustedClose: if EMAprice == 0: EMAprice = price else: EMAprice = (price - EMAprice) * smoothingConstant + EMAprice EMAvalues.append(EMAprice)
can you share a output of
Output of adjustedClose.head() is below. Sorry for replying late.
0 797731
1 317637
2 397154
3 249991
4 348013