Hi Lance,

Here's a function that gives out the volatility (Standard Deviation):

def volatility(Data, lookback, what, where):

for i in range(len(Data)):

try:

Data[i, where] = (Data[i - lookback + 1:i + 1, what].std())

except IndexError:

pass

return Data

And if you want to use the Bollinger Bands using the above function, here's the article I've written on it: https://medium.com/ai-in-plain-english/a-new-modified-version-of-the-bollinger-bands-in-python-a616c25821b8

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store