SN Smoothed Balance of Power v2

Hi all,

here is an updated version of the indicator script I published yesterday.

The goal of this indicator is to try and find darkpool activity. The indicator itself is not enough to fully identify darkpool but it should be able to detect quiet accumulation. What makes this Balance of Power different from others on TV is that it is smoothed by using a moving average.


- The values that are default are completely arbitrary except for the VWMA length (a 14-day period for the 1D chart is the norm). For instance the limit where it shows red/green I picked because it works best for the 1D chart I am using. Other TF's and charts will need tweaking of all the values you find in the options menu to get the best results.

- I modified the indicator such that it is usable on charts that do not show volume . HOWEVER, this chart is default to NYMEX: CL1! . To get different volume data this needs to be changed in the option menu.

- I am in no way an expert on darkpool/ HFT trading and am merely going from the information I found on the internet. Consider this an experiment.

- Lazybear for some of the plotting-code
- Igor Livshin for the formula
- TahaBintahir for the Symbol-code (although I'm not sure who the original author is...)

本著真正的TradingView精神,該腳本的作者將其開源發布,以便交易者可以理解和驗證它。為作者喝彩吧!您可以免費使用它,但在出版物中重複使用此代碼受網站規則的約束。 您可以收藏它以在圖表上使用。



// author : SatNam
// credits to LazyBear and Igor Livshin

study(title="SN-BOP v2")
length=input(14, "CVWMA Length")
lengthSMA=input(25, "SMA Length")
colour=input(2, "Short/Long Limit")
bopmultiplier=input(8, "EMA BOP Multiplier")

PlotEMA=input(true, "Plot SMA?", type=bool)

symb  = input(defval="NYMEX:CL1!", type = string, title="Market with Volume Data")
hi = security(symb, period, high)
op = security(symb, period, open)
lo = security(symb, period, low)
cl = security(symb, period, close)
vol = security(symb, period, volume)
THL = (hi-lo) ? .1 : (hi-lo)

BuRBoO = (hi - op)/(hi-lo)
BeRBoO = (op - lo)/(hi-lo)
BuRBoC =(cl - lo)/(hi-lo)
BeRBoC =(hi - cl)/(hi-lo)
BuRBoOC = cl > 0 ? (cl-op)/(hi-lo) : 0
BeRBoOC = cl > 0 ? 0 : (op -cl)/(hi-lo)

BOP = ((BuRBoO+BuRBoC+BuRBoOC)/3) - ((BeRBoO+BeRBoC+BeRBoOC)/3)
cvwma = ((sum(BOP, length) * sum(vol, length)) / sum(vol,length))

barcolor = cvwma >=  colour ? green : cvwma <= -colour ? red: gray

plot(cvwma, style=columns, color = barcolor)
plot(PlotEMA?ema(BOP*bopmultiplier, lengthSMA):na, color=navy, linewidth=1)