本页源码来自 TradingView 公开发布的开源脚本,版权归原作者所有, 请遵循其原始许可(Pine 脚本常见 CC BY-NC-SA / MPL-2.0 / MIT)。 本项目仅用于研究检索与许可范围内的移植。
study(title="Volume Based Buy and Sell Momentum by 2tm", shorttitle="VBSM")
EMA_Len = input(25, title="Lenth", minval=1)
xROC = roc(close, 1)
nRes1 = iff(volume < volume[1], nz(nRes1[1], 0) + xROC, nz(nRes1[1], 0))
nRes2 = iff(volume > volume[1], nz(nRes2[1], 0) + xROC, nz(nRes2[1], 0))
nRes3 = nRes1 + nRes2
nResEMA3 = ema(nRes1, EMA_Len) + ema(nRes2, EMA_Len)
PNVI = plot(nRes3, color=blue, title="PVI + NVI")
PEMA = plot(nResEMA3, color=red, title="EMA")
pCol = nRes3 > nResEMA3 ? blue : red
fill (PNVI, PEMA, pCol)
//q=min(nRes3, nResEMA3)
//plot(q, color=aqua, title="Q")