Skip to content

Instantly share code, notes, and snippets.

@joeng03
Last active October 31, 2021 04:42
Show Gist options
  • Save joeng03/3d95c2a199545ddfa8c6881997f3674b to your computer and use it in GitHub Desktop.
Save joeng03/3d95c2a199545ddfa8c6881997f3674b to your computer and use it in GitHub Desktop.
for i in range(0,len(local_max)-3):
(m,c),r,_,_,_= np.polyfit(local_max_idx[i:i+3],local_max[i:i+3],1,full=True)
if(m<=3 and m>=-3 and (r[0]<20 and r[0]>-20)):
start=local_max_idx[i+2]
for k in range(start,start+7):
if(k<len(prices_close) and prices_close[k]>(k*m+c)):
plt.figure(figsize=(10,5))
plt.plot(local_max_idx,m*local_max_idx+c,'m')
plt.plot(prices_close)
plt.plot(k,prices_close[k],'bo')
break
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment