Trade Volume Delta Indicator for ThinkorSwim

@alexR Try this:

Code:
def condition1 = ChaikinOsc crosses above line2;
def condition2 = ChaikinOsc crosses below line1;

plot pDown = condition2;
pDown.SetPaintingStrategy(PaintingStrategy.BOOLEAN_ARROW_DOWN);
pDown.SetLineWeight(1);
pDown.AssignValueColor(COLOR.MAGENTA);

plot pUp = condition1;
pUp.SetPaintingStrategy(PaintingStrategy.BOOLEAN_ARROW_UP);
pUp.SetLineWeight(1);
pUp.AssignValueColor(COLOR.CYAN);
 

Join useThinkScript to post your question to a community of 21,000+ developers and traders.

Question. Is there a way to modify this indicator to support various Options?
For example, it would be handy to trade SPY Options while monitoring VIX (Options Delta change * Options Volume.) Thanks.
 
Hello,

Would it be possible to add divergences to the original script? Meaning, being able to identify divergences between price and cumulative delta?

-BW
 
Last edited:
Just thought I'd mention that if anybody trades RENKO, this indicator can be helpful. First of all, it's a volume indicator that actually works on RENKO. Many strategies have people exit on a reversal box. What I've noticed is that if a reversal box occurs and the CDV volume bar has not been significantly reduced (by at least roughly 1/4 or more) then most of the time the run will continue and you can take a chance to stay in the trade. Doesn't always work to keep you in every good run, but when it does it does. Test it out, hope it helps!
 
# CumulativeVolumeDeltaPlusDeltaSignals
#Pseudo Delta Signals based on Trade-Devils Footprint Indicator
#https://tradedevils-indicators.com/products/footprint-orderflow-indicator-ninjatrader
# The length of the accumulation is user controlled. The cumulative bar
# is the sum of the deltas for the past 10 bars. Change that length to
# 252 (a year in days) then plot something like AAPL. Very interesting.
#Comment out ring if audio alerts not wanted
# LongShort
# 5.7.2019

declare lower;
input length = 10;

def O = open;
def H = high;
def C = close;
def L = low;
def V = volume;

def Buying = V * (C - L) / (H - L);
def Selling = V * (H - C) / (H - L);
def Delt = buying - selling;

plot Delta = Delt;
Delta.AssignValueColor(if Delta > 0 then Color.GREEN else Color.RED);
Delta.SetPaintingStrategy(PaintingStrategy.HISTOGRAM);
Delta.hide();

Plot DeltaFadingBearish = rsi(5)>50 and Delta[2] > 0 and Delta[2] < Delta[3] and Delta[1]> 0 and Delta[1] < Delta[2] and Delta > 0 and Delta <Delta[1];

Plot DeltaFadingBullish = rsi(5)< 50 and Delta[2] < 0 and Delta[2] > Delta[3] and Delta[1]< 0 and Delta[1] > Delta[2] and Delta < 0 and Delta > Delta[1];

Plot DeltaRise = Delta > Delta[1] and Delta[1] > Delta[2] and Delta[2] > Delta[3] and Delta[3] > Delta[4];

Plot DeltaFall = Delta < Delta[1] and Delta[1] < Delta[2] and Delta[2] < Delta[3] and Delta[3] < Delta[4];

Plot DeltaDvgPos = Lowest(low,10) and close > close[1] and delta > 0 ;

Plot DeltaDvgNeg = Highest(high,10) and close < close[1] and delta < 0 ;

Plot DeltaTrapBullish = simpleMovingAvg(close,10)> simpleMovingAvg(close,20) and low[2] == Lowest(low,3) and close[2]< close[3] and delta[2]<0 and close[1]> close[2] and delta[1]>0 and close > close[1] and delta>delta[1] and close > high[2];

Plot DeltaTrapBearish = simpleMovingAvg(close,10) < simpleMovingAvg(close,20) and high[2] == highest(high,3) and close[2]> close[3] and delta[2]>0 and close[1]< close[2] and delta[1]<0 and close < close[1] and delta<delta[1] and close <low[2];

Plot DeltaSlingshotBull = rsi(5)[2]<45 and delta[2]<0 and close[2]< close[3] and delta[1]>0 and close[1] > close[2] and delta> delta[1] and close>close[1] and close> high[2];

Plot DeltaSlingshotBear = rsi(5)[2]>65 and delta[2]>0 and close[2]> close[3] and delta[1]<0 and close[1] <close[2] and delta<delta[1] and close<close[1] and close< low[2];

