"""Smooth a sequence of true ranges.

Use the previous close for each bar and retain the chosen seed and period.
All inputs are synthetic teaching examples. Run: python 18_average-true-range.py
"""
from tv_math import *

v=rma([true_range(110,108,100),true_range(113,109,110),true_range(112,107,112)],3)
assert abs(v[-1]-19/3)<1e-12
print(v)
