How can I get the slow moving average and trend intensity index?
Closed this issue · 1 comments
MightyMaxSaviorOfTheUniverse commented
I had the idea that I could just use the candles, but that wouldn't get me any of the past 60 day closing times as I had hoped.
How can I gather the historical close and open times over a 60 day period, or perhaps there is a easier solution to simply import charts you have already created in the IQoption gui.
Thank you in advance for any help you can provide
MightyMaxSaviorOfTheUniverse commented
Slow moving average:
d=str(Stock.candles).split("'size': ")
while(len(d)<60):
time.sleep(1)
d=str(Stock.candles).split("'size': ")
while(num<len(d)):
a=float(d[num].split("'close': ")[1].split(',')[0])
Smax=Smax+a
num=num+1
Smax=(Smax/len(d))
Saverage=Smax #Slow moving average
Trend intensity:
Imax=0
Imin=0
average=0
num=(len(d)//2) #half
while(num<len(d)):
a=float(d[num].split("'close': ")[1].split(',')[0])
Imax=Imax+a
num=num+1
Imax=(Imax/(len(d)//2))
Iaverage=Imax#Trend intensity