LazyBear

Indicator: CCI coded OBV

4153 18 523
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)
    
o=obv(src)
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)
You dun goofed. Posted the perfect indicator for free when you should of sold it to a hedge fund manager. :P
+2 Reply
:) thanks.
+2 Reply
Thanks
+2 Reply
yw.
+2 Reply
Really nice work here! Is there a way for me to use this indicator? I couldn't figure it out yet.
+2 Reply
LazyBear PRO Kurbelklaus
Thanks.

Click on the "Share" icon (top right on the chart). You will get a dialog box with "Make it mine" button (lower left of the dialog). Click it.This will give take a copy of this chart for you. It has the source code for my indicator. Click on the "{}" icon next to the indicator name to access it.
+2 Reply
Awesome, thank you very much! I searched everywhere and couldn't find it. Really glad i can use it now :)
+2 Reply
LazyBear PRO Kurbelklaus
YW :)
+2 Reply
This seems really effective especially considering the small amount of code on this one. Nice one.
Reply
AndrewFaulkner AndrewFaulkner
And pairing this with a Laguerre filter proves interesting.
Reply
@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!
Reply
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).
Reply
sungkhum LazyBear
Thanks!
Reply
sungkhum LazyBear
I just created a bot based on this idea: https://discuss.tradewave.net/t/obv-lite-bot/362
Fun!
+1 Reply
Does this indicator only work with BTCUSD?

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

snapshot

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

snapshot

This is GBP/USD in another time frame
Reply
TV doesn't expose FX volume. Only instruments with volume will work.
Reply
Ideas Scripts Chart
United States
United Kingdom
India
España
France
Italia
Brasil
Россия
Türkiye
日本
한국
Home Stock Screener Forex Signal Finder Economic Calendar How It Works Chart Features House Rules Moderators For the WEB Widgets Stock Charting Library Priority Support Feature Request Blog & News FAQ Help & Wiki Twitter
Private Messages Chat Ideas Published Followers Following Priority Support Public Profile Profile Settings Account and Billing Sign Out