Last active
June 25, 2018 23:59
-
-
Save pequet/f0abde98a85e4130b93156e3cc3192be to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Created by @pequet (https://www.tradingview.com/u/pequet) May 28 2018 | |
// https://github.com/pequet/ | |
// NOT FOR DISTRIBUTION | |
// @version=3 | |
study(title="1' OBV v0.0.4", shorttitle="1' OBV", overlay=false) | |
// inputs | |
// ------ | |
formulaInput = input("line", options=["line","candles"], title="Formula") // good idea or dumb idea? | |
// functions | |
// --------- | |
OnePeriod() => ismonthly ? 40320*interval | |
: isweekly ? 10080*interval | |
: isdaily ? 1440*interval | |
: interval | |
vol = cum(formulaInput=="line" ? ( change(close)>0 ? volume : change(close)<0 ? -volume : 0 ) : ( open<close ? volume : open>close ? -volume : 0 )) | |
obv = security(tickerid, '1', vol) | |
plot(obv, color=blue, transp=0, title="SOBV") | |
// - |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
bodysize = abs(open-close)
adjvol = volume*bodysize
volu = adjust ? adjvol : volume