CapnOscar

Bouncer Moving Average V2

There you go lol
开源脚本

本着真正的TradingView精神,该脚本的作者将其开源发布,以便交易者可以理解和验证它。为作者喝彩!您可以免费使用它,但在出版物中重复使用此代码受网站规则的约束。 您可以收藏它以在图表上使用。

免责声明

这些信息和出版物并不意味着也不构成TradingView提供或认可的金融、投资、交易或其它类型的建议或背书。请在使用条款阅读更多信息。

想在图表上使用此脚本?
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)