//@version=4
study("bibi OHO", shorttitle="bibi OH", format=format.price, precision=2, resolution="")
// Repères H
obPlot = hline(-20, title="Upper Band", color=#FF5555)
hline(-50, title="Middle Level", linestyle=hline.style_dotted, color=#606060)
osPlot = hline(-80, title="Lower Band", color=#55FF55)
// Oscillateur
length = input(title="Length", type=input.integer, defval=12)
src = input(close, "Source", type = input.source)
_pr(length) =>
max = highest(length)
min = lowest(length)
100 * (src - max) / (max - min)
percentR = _pr(length)
// BB
[middle, upper, lower] = bb(percentR, 9, 0.2)
plot(middle, color=#2255EE, linewidth=2)
plot(upper, color=#EE7755, linewidth=2)
plot(lower, color=#EE7755, linewidth=2)
fill(obPlot, osPlot, title="Background", color=color.new(#777777, 90))
plot(percentR, title="%R", color=#DDFF00, linewidth=3, transp=0)