Indicator: CCI coded OBV

10133 21 2993
OBV is colored green if CCI > threshold, red if CCI < threshold.

Both "threshold" and "CCI Length" can be customized using the options page.

Indicator also displays a 13EMA (length can be changed) over OBV.
Remove from Favorite Scripts Add to Favorite Scripts
// @author LazyBear
study("CCI coded OBV", shorttitle="CCIOBV_LB")
src = close
length = input(20, minval=1, title="CCI Length")
threshold=input(0, title="CCI threshold for OBV coding")
lengthema=input(13, title="EMA length")
obv(src) => 
    cum(change(src) > 0 ? volume : change(src) < 0 ? -volume : 0*volume)
c=cci(src, length)
plot(o, color=c>=threshold?green:red, title="OBV_CCI coded", linewidth=2)
plot(ema(o,lengthema), color=orange, linewidth=2)
Thanks for this. Just wondering when one would change the threshold value? What does the threshold value represent? Thank you.
Thank you Lazybear! I found a good explanation on how to use CCI to take trades so I thought I would share it.
+3 Reply
Amazing indicator, genius. I started demo trading 3 months ago and have lost 5k all in all so doing pretty poorly

This indicator is a game changer allied to a few others yes but this is key. Have suddenly become consistently profitable

I doff my hat to you lazy bear
Does this indicator only work with BTCUSD?

I can't seem to get it working with any other data :/
LazyBear Sora0102
OBV needs volume. May be you tried it on FX? If problem still persists, can you post a chart? Thx.
Sora0102 LazyBear
(I deeply apologize for late response.)

This is what the chart looks like when I used it on a EUR/USD 3 minute chart.

This is GBP/USD in another time frame
LazyBear Sora0102
TV doesn't expose FX volume. Only instruments with volume will work.
@LazyBear Just trying to understand better how this is working. Since OBV depends on the start date - when does tradingview start calculating the OBV when you use this code? From the beginning of the data it has? A month back? Thanks!
LazyBear sungkhum
It starts calculation from the first data item in the series. So, for BTCUSD, BITSTAMP has more data than OKCOIN, for ex.,

Function of interest in this script is obv(src).
sungkhum LazyBear
EN English
EN English (UK)
EN English (IN)
DE Deutsch
FR Français
ES Español
IT Italiano
PL Polski
SV Svenska
TR Türkçe
RU Русский
PT Português
ID Bahasa Indonesia
MS Bahasa Melayu
TH ภาษาไทย
VI Tiếng Việt
JA 日本語
KO 한국어
ZH 简体中文
ZH 繁體中文
AR العربية
Home Stock Screener Forex Signal Finder Cryptocurrency Signal Finder Economic Calendar How It Works Chart Features House Rules Moderators Website & Broker Solutions Widgets Stock Charting Library Feature Request Blog & News FAQ Help & Wiki Twitter
Profile Profile Settings Account and Billing My Support Tickets Contact Support Ideas Published Followers Following Private Messages Chat Sign Out