A hybrid representation of Elder Ray's Bear/Bull as an oscillator, using TEMA and LRC calculations to average out the signals. The Oscillation is based off of the Derivative oscillator. This gives an interesting interpretation of Bear vs Bull power. Give it a try!
study(title="Elder Ray Composite DO", shorttitle="Elder Ray Composite DO") src = close, len = input(13, minval=1, title="Elder Ray Composite Length"), length=len p=input(9,title="SMA length") ema1=input(5,title="EMA1 length") ema2=input(3,title="EMA2 length") offset=input(0,title="LRC Offset") outEMA = ema(src, len) source = (high - outEMA) source2 = (low - outEMA) * (-1) //TEMA/LRC AVG s1=ema(ema(source, ema1),ema2) s2=s1 - sma(s1,p) //Triple EMA tema1 = ema(source, ema1) tema2 = ema(tema1, ema1) tema3 = ema(tema2, ema1) dotema1 = 3 * (tema1 - tema2) + tema3 //LRC lrc1 = linreg(source, ema1, offset) avg1 = (dotema1 + lrc1) / 2 tema4 = ema(avg1, ema2) tema5 = ema(tema4, ema2) tema6 = ema(tema5, ema2) dotema2= 3 * (tema4 - tema5) + tema6 lrc2 = linreg(source, ema2, offset) avg2 = (dotema2 + lrc2) / 2 xs1 = avg2 xs2=xs1 - ema(xs1,p) //TEMA/LRC AVG //Triple EMA btema1 = ema(source2, ema1) btema2 = ema(btema1, ema1) btema3 = ema(btema2, ema1) bdotema1 = 3 * (btema1 - btema2) + btema3 //LRC blrc1 = linreg(source2, ema1, offset) bavg1 = (bdotema1 + blrc1) / 2 btema4 = ema(bavg1, ema2) btema5 = ema(btema4, ema2) btema6 = ema(btema5, ema2) bdotema2= 3 * (btema4 - btema5) + btema6 blrc2 = linreg(source2, ema2, offset) bavg2 = (bdotema2 + blrc2) / 2 bxs1 = bavg2 bs1=ema(ema(source2, ema1),ema2) bs2=bs1 - sma(bs1,p) bxs2=bxs1 - ema(bxs1,p) //lxs3=lxs2 * (-1) plot(s2, style=area, transp=90, linewidth=1, color=blue) plot(s2, linewidth=1, color=blue) plot(bs2, style=area, transp=90, linewidth=1, color=fuchsia) plot(bs2, linewidth=1, color=fuchsia) c_color=xs2 < 0 ? (xs2 < xs2[1] ? green : lime ) : (xs2 >= 0 ? (xs2 > xs2[1] ? lime : green ) : na ) plot(xs2, style=histogram, color=c_color, linewidth=2) b_color=bxs2 < 0 ? (bxs2 < bxs2[1] ? maroon : red ) : (bxs2 >= 0 ? (bxs2 > bxs2[1] ? red : maroon ) : na ) plot(bxs2, style=histogram, color=b_color, linewidth=2) plot(xs2, color=lime, linewidth=1) plot(bxs2, color=red, linewidth=1) hline(0) //plot(out, title="Elder Ray Bull", color=red, style=columns)