Plot DeltaSweepBull = rsi(5)[1]<45 and delta[1]<0 and close[1]< close[2] and delta >0 and close > close[1] and volume >volume[1]*2;

Plot DeltaSweepBear = rsi(5)[1]>65 and delta[1]>0 and close[1]>close[2] and delta <0 and close < close[1] and volume >volume[1]*2;

Plot DeltaFadingBearishIntraday = close is greater than vwap and rsi(5)>50 and Delta[2] > 0 and Delta[2] < Delta[3] and Delta[1]> 0 and Delta[1] < Delta[2] and Delta > 0 and Delta <Delta[1];

Plot DeltaFadingBullishIntraday = close is less than vwap and rsi(5)< 50 and Delta[2] < 0 and Delta[2] > Delta[3] and Delta[1]< 0 and Delta[1] > Delta[2] and Delta < 0 and Delta > Delta[1];

Plot DeltaRiseIntraday = close is greater than vwap and Delta > Delta[1] and Delta[1] > Delta[2] and Delta[2] > Delta[3] and Delta[3] > Delta[4];

Plot DeltaFallIntraday = close is less than vwap and Delta < Delta[1] and Delta[1] < Delta[2] and Delta[2] < Delta[3] and Delta[3] < Delta[4];

Plot DeltaDvgPosIntraday = close is less than vwap and Lowest(low,10) and close > close[1] and delta > 0 ;

Plot DeltaDvgNegIntraday = close is greater than vwap and Highest(high,10) and close < close[1] and delta < 0 ;

Plot DeltaTrapBullishIntraday = close is greater than vwap and simpleMovingAvg(close,10)> simpleMovingAvg(close,20) and low[2] == Lowest(low,3) and close[2]< close[3] and delta[2]<0 and close[1]> close[2] and delta[1]>0 and close > close[1] and delta>delta[1] and close > high[2];

Plot DeltaTrapBearishIntraday = close is less than vwap and simpleMovingAvg(close,10) < simpleMovingAvg(close,20) and high[2] == highest(high,3) and close[2]> close[3] and delta[2]>0 and close[1]< close[2] and delta[1]<0 and close < close[1] and delta<delta[1] and close <low[2];

Plot DeltaSlingshotBullIntraday = close is less than vwap and rsi(5)[2]<45 and delta[2]<0 and close[2]< close[3] and delta[1]>0 and close[1] > close[2] and delta> delta[1] and close>close[1] and close> high[2];

Plot DeltaSlingshotBearIntraday = close is less than vwap and rsi(5)[2]>65 and delta[2]>0 and close[2]> close[3] and delta[1]<0 and close[1] <close[2] and delta<delta[1] and close<close[1] and close< low[2];

Plot DeltaSweepBullIntraday = close is greater than vwap and rsi(5)[1]<45 and delta[1]<0 and close[1]< close[2] and delta >0 and close > close[1] and volume >volume[1]*2;

Plot DeltaSweepBearIntraday = close is less than vwap and rsi(5)[1]>65 and delta[1]>0 and close[1]>close[2] and delta <0 and close < close[1] and volume >volume[1]*2;

#Alerts
def DeltaFadingBearishAlert = DeltaFadingBearish;
Alert(DeltaFadingBearishAlert,"DeltaFadingBearish", Alert.Bar, Sound.Ring);

def DeltaFadingBullishAlert = DeltaFadingBullish;
Alert(DeltaFadingBullishAlert,"DeltaFadingBullish", Alert.Bar, Sound.Ring);

def DeltaRiseAlert = DeltaRise;
Alert(DeltaRiseAlert,"DeltaRise", Alert.Bar, Sound.Ring);

def DeltaFallAlert = DeltaFall;
Alert(DeltaFallAlert," DeltaFall", Alert.Bar, Sound.Ring);

def DeltaDvgPosAlert = DeltaDvgPos;
Alert(DeltaDvgPosAlert,"DeltaDvgPos", Alert.Bar, Sound.Ring);

def DeltaDvgNegAlert = DeltaDvgNeg;
Alert(DeltaDvgNegAlert,"DeltaDvgNeg", Alert.Bar, Sound.Ring);

def DeltaTrapBullishAlert = DeltaTrapBullish;
Alert(DeltaTrapBullishAlert,"DeltaTrapBullish", Alert.Bar, Sound.Ring);

def DeltaTrapBearishAlert = DeltaTrapBearish;
Alert(DeltaTrapBearishAlert,"DeltaTrapBearish", Alert.Bar, Sound.Ring);

def DeltaSlingshotBullAlert = DeltaSlingshotBull;
Alert(DeltaSlingshotBullAlert," DeltaSlingshotBull", Alert.Bar, Sound.Ring);

def DeltaSlingshotBearAlert = DeltaSlingshotBear;
Alert(DeltaSlingshotBearAlert,"DeltaSlingshotBear", Alert.Bar, Sound.Ring);

def DeltaSweepBullAlert = DeltaSweepBull;
Alert(DeltaSweepBullAlert,"DeltaSweepBull", Alert.Bar, Sound.Ring);

def DeltaSweepBearAlert = DeltaSweepBear;
Alert(DeltaSweepBearAlert,"DeltaSweepBear", Alert.Bar, Sound.Ring);


plot zero = 0;
zero.setDefaultColor(Color.BLUE);

plot CumulativeVolumeDelta = sum(Delta,length);
CumulativeVolumeDelta.AssignValueColor(if CumulativeVolumeDelta > 0 then Color.GREEN else Color.RED);
CumulativeVolumeDelta.SetPaintingStrategy(PaintingStrategy.HISTOGRAM);

Plot CumulativeDeltaTrendBuyIntraday = close is greater than vwap and rsi(5)<50 and CumulativeVolumeDelta >0;

Plot CumulativeDeltaTrendSellIntraday = close is less than vwap and rsi(5)>50 and CumulativeVolumeDelta < 0;

def CumulativeDeltaTrendBuyIntradayAlert = CumulativeDeltaTrendBuyIntraday;
Alert(CumulativeDeltaTrendBuyIntradayAlert,"CumulativeDeltaTrendBuyIntraday", Alert.Bar, Sound.Ring);
def CumulativeDeltaTrendSellIntradayAlert = CumulativeDeltaTrendSellIntraday;
Alert(CumulativeDeltaTrendSellIntradayAlert,"CumulativeDeltaTrendSellIntraday", Alert.Bar, Sound.Ring);
 
Last edited by a moderator:
@cesarword
declare lower;
declare zerobase;

Input agg = aggregationPeriod.DAY;

def ASK = tick_count(priceType = PriceType.ASK, period = Agg);
def BID = tick_count(priceType = PriceType.BID , period = Agg);
def MARK = tick_count(priceType = PriceType.MARK , period = Agg);
def LAST = tick_count(priceType = PriceType.LAST , period = Agg);
def ba = BID - ASK;
plot data = Sum(ba , 100);
How could this be plotted as candles?
 
# CumulativeVolumeDeltaPlusDeltaSignals
#Pseudo Delta Signals based on Trade-Devils Footprint Indicator
#https://tradedevils-indicators.com/products/footprint-orderflow-indicator-ninjatrader
# The length of the accumulation is user controlled. The cumulative bar
# is the sum of the deltas for the past 10 bars. Change that length to
# 252 (a year in days) then plot something like AAPL. Very interesting.
#Comment out ring if audio alerts not wanted
# LongShort
# 5.7.2019

declare lower;
input length = 10;

def O = open;
def H = high;
def C = close;
def L = low;
def V = volume;

def Buying = V * (C - L) / (H - L);
def Selling = V * (H - C) / (H - L);
def Delt = buying - selling;

plot Delta = Delt;
Delta.AssignValueColor(if Delta > 0 then Color.GREEN else Color.RED);
Delta.SetPaintingStrategy(PaintingStrategy.HISTOGRAM);
Delta.hide();

Plot DeltaFadingBearish = rsi(5)>50 and Delta[2] > 0 and Delta[2] < Delta[3] and Delta[1]> 0 and Delta[1] < Delta[2] and Delta > 0 and Delta <Delta[1];

Plot DeltaFadingBullish = rsi(5)< 50 and Delta[2] < 0 and Delta[2] > Delta[3] and Delta[1]< 0 and Delta[1] > Delta[2] and Delta < 0 and Delta > Delta[1];

Plot DeltaRise = Delta > Delta[1] and Delta[1] > Delta[2] and Delta[2] > Delta[3] and Delta[3] > Delta[4];

Plot DeltaFall = Delta < Delta[1] and Delta[1] < Delta[2] and Delta[2] < Delta[3] and Delta[3] < Delta[4];

Plot DeltaDvgPos = Lowest(low,10) and close > close[1] and delta > 0 ;

Plot DeltaDvgNeg = Highest(high,10) and close < close[1] and delta < 0 ;

Plot DeltaTrapBullish = simpleMovingAvg(close,10)> simpleMovingAvg(close,20) and low[2] == Lowest(low,3) and close[2]< close[3] and delta[2]<0 and close[1]> close[2] and delta[1]>0 and close > close[1] and delta>delta[1] and close > high[2];

Plot DeltaTrapBearish = simpleMovingAvg(close,10) < simpleMovingAvg(close,20) and high[2] == highest(high,3) and close[2]> close[3] and delta[2]>0 and close[1]< close[2] and delta[1]<0 and close < close[1] and delta<delta[1] and close <low[2];

Plot DeltaSlingshotBull = rsi(5)[2]<45 and delta[2]<0 and close[2]< close[3] and delta[1]>0 and close[1] > close[2] and delta> delta[1] and close>close[1] and close> high[2];

Plot DeltaSlingshotBear = rsi(5)[2]>65 and delta[2]>0 and close[2]> close[3] and delta[1]<0 and close[1] <close[2] and delta<delta[1] and close<close[1] and close< low[2];

Plot DeltaSweepBull = rsi(5)[1]<45 and delta[1]<0 and close[1]< close[2] and delta >0 and close > close[1] and volume >volume[1]*2;

Plot DeltaSweepBear = rsi(5)[1]>65 and delta[1]>0 and close[1]>close[2] and delta <0 and close < close[1] and volume >volume[1]*2;

Plot DeltaFadingBearishIntraday = close is greater than vwap and rsi(5)>50 and Delta[2] > 0 and Delta[2] < Delta[3] and Delta[1]> 0 and Delta[1] < Delta[2] and Delta > 0 and Delta <Delta[1];

Plot DeltaFadingBullishIntraday = close is less than vwap and rsi(5)< 50 and Delta[2] < 0 and Delta[2] > Delta[3] and Delta[1]< 0 and Delta[1] > Delta[2] and Delta < 0 and Delta > Delta[1];

Plot DeltaRiseIntraday = close is greater than vwap and Delta > Delta[1] and Delta[1] > Delta[2] and Delta[2] > Delta[3] and Delta[3] > Delta[4];

Plot DeltaFallIntraday = close is less than vwap and Delta < Delta[1] and Delta[1] < Delta[2] and Delta[2] < Delta[3] and Delta[3] < Delta[4];

Plot DeltaDvgPosIntraday = close is less than vwap and Lowest(low,10) and close > close[1] and delta > 0 ;

Plot DeltaDvgNegIntraday = close is greater than vwap and Highest(high,10) and close < close[1] and delta < 0 ;

Plot DeltaTrapBullishIntraday = close is greater than vwap and simpleMovingAvg(close,10)> simpleMovingAvg(close,20) and low[2] == Lowest(low,3) and close[2]< close[3] and delta[2]<0 and close[1]> close[2] and delta[1]>0 and close > close[1] and delta>delta[1] and close > high[2];

Plot DeltaTrapBearishIntraday = close is less than vwap and simpleMovingAvg(close,10) < simpleMovingAvg(close,20) and high[2] == highest(high,3) and close[2]> close[3] and delta[2]>0 and close[1]< close[2] and delta[1]<0 and close < close[1] and delta<delta[1] and close <low[2];

Plot DeltaSlingshotBullIntraday = close is less than vwap and rsi(5)[2]<45 and delta[2]<0 and close[2]< close[3] and delta[1]>0 and close[1] > close[2] and delta> delta[1] and close>close[1] and close> high[2];

Plot DeltaSlingshotBearIntraday = close is less than vwap and rsi(5)[2]>65 and delta[2]>0 and close[2]> close[3] and delta[1]<0 and close[1] <close[2] and delta<delta[1] and close<close[1] and close< low[2];

Plot DeltaSweepBullIntraday = close is greater than vwap and rsi(5)[1]<45 and delta[1]<0 and close[1]< close[2] and delta >0 and close > close[1] and volume >volume[1]*2;

Plot DeltaSweepBearIntraday = close is less than vwap and rsi(5)[1]>65 and delta[1]>0 and close[1]>close[2] and delta <0 and close < close[1] and volume >volume[1]*2;

#Alerts
def DeltaFadingBearishAlert = DeltaFadingBearish;
Alert(DeltaFadingBearishAlert,"DeltaFadingBearish", Alert.Bar, Sound.Ring);

def DeltaFadingBullishAlert = DeltaFadingBullish;
Alert(DeltaFadingBullishAlert,"DeltaFadingBullish", Alert.Bar, Sound.Ring);

def DeltaRiseAlert = DeltaRise;
Alert(DeltaRiseAlert,"DeltaRise", Alert.Bar, Sound.Ring);

def DeltaFallAlert = DeltaFall;
Alert(DeltaFallAlert," DeltaFall", Alert.Bar, Sound.Ring);

def DeltaDvgPosAlert = DeltaDvgPos;
Alert(DeltaDvgPosAlert,"DeltaDvgPos", Alert.Bar, Sound.Ring);

def DeltaDvgNegAlert = DeltaDvgNeg;
Alert(DeltaDvgNegAlert,"DeltaDvgNeg", Alert.Bar, Sound.Ring);

def DeltaTrapBullishAlert = DeltaTrapBullish;
Alert(DeltaTrapBullishAlert,"DeltaTrapBullish", Alert.Bar, Sound.Ring);

def DeltaTrapBearishAlert = DeltaTrapBearish;
Alert(DeltaTrapBearishAlert,"DeltaTrapBearish", Alert.Bar, Sound.Ring);

def DeltaSlingshotBullAlert = DeltaSlingshotBull;
Alert(DeltaSlingshotBullAlert," DeltaSlingshotBull", Alert.Bar, Sound.Ring);

def DeltaSlingshotBearAlert = DeltaSlingshotBear;
Alert(DeltaSlingshotBearAlert,"DeltaSlingshotBear", Alert.Bar, Sound.Ring);

def DeltaSweepBullAlert = DeltaSweepBull;
Alert(DeltaSweepBullAlert,"DeltaSweepBull", Alert.Bar, Sound.Ring);

def DeltaSweepBearAlert = DeltaSweepBear;
Alert(DeltaSweepBearAlert,"DeltaSweepBear", Alert.Bar, Sound.Ring);


plot zero = 0;
zero.setDefaultColor(Color.BLUE);

plot CumulativeVolumeDelta = sum(Delta,length);
CumulativeVolumeDelta.AssignValueColor(if CumulativeVolumeDelta > 0 then Color.GREEN else Color.RED);
CumulativeVolumeDelta.SetPaintingStrategy(PaintingStrategy.HISTOGRAM);

Plot CumulativeDeltaTrendBuyIntraday = close is greater than vwap and rsi(5)<50 and CumulativeVolumeDelta >0;

Plot CumulativeDeltaTrendSellIntraday = close is less than vwap and rsi(5)>50 and CumulativeVolumeDelta < 0;

def CumulativeDeltaTrendBuyIntradayAlert = CumulativeDeltaTrendBuyIntraday;
Alert(CumulativeDeltaTrendBuyIntradayAlert,"CumulativeDeltaTrendBuyIntraday", Alert.Bar, Sound.Ring);
def CumulativeDeltaTrendSellIntradayAlert = CumulativeDeltaTrendSellIntraday;
Alert(CumulativeDeltaTrendSellIntradayAlert,"CumulativeDeltaTrendSellIntraday", Alert.Bar, Sound.Ring);
Thank you for sharing this!
 

Similar threads

Not the exact question you're looking for?

Start a new thread and receive assistance from our community.

87k+ Posts
315 Online
Create Post

Similar threads

Similar threads

The Market Trading Game Changer

Join 2,500+ subscribers inside the useThinkScript VIP Membership Club
  • Exclusive indicators
  • Proven strategies & setups
  • Private Discord community
  • ‘Buy The Dip’ signal alerts
  • Exclusive members-only content
  • Add-ons and resources
  • 1 full year of unlimited support

Frequently Asked Questions

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?
VIP members get exclusive access to these proven and tested premium indicators: Buy the Dip, Advanced Market Moves 2.0, Take Profit, and Volatility Trading Range. In addition, VIP members get access to over 50 VIP-only custom indicators, add-ons, and strategies, private VIP-only forums, private Discord channel to discuss trades and strategies in real-time, customer support, trade alerts, and much more. Learn all about VIP membership here.
How can I access the premium indicators?
To access the premium indicators, which are plug and play ready, sign up for VIP membership here.
Back
Top