# Cumulative Volume Delta Indicator For ThinkOrSwim

Status
Not open for further replies.

#### Igor

##### New member
VIP
Cumulative Delta of Bull & Bear Balance Indicator
Is it possible to convert this study to ThinkScript?

Published in October 2003 in S&C magazine, Vadim Gimelfarb's article, "Bull And Bear Balance Indicator," describes a method of deducing market sentiment from close-to-close price movement. His system uses the various possible relationships between the previous close and current open, high, low, and close. Based on the pattern that each day exhibits, the indicator uses a pattern-specific calculation to determine bull and bear strength for the day.

Last edited by a moderator:
Cumulative Delta of Bull & Bear Balance Indicator
The picture below at least seems to match cvd line in a chart I can view in TradingView of AAPL 1yD

Ruby:
``````#//@version=4
#// A Cumulative Volume Delta approach based on the Bull and Bear Balance Indicator by Vadim Gimelfarb published in the October 2003 issue of the S&C Magazine.
#// Adjust the length of the moving average according to your needs (Symbol, Timeframe, etc.)

#study(title="Cumulative Volume Delta", shorttitle="CVD", precision=0)

declare lower;
#// Inputs
input periodMa = 100;#input(title="MA Length", minval=1, defval=100)
input plotMa   = yes;#input(title="Plot MA?", defval=false)
#// Calculations (Bull & Bear Balance Indicator by Vadim Gimelfarb)

def bullPower = if(close < open, if(close[1] < open, max(high - close[1], close - low), max(high - open, close - low)), if(close > open, if(close[1] > open, high - low, max(open - close[1], high - low)), if(high - close > close - low, if(close[1] < open, max(high - close[1], close - low), high - open), if(high - close < close - low, if(close[1] > open, high - low, max(open - close[1], high - low)), if(close[1] > open, max(high - open, close - low), if(close[1] < open, max(open - close[1], high - low), high-low))))));

def bearPower = if(close < open, if(close[1] > open, max(close[1] - open, high - low), high - low), if(close > open, if(close[1] > open, max(close[1] - low, high - close), max(open - low, high - close)), if(high - close > close - low, if(close[1] > open, max(close[1] - open, high - low), high - low), if(high - close < close - low, if(close[1] > open, max(close[1] - low, high - close), open - low), if(close[1] > open, max(close[1] - open, high - low), if(close[1] < open, max(open - low, high - close), high - low))))));

#// Calculations (Bull & Bear Pressure Volume)

def bullVolume = (bullPower / (bullPower + bearPower)) * volume;
def bearVolume = (bearPower / (bullPower + bearPower)) * volume;

#// Calculations Delta
def delta = if isnan(close) then delta[1] else bullVolume - bearVolume;
def cvd   = if barnumber()==1 then delta else if barnumber()>1 then cvd[1] + delta else cvd[1];
def cvdMa = simpleMovingAvg(cvd, periodMa);

#// Plotting
#customColor = cvd > cvdMa ? color.new(color.teal, 50) : color.new(color.red, 50)
plot Ref1 = cvd;#plot(cvd, style=plot.style_line, linewidth=1, color=color.black, title="CVD")
plot Ref2 = if plotMa then cvdMa else double.nan;#, style=plot.style_line, linewidth=1, color=color.new(color.black, 0), title="CVD MA")
#fill(plotRef1, plotRef2, color=customColor)
@Igor

Last edited by a moderator:
@zeek
Make sure you have:

Works fine for me.
View attachment 1082
Yes, thanks now i can see it too.
I did notice that when i have selected timeframe 10min or lower, there is a gap with missing data as can be seen in the pic below but anything higher than 10min will work fine. Pics below is with 10min and 15min timeframe selected on chart.

Edit: I can also see missing data on 15min charts so the timeframe selected doesn´t seem to be the problem..

Last edited:
I think it would be super useful on all stocks to spot potential bigger reversals and to see who is "in control" on any timeframe selected. Right now, it´s showing on some timeframes but not on others and i really hope there is a way to make the indicator work this way so i can see the clouds no matter the stock or chart timeframe selected.

This is by far the best indicator i´ve seen shared here in a long time. Thanks @SleepyZ for sharing it!

Last edited by a moderator:
Wondering if this could be made into a scanner?

Wondering if this could be made into a scanner?
I have played with this every which way and loose but it is not possible to get it to work in the Scan Hacker

The cumulative volume delta equation recurs back on itself. The Scan Hacker cannot resolve that on the current bar.
The 'normal' workaround is to scan for 2 or more bars ago but in this case, no dice.

Last edited:
The script isn’t working fro me, it shows empty space. any thoughts on that. thanks!!!

The script isn’t working fro me, it shows empty space. any thoughts on that. thanks!!!
I did not see any indication on how the author planned to use this. It seems that it works mostly on Daily charts, and on /ES for most intraday timeframes, mainly perhaps because of its trading pattern. The example you provided from TV showed it on a Daily Bitcoin chart. So try Daily charts and see if it plots for you. Perhaps you could let us know how it is to be used. Thanks.

Just found this indicator by accident. Man, this is great! Just need it to work on all timeframes.

Does the above need to be with TICK charts only? Or works with Minute Charts also?

Last edited by a moderator:
Just found this indicator by accident. Man, this is great! Just need it to work on all timeframes.
Does the above need to be with TICK charts only? Or works with Minute Charts also?
It works on all time frames. But does not work for all stocks.
Here it worked on the higher agg but not the lower agg chart

Here it worked on the lower agg but not the higher agg.

I don't trade the 1min chart but I have this indicator loaded on all other time frames and while sometimes there are blanks as shown above. The majority of the time, it works great. In those times, when it didn't load; many times, it saved me from entering trades that would have been unprofitable.

Last edited:
It works on all time frames. But does not work for all stocks.
Here it worked on the higher agg but not the lower agg chart

Here it worked on the lower agg but not the higher agg.

I don't trade the 1min chart but I have this indicator loaded on all other time frames and while sometimes there are blanks as shown above. The majority of the time, it works great. In those times, when it didn't load; many times, it saved me from entering trades that would have been unprofitable.
MerryDay, Do you know if this works on Futures?, /ES, /CL....Etc?

I tried installing this but I’m getting a blank screen most of the time, I think a link to a better version is broken. Can somebody please send the latest version of the Cumulative Delta study for ThinkorSwim?

I tried installing this but I’m getting a blank screen most of the time, I think a link to a better version is broken. Can somebody please send the latest version of the Cumulative Delta study for ThinkorSwim?
The indicator is problematic, it works sporadically, for some commodities, on some timeframes, some of the time.

Here is one that works:
Here is one that plots similar to the one in this post:

Status
Not open for further replies.

87k+ Posts
336 Online

## The Market Trading Game Changer

Join 2,500+ subscribers inside the useThinkScript VIP Membership Club
• Exclusive indicators
• Proven strategies & setups
• Private Discord community
• Exclusive members-only content
• 1 full year of unlimited support

What is useThinkScript?

useThinkScript is the #1 community of stock market investors using indicators and other tools to power their trading strategies. Traders of all skill levels use our forums to learn about scripting and indicators, help each other, and discover new ways to gain an edge in the markets.

How do I get started?

We get it. Our forum can be intimidating, if not overwhelming. With thousands of topics, tens of thousands of posts, our community has created an incredibly deep knowledge base for stock traders. No one can ever exhaust every resource provided on our site.

If you are new, or just looking for guidance, here are some helpful links to get you started.

What are the benefits of VIP Membership?