Skip to content

Instantly share code, notes, and snippets.

@yuyasugano
Created September 29, 2020 07:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save yuyasugano/9609b6f9cd08fa1698d710b4bafb633f to your computer and use it in GitHub Desktop.
Save yuyasugano/9609b6f9cd08fa1698d710b4bafb633f to your computer and use it in GitHub Desktop.
A trend line sample in matplotlib Python
slope, intercept, r_value, p_value, std_err = linregress(x=df_high['Number'], y=df_high['Close'])
df['Uptrend'] = slope * df['Number'] + intercept
slope, intercept, r_value, p_value, std_err = linregress(x=df_low['Number'], y=df_low['Close'])
df['Downtrend'] = slope * df['Number'] + intercept
df.tail()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment