a=np.where(MACD[2]>0.)[0]
b=np.where(MACD[2]<0.)[0]
num=np.array([1,2])
num1=[]
for x in range (-1,-30,-1):
while True:
if(a[x]-a[x-1]>1):
num1.append(num)
print num1
break
I want to append num but when I run it is hang over there. My desired output is num=[45,74,41,1,2] which mean the num1 will not be overwrite everytime it run while the for loop.
a=np.where(MACD[2]>0.)[0]
b=np.where(MACD[2]<0.)[0]
num=np.array([1])
num1=[]
for x in range (-1,-30,-1):#for MACD above 0
if(a[x]-a[x-1]>1):
num=a[x]
num1.append(num)
print num1
found out that additional num=a[x] will do
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.