"""Build population-deviation bands.

Bands describe past dispersion; prices are not guaranteed to remain within them.
All inputs are synthetic teaching examples. Run: python 20_bollinger-bands.py
"""
from tv_math import *

v=bollinger([1,2,3],3,2)[-1]
assert v[1]==2 and abs(v[2]-(2+2*math.sqrt(2/3)))<1e-12
print(v)
