The Default Average True Range doesn't appear to be accurate, not sure why. Rewrote it, hopefully it works better for everyone than the original.
study(title="Average True Range", shorttitle="ATR", overlay=false) length = input(13, minval=1) plot(sma(tr, length), color=red, offset = 1)