Created
September 5, 2021 01:18
-
-
Save SajidLhessani/853e5298c6b8fbd460395e4ea4025856 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| # Create a column by name, SMA and assign the SMA calculation to it | |
| df['SMA'] = df['Close'].shift(1).rolling(window=n).mean() | |
| # Create a column by name, Corr and assign the calculation of correlation to it | |
| df['Corr'] = df['Close'].shift(1).rolling(window=n).corr(df['SMA'].shift(1)) | |
| # Create a column by name, SAR and assign the SAR calculation to it | |
| df['SAR'] = ta.SAR(np.array(df['High'].shift(1)), np.array(df['Low'].shift(1)), | |
| 0.2, 0.2) | |
| # Create a column by name, ADX and assign the ADX calculation to it | |
| df['ADX'] = ta.ADX(np.array(df['High'].shift(1)), np.array(df['Low'].shift(1)), | |
| np.array(df['Open']), timeperiod=n) | |
| df |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment