NextSignals Aggressive Buy & Sell Volume For ThinkOrSwim

Tiredoflosing

Member
Hi everyone,
Im sharing Doctor Stephen Harlins work he shared on his Twitter. He can be found here on Twitter. His posts are of tremendous value.
The tweet containing this work is here & here

According to him

" I'm sharing this code purely for educational purposes. Please don't trade this without fully understanding it. And I can't teach individuals how to import studies into ThinkorSwim or troubleshoot your platform, etc.

(2/3) The concept works best on a tick chart for reasons beyond the scope of this tweet. The study just says, "Show me (highlight) price bars that are above average in volume and price range, that also push the close well off of the high(selling press) or low (buying press)."

(3/3) That would highlight/infer the presence of "aggressive" orders. The white-tagged price bars display when the above conditions are met - plus an extreme in a high or low falls outside of a stDev calc (modif'd Bollinger Band). A forthcoming tweet will compliment this.

It looks like this.

FYI im simply sharing his work so the community can possibly benefit, I haven't gotten a chance to take it for a spin live.

Code:
``````plot zero = 0;
zero.setdefaultcolor(color.black);

def seconds = SecondsFromTime(0);
def time = SecondsTillTime (1600);
def minutes = seconds / 3600;
def RTH = minutes > 8 and minutes < 16.5;

def sDev = StDev(data = close, 20);
def mid = MovingAverage(AverageType.SIMPLE, close, 20);
def lowerBand = mid -1 * sDev;
def upperBand = mid - (-1.918) * sDev;

def range = AbsValue(open - close);
def WAvg = WildersAverage(range, 20);
def avgVolume = ExpAverage(volume,50);
def bp= (close - low)/(high - low) > 0.75;
def sp = (high - close)/(high - low) > 0.75;
def up = close > open and range > Wavg and volume > avgVolume and bp;
def dn = close < open and range > wavg and volume > avgVolume and sp;

plot hiupvol = if up and !up[1] then round(volume/1000,0) else double.nan;
hiupvol.setpaintingstrategy(paintingstrategy.values_below);
hiupvol.setdefaultcolor(color.green);
hiupvol.assignvaluecolor(if low < lowerBand and range > wavg and volume > avgVolume and bp then color.white else color.current);
hiupvol.hidetitle();
plot hidnvol = if dn and !dn[1] then round(volume/1000,0) else double.nan;
hidnvol.setpaintingstrategy(paintingstrategy.values_above);
hidnvol.setdefaultcolor(color.red);
hidnvol.assignvaluecolor(if high > upperBand and range > wavg and volume > avgVolume and sp then color.white else color.current);
hidnvol.hidetitle();

DefineGlobalColor("color1",  createcolor(0,132,193)) ;
DefineGlobalColor("color2",  color.green) ;
DefineGlobalColor("color3",  color.red) ;
DefineGlobalColor("color4",  createcolor(60,80,120)) ;
assignpricecolor(if RTH and !up and !dn then GlobalColor("color1") else if up then GlobalColor("color2") else if dn then GlobalColor("color3") else GlobalColor("color4"));``````

Last edited by a moderator:
Love that it shows aggressive buy and sell. This would be great for a price action scalper to buy the rip and sell the dip. An interesting indicator that I will defiantly be using in my scalping strategy. Thanks for sharing !!

Love that it shows aggressive buy and sell. This would be great for a price action scalper to buy the rip and sell the dip. An interesting indicator that I will defiantly be using in my scalping strategy. Thanks for sharing !!
let us know how it works out for ya!

any way that this script could be changed so that you can change the color of all the candles to personal preference?

I have this version of the script below which colors the aggressive buying and selling bars green and red, while the rest remain dark blue, I want to be able to change them to my preference colors

plot zero = 0;
zero.setdefaultcolor(color.black);

def seconds = SecondsFromTime(0);
def time = SecondsTillTime (1600);
def minutes = seconds / 3600;
def RTH = minutes > 8 and minutes < 16.5;

def sDev = StDev(data = close, 20);
def mid = MovingAverage(AverageType.SIMPLE, close, 20);
def lowerBand = mid -1 * sDev;
def upperBand = mid - (-1.918) * sDev;

def range = AbsValue(open - close);
def WAvg = WildersAverage(range, 20);
def avgVolume = ExpAverage(volume,50);
def bp= (close - low)/(high - low) > 0.75;
def sp = (high - close)/(high - low) > 0.75;
def up = close > open and range > Wavg and volume > avgVolume and bp;
def dn = close < open and range > wavg and volume > avgVolume and sp;

plot hiupvol = if up and !up[1] then round(volume/1000,0) else double.nan;
hiupvol.setpaintingstrategy(paintingstrategy.values_below);
hiupvol.setdefaultcolor(color.green);
hiupvol.assignvaluecolor(if low < lowerBand and range > wavg and volume > avgVolume and bp then color.white else color.current);
hiupvol.hidetitle();
plot hidnvol = if dn and !dn[1] then round(volume/1000,0) else double.nan;
hidnvol.setpaintingstrategy(paintingstrategy.values_above);
hidnvol.setdefaultcolor(color.red);
hidnvol.assignvaluecolor(if high > upperBand and range > wavg and volume > avgVolume and sp then color.white else color.current);
hidnvol.hidetitle();

assignpricecolor(if RTH and !up and !dn then createcolor(0,132,193) else if up then color.green else if dn then color.red else createcolor(60,80,120));

Last edited by a moderator:
any way that this script could be changed so that you can change the color of all the candles to personal preference?
The top post has been updated so that "you can change the color of all the candles to personal preference".
1. Copy & paste the new script from the top post
2. click on the gear to the right of the study after you add it to your chart
3. click on Globals
4. click on the color that you want to change
5. REMEMBER: to click on "Save As Default" at the top of the box.
So you don't have to constantly re-do your changes every time you add the indicator to a chart.​

Last edited:
any way to make a watchlist column for this?

any way to make a watchlist column for this?
Here ya go:
Ruby:
``````plot zero = 0;
zero.setdefaultcolor(color.black);

def seconds = SecondsFromTime(0);
def time = SecondsTillTime (1600);
def minutes = seconds / 3600;
def RTH = minutes > 8 and minutes < 16.5;

def sDev = StDev(data = close, 20);
def mid = MovingAverage(AverageType.SIMPLE, close, 20);
def lowerBand = mid -1 * sDev;
def upperBand = mid - (-1.918) * sDev;

def range = AbsValue(open - close);
def WAvg = WildersAverage(range, 20);
def avgVolume = ExpAverage(volume,50);
def bp= (close - low)/(high - low) > 0.75;
def sp = (high - close)/(high - low) > 0.75;
def up = close > open and range > Wavg and volume > avgVolume and bp;
def dn = close < open and range > wavg and volume > avgVolume and sp;

assignbackgroundColor(
if RTH and !up and !dn then createcolor(0,132,193) else
if up then color.green else
if dn then color.red else createcolor(60,80,120));``````

Not the exact question you're looking for?

87k+ Posts
315 Online

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?