Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
//@version=3
study("OBV @robinraszka", "vOBV", precision=0)
len = input(26, "Period")
t = tickerid(syminfo.prefix, ticker, session.regular)
src = security(t, period, close)
obv(src) => cum(change(src) > 0 ? volume : change(src) < 0 ? - volume : 0 * volume)
osc = obv(src)
data = (osc - sma(osc, len))
hline(50, "Zero", silver)
plot(data, "OBV", black, 2, transp=0)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.