SatNam

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.

Notes:

- 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.

Credits:
- 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 автор этого скрипта опубликовал его с открытым исходным кодом, чтобы трейдеры могли понять, как он работает, и проверить на практике. Вы можете воспользоваться им бесплатно, но повторное использование этого кода в публикации регулируется Правилами поведения. Вы можете добавить этот скрипт в избранное и использовать его на графике.

Отказ от ответственности

Все виды контента, которые вы можете увидеть на TradingView, не являются финансовыми, инвестиционными, торговыми или любыми другими рекомендациями. Мы не предоставляем советы по покупке и продаже активов. Подробнее — в Условиях использования 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
hline(0)

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