$VOLD Divergence Indicator for ThinkorSwim

BenTen

BenTen

Administrative
Staff
VIP
Here is an indicator that shows divergences between $VOLD and $SPY. A divergence happen when the price disagree with an indicator or an index. In this case, it's the $VOLD index. VOLD is the difference between the up volume and down volume on the NYSE.

How to trade:

  • When the price of SPY is going up while $VOLD is heading lower, we have a bearish divergence = short
  • When the price of SPY is going down while $VOLD is heading higher, we have a bullish divergence = long
You don't need an indicator for this, just create a side-by-side chart in ThinkorSwim and have both tickers on display. Or you can use the following indicator and only need to have one chart. Pick whichever works best for you.

I put this indicator together so that I can quickly check for divergences all in one chart.

thinkScript Code

Code:
# VOLD and SPY Divergences
# Assembled by BenTen at useThinkScript.com
# Discussion https://usethinkscript.com/threads/vold-divergence-indicator-for-thinkorswim.715/

declare lower;

input symbol_1 = "SPY";
def IsUp = close > open;
def IsDown = close < open;
def U = close("$UVOL");
def D = close("$DVOL");
def UDL = U - D;

plot volume;
def volume_confirm = UDL > UDL[5];
def volume_confirm2 = UDL > UDL[5];

volume.SetPaintingStrategy(paintingStrategy.SQUARED_HISTOGRAM);
volume.assignValueColor(if volume_confirm then Color.green else Color.red);

if (GetUnderlyingSymbol() == symbol_1)
{
  volume =  UDL;
}
else
{
  volume = double.nan;
}

AddLabel(yes,"SPY Only", color.white);

assignPriceColor(if volume_confirm then color.green else color.red);

Here's how it works:

The direction of the candles is based on $SPY. The color of the candles is based on $VOLD. If you see SPY moving down, but the candles remains green, then there is a possible bullish divergence. Same goes for when SPY is moving up, but the candles are red, there is a potential bearish divergence.






This method is just one way of utilizing the market internals to trade. I heard some people also use $ADD and $TICK. Here's a quick overview of Market Internals.
 
Last edited:
J

john3

Active member
2019 Donor
@BenTen Would you please include the URL of the thread in the study's header. Just makes it easier to go back to it if needed. Thank you.
 
W

washytrader

New member
VIP
Can you include the share link for the indicator? Thanks
 
BenTen

BenTen

Administrative
Staff
VIP
@washytrader I prefer not to since I want to keep it private for Warehouse members only.
 
C

Charles

New member
Lifetime
I like this indicator, but was wondering if it would be useful to color the divergent bars a different color. For example, a divergent green bar would be colored a lighter shade of red and a divergent red bar a lighter shade of green. This would keep the divergent trend easy to see, but give a bit more information.
 
BenTen

BenTen

Administrative
Staff
VIP
@Charles You would still have to identify the divergence on your own. The coloring just suggest that there might be a divergence. See the examples I provided. SPY going up but the candles are red (this suggest there might be a bearish divergence).
 
T

tdvayreda

New member
Is this code suitable for the pine editor in TradingView?
 
BenTen

BenTen

Administrative
Staff
VIP
@tdvayreda Pine script and thinkScript are two different language. It won't work out of the box. You will need to convert it to pinescript.
 
T

tdvayreda

New member
Thank you for this quick response. One more question? Is there a program to convert this script? Or do I have to write it myself in pinescript?
Tnx
 
BenTen

BenTen

Administrative
Staff
VIP
@tdvayreda There is no automatic way to convert them. You have to understand both languages in order to get the job done.
 
W

we29125

Member
@BenTen can use this code as divergence for $TICK ? Can assist...?
 
W

we29125

Member

Would this code work ? @BenTen

Code:
# $TICK and SPY Divergences
# Assembled by BenTen at useThinkScript.com
# Discussion https://usethinkscript.com/threads/vold-divergence-indicator-for-thinkorswim.715/

declare lower;

input symbol_1 = "SPY";
def IsUp = close > 0;
def IsDown = close < 0;
def UDL = close("$TICK");

plot volume;
def volume_confirm = UDL > UDL[5];

volume.SetPaintingStrategy(paintingStrategy.SQUARED_HISTOGRAM);
volume.assignValueColor(if volume_confirm then Color.green else Color.red);

if (GetUnderlyingSymbol() == symbol_1)
{
  volume =  UDL;
}
else
{
  volume = double.nan;
}

AddLabel(yes,"SPY Only", color.white);

assignPriceColor(if volume_confirm then color.green else color.red);
 
Last edited:

Similar threads

Top