Indicator: CCI coded OBV

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)
Thank you Lazybear! I found a good explanation on how to use CCI to take trades so I thought I would share it.
+1 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 :/
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
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!
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
sungkhum LazyBear
I just created a bot based on this idea:
+1 Reply
EN English
EN English (UK)
EN English (IN)
DE Deutsch
FR Français
ES Español
IT Italiano
PL Polski
TR Türkçe
RU Русский
PT Português
ID Bahasa Indonesia
MS Bahasa Melayu
TH ภาษาไทย
VI Tiếng Việt
JA 日本語
KO 한국어
ZH 简体中文
ZH 繁體中文
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