Skip to content

Instantly share code, notes, and snippets.

@quantra-go-algo
Created January 31, 2024 18:40
Show Gist options
  • Save quantra-go-algo/7213ff7c2d4db0aa94ffbef92b12595c to your computer and use it in GitHub Desktop.
Save quantra-go-algo/7213ff7c2d4db0aa94ffbef92b12595c to your computer and use it in GitHub Desktop.
# Calculate short-term (fast) and long-term (slow) moving averages
aapl_data['SMA_50'] = aapl_data['Close'].rolling(window=50).mean()
aapl_data['SMA_200'] = aapl_data['Close'].rolling(window=200).mean()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment