CapnOscar

Bouncer Moving Average V2

There you go lol
Open-source script

In true TradingView spirit, the author of this script has published it open-source, so traders can understand and verify it. Cheers to the author! You may use it for free, but reuse of this code in a publication is governed by House Rules. You can favorite it to use it on a chart.

Disclaimer

The information and publications are not meant to be, and do not constitute, financial, investment, trading, or other types of advice or recommendations supplied or endorsed by TradingView. Read more in the Terms of Use.

Want to use this script on a chart?
study(title="Bouncer Moving Average", shorttitle="BMA", overlay=true)

outh = sma(high, 200)
outl = sma(low, 200)
outc = sma(close, 200)


limadx = input(18, minval=1, title="ADX MA Active")
len = input(34, minval=1, title="Period")

up = change(high)
down = -change(low)
trur = rma(tr, 14)
plus = fixnan(100 * rma(up > down and up > 0 ? up : 0, 14) / trur)
minus = fixnan(100 * rma(down > up and down > 0 ? down : 0, 14) / trur)
sum = plus + minus 
adx = 100 * rma(abs(plus - minus) / (sum == 0 ? 1 : sum), 14)

macol = adx > limadx and plus > minus ? green : adx > limadx and plus < minus ? red :black
smma34 = na(smma34[1]) ? sma(close, len) : (smma34[1] * (len - 1) + close) / len
smma12 = na(smma12[1]) ? sma(close, 12) : (smma12[1] * (12 - 1) + close) / 12

plot(smma34, color=macol, transp=0)
plot(smma12, color=silver, transp=0)

ccol = smma12 > smma34 and rising(smma12,1) ? green : smma12 < smma34 and falling(smma12,1) ? red : black
plot(outh, color=ccol, transp=0)
plot(outl, color=ccol, transp=0)
plot(outc, color=ccol, transp=0, linewidth=2)