Bull Market Support Band Divergency
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © delrioo

//@version=4
study("Bull Market Support Band Divergency")

a = ema(close,21)
b = sma(close,20)
c = 100*(a-b)/close
d = rsi(close,20)

aux = a-b
e = c*(d/100)

desv = dev(close,20)
f = (a-b)*desv/close
outSma = security(syminfo.tickerid, "W", b)
outEma = security(syminfo.tickerid, "W", a)

outDiv = security(syminfo.tickerid, "W", c)
outDer = security(syminfo.tickerid, "W", e)


plot(outDiv, color = color.lime)
plot(outDer, color = color.orange)
