Created
September 6, 2019 04:53
-
-
Save jsrimr/d39012e19ee582bc54b0e45a2015179a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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