Tail Indicator - 84
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © RicardoSantos

//@version=5
indicator(title='Tail Indicator - 84', shorttitle='TI-84')

int        atr_length = input.int  (defval=84)
int       band_length = input.int  (defval=84)
float band_multiplier = input.float(defval=1.0)

float maoc = math.max(close, open)
float mioc = math.min(close, open)

float tail = ((high - maoc) - (mioc - low)) / ta.atr(atr_length)

[b, bu, bl] = ta.bb(tail, band_length, band_multiplier)

hline(0)
plot(series=tail, title='Tail', color=color.yellow)
plot(series=bu, title='Tail+', color=color.red)
plot(series=bl, title='Tail-', color=color.lime)
