Skip to content

Instantly share code, notes, and snippets.

@jsrimr jsrimr/bollinger.py
Created Sep 6, 2019

Embed
What would you like to do?
def get_bollinger_diffs(df, n=20, k=2):
ma_n = df['c'].rolling(n).mean()
Bol_upper = df['c'].rolling(n).mean() + k* df['c'].rolling(n).std()
Bol_lower = df['c'].rolling(n).mean() - k* df['c'].rolling(n).std()
return (Bol_upper - Bol_lower).mean()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.