Faster Bands [AstrideUnicorn]
// This work is licensed under the Attribution-NonCommercial-ShareAlike 4.0 International (CC BY-NC-SA 4.0) https://creativecommons.org/licenses/by-nc-sa/4.0/
// (c) AstrideUnicorn. All rights reserved.

//@version=5
indicator('Faster Bands', timeframe='', overlay=true)

Length = input.int(title='Length', defval=20, tooltip='Averaging window length.')
Multiplier = input.float(title='Multiplier', defval=2.0, tooltip='It is the number of deviations by which upper- and lower-band are away from the middle-line.')
Uniformity = input.int(1, title='Uniformity', minval=1, maxval=7, step=1, tooltip='Uniformity of the bands width. Higher values correspond to a uniformer width.')

Source = input.source(title='Source', defval=close, tooltip='Price time-series to be used for the indicator calculation.')

MiddleLine = ta.ema(Source, Length)

ExponentialMeanAbsoluteDeviation = ta.ema(math.abs(Source - MiddleLine), Uniformity * Length)


UpperLine = MiddleLine + Multiplier * ExponentialMeanAbsoluteDeviation
LowerLine = MiddleLine - Multiplier * ExponentialMeanAbsoluteDeviation

LL = plot(LowerLine, color=color.new(#2962ff, 0))
UL = plot(UpperLine, color=color.new(#2962ff, 0))
fill(LL, UL, color.new(color.blue, 90))

plot(MiddleLine, color=color.new(color.orange, 0))

