Unusual Volume For ThinkOrSwim

BenTen

Administrative
Staff member
Staff
VIP
Lifetime
Here is a scanner that will help you screen for stocks with unusual volume in ThinkorSwim. When a stock suddenly increased or decreased in trading volume, that means it's being traded at an unexpectedly high level and a lot of traders often take advantage of this.

Create a new indicator in ThinkorSwim and import this code. You can add it to your chart but it won't do anything to it. Switch over to the Scan tab and look up the name of your indicator. From there you can scan for stocks that are increasing or decreasing in trading volume. You can also adjust the percentage (%) and length.

vI0osbR.png

CGFmLwm.png


thinkScript Code

Code:
# UNUSUALVOLUME
# DREWGRIFFITH15 (C) 2014

input price = volume;
input choice = {default increased, decreased};
input percent = 10;
input length = 50;
def avg = average(price, length)[1];
def chg = 100 * (price/avg -1);
plot scan;

switch (choice) {
case increased:
    scan = chg >= percent;
case decreased:
    scan = chg <= -percent;
}

Shareable Link

https://tos.mx/msxN1Z

Credit
  • hwrdprkns
 

Attachments

  • vI0osbR.png
    vI0osbR.png
    67.5 KB · Views: 975
  • CGFmLwm.png
    CGFmLwm.png
    75.7 KB · Views: 1,274

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

To augment the above scan, take a look at putting Stock Sizzle and Sizzle Index as 2 columns in the watch list. That way you can compare if the stock volume was also followed by high options activity. Just a thought, cause it's what I use for every scan.
 
Here is an extreme volume scanner based on a standard deviation envelope

Code:
# Extreme Volume Scan
# Set to Daily Aggregation

# This script picks up abnormal volume over a period of time. Much more likely to be a large trader taking a position

def v = if isNaN(volume) then v[1] else volume;
def norm = Average(volume, 50);
def SD = StDev(v, 50);
def Upper = norm + SD;
def Lower = norm - SD;
def Extreme = (v - Lower) / (Upper - Lower) * 100;
plot cond = if Extreme > 100 then 1 else 0;
 
Great...but is this an actual RELATIVE scan? For example...does it compare 1pm on Thursday to the last 20 1pm bars going back Wed Tues Monday etc...

All volume indicators don't say much unless they can actually compare last 20 "hour to hour" (not last 20 hours). Most morning opening hours are inflated as well as closing hours.
 
@toncuz The code I posted is an EXTREME volume scan by looking at volume bursts beyond a standard deviation move. Not relative volume as you described though.

@rahul_4u40 Hey, no problem. Here's a scan for stocks with volume spiking at least 300% above the 50 day volume moving average

Code:
def VA = VolumeAvg(50).VolAvg;
plot scan = volume > 3 * VA;

Just for grins, I just ran a scan on the S&P 500 (daily) aggregation and found 6 stocks that met this criteria
Tickers: ADSK, CELG, DE, DLTR, KEYS, UA

Load these tickers on your chart (daily) aggregation and watch those volumes!
Now that's what I call a real spike. Have fun
 
Somebody can helpme with and indicator to change color of a volume bars, depending of the pattern.

1.- Color ORANGE if the bar is grater than the first bar of the day.
2.- Color WHITE to the pattern if we have 3 consecutive bars any color down.
3.- Color BLUE to the pattern if we have 3 consecutive red bars growing.
4.- Color CYAN to the pattern if we have a range of 5 or more combined bars

Thanks for your help, if i need to pay for this please tellme how much i cost.
 
@toncuz I thought that this was covered before but just in case, here goes:

Can you cite a CMT that agrees with your point of view? JC Parets doesn't even use volume on his charts. That doesn't make him right, but with a large corporate clientele and 55,000 twitter followers I'd say people listen to him.

I don't know of any trading platform that offers volume as you describe it, please correct me. Most do have VWAP. You might want to look at VWAP. VWAP is used by day traders and swing traders and it taught in order to pass the CMT exam. A wise mathematician told me and others many times that each day, for day traders, it is a coin flip. Relative volume will tell you little to nothing because comparing 1pm today from 1pm last week Wednesday each have distinct news events and institutional rotation among a host of other items. Just because volume is higher or lower doesn't tell anyone if a stock is being accumulated or not. I could be short sellers covering.

You might want to look at VWAP. VWAP is used by day traders and swing traders and it taught in order to pass the CMT exam. In the end, you are free to have your own ideas. I just can't see this one having credence. Have a good holiday.
 
Last edited:
Unusual Volume near 52 weeks high scanner: https://tos.mx/qksBhga

9Dlvd5q.png


1. Near 52 week high indicates strength
2. Unusual volume indicates current interest at peak
3. Sorting on Zscore or DMI oscillator --> intraday strength
4. Sustained momentum --> Daily and weekly RSI >60
5. Green on E1, E5, E15, E30, E4h --> strength
6. Chart Observations -> REGN is a good candidate at this time
7. Only possibility, it can change any time


The basic concept of Z-Score is that it’s an oscillator denominated in standard deviations from the VWAP mean.
 
Last edited by a moderator:
@BenTen I’m trying to add something like this to a pattern thinkscript for a scan

the goal is to have the 1st bar of the pattern to show a 300% or more increase in volume relative to previous volume as part of validating the pattern

but ONLY the first bar

any insight into how to add this to a pattern scan script?

and also where would I put it so it applies to ONLY the first bar?
 
@Billiebanks By default, your scanner will look for results within the first (latest) bar. There is no need to change anything unless you want to look further back, but that's not your goal.
 
I’m currently working on creating a pattern scan that will detect a 3 bar play pattern specifically

The pattern is described as an unusually long candle body, followed by one or two resting candle bodies

I was formulating based in catching the long igniting bar and the resting bar/bars in between BEFORE the breakout

(Breakout should be followed by a third/fourth long body)

Some of what I’ve worked on so far in pattern thinkscript editor

Sorry I don’t have my laptop with me but

1st bar: up bar - I need to detect the 3x or more volume on this bar only *

2nd bar : multiple bar - where I set parameters
(Low of #1 < open #2)
(Low of #1 < close #2)
(High of #1 greater or equal high #2)
(Open #1 < low #2)
(Low of #1 < low #2)
(Close of #1 greater or equal close #2)
(Open of #1 < open #2)
(Close of #1 greater than or equal high #2)

So I think all I need is the volume identified in the first bar of the pattern as +3x and a possible alert when the last bar breaks the previous high right?

here is the scan so far...

Code:
def IsUp = close > open;
def IsDown = close < open;
def IsDoji = IsDoji();
def avgRange = 0.05 * Average(high - low, 20);
plot PatternPlot =
    IsUp[2] and
    ((Sum(IsUp, 2)[0] >= 0)) and
    high[2] >= Highest(high[0], 2) and
    open[2] < open[1] and
    close[2] >= close[0] and
    close[2] >= Highest(high[0], 2) and
    low[2] < Lowest(low[0], 2) and
    low[2] < close[0] and
    low[2] < open[1] and
    open[2] < Lowest(low[0], 2);

1. i need to get the volume of the bar that STARTS this pattern to be specified as 200-300% volume compared to the previous 20-50-100 bars/ticks
( i would like to be able to change the volume increase percentage and ammt of time its looking back)

2. i would like to make sure the candles that come AFTER the high volume bar do not retrace more than 65% of that first high volume bar if possible
(i would like to be able to adjust retracement %)

and that should prob do it

been trying to get like you @BenTen

here is the pattern scan so far... sorry for spamming im new to this channel

Code:
def IsUp = close > open;
def IsDown = close < open;
def IsDoji = IsDoji();
def avgRange = 0.05 * Average(high - low, 20);
plot PatternPlot =
IsUp[2] and
((Sum(IsUp, 2)[0] >= 0)) and
high[2] >= Highest(high[0], 2) and
open[2] < open[1] and
close[2] >= close[0] and
close[2] >= Highest(high[0], 2) and
low[2] < Lowest(low[0], 2) and
low[2] < close[0] and
low[2] < open[1] and
open[2] < Lowest(low[0], 2);
  1. i need to get the volume of the bar that STARTS this pattern to be specified as 200-300% volume compared to the previous 20-50-100 bars/ticks
    ( i would like to be able to change the volume increase percentage and ammt of time its looking back)
  2. i would like to make sure the candles that come AFTER the high volume bar do not retrace more than 65% of that beginning bar if possible, that would filter out alot of the false positives
    (i would like to be able to adjust retracement % if possible)
  3. seems to be only bringing up patterns that have 2 resting bars, i haven't seen any patterns that have only 1 resting bar i would like it to make sure BOTH 1 and 2 resting bar patterns show in the scan
I have paired that with the increased volume scan to attempt to get the result I'm looking for..

but i would prefer something that can track the candle that starts the pattern above only

Here is that code, i just tweaked to make sure only bullish signals but i like how i can interchange percent and length. how do i get that on the beginning candle of the pattern above????

Code:
# UNUSUALVOLUME

# DREWGRIFFITH15 (C) 2014



input price = volume;

input choice = {default increased, decreased};

input percent = 300;

input length = 200;

def avg = average(price, length)[1];

def chg = 100 * (price/avg -1);

plot scan;



switch (choice) {

case increased:

scan = chg >= percent;

}
 
Last edited by a moderator:
Good day. Can anyone help me with background color for watchlist indicator "unusual volume", code is below:

Code:
#Wizard input: price
#Wizard text: is at least
#Wizard input: percent
#Wizard text: %
#Wizard input: Choice
#Wizard text: than
#Wizard input: length
#Wizard text: bars ago


input price = volume;
input percent = 50;
input Choice = {default greater, less};
input length = 1;

def x = 100*(price / price[length]-1);
plot scan;

switch (Choice){
case greater:
    scan = x >= percent;
case less:
    scan = x <= -percent;
}
 
Going to break it down into two separate columns because you have greater than and less than.

Greater than column

Code:
input price = volume;
input percent = 50;
#input Choice = {default greater, less};
input length = 1;

def x = 100*(price / price[length]-1);
plot data = x;
AssignBackgroundColor(if x >= percent then color.dark_green else color.gray);

Less than column

Code:
input price = volume;
input percent = 50;
#input Choice = {default greater, less};
input length = 1;

def x = 100*(price / price[length]-1);
plot data = x;
AssignBackgroundColor(if x <= -percent then color.dark_red else color.gray);
 
Hi Ben, I've been using the unusual volume scanner. Thanks! Quick question, is there a way to set up a scan for stocks that have touched their lower bollinger band on the daily with let's say a 3 day look back? Been searching the forums and only found one with a close below. Thanks for all you do!
 
Hi Ben, I've been using the unusual volume scanner. Thanks! Quick question, is there a way to set up a scan for stocks that have touched their lower bollinger band on the daily with let's say a 3 day look back? Been searching the forums and only found one with a close below. Thanks for all you do!
A 3 day lookback in what timeframe...??? Remember, lookbacks go by bars, not time itself... Therefore you would need to know how many bars back you need to look for that "touch" or crossover...
 
QBKOuS2.png


How can I set this up in a scanner on thinkorswim
@crawford5002

keep in mind TOS only updates scans about once every 3-7 minutes depending on server load. As a "workaround" I would advise if you want to have better results to make it scan winthin the the last 2 bars which would be 10 minutes that would cover the 3-7 min TD Ameritrade scan delay.
be sure to set for 5 minute aggregation in the scanner
Volume in the last 5 minutes is atleast 2000% of the average 50 bars
Code:
#Unusual volume scanner by XeoNoX
#Via usethinkscript.com
#Volume in the last 5 minutes is atleast 2000% of the average 50 bars
#set for 5 minute agreggation
#raw percent value
def percentage = 2000;
#percent in decimal format
def percent_as_decimal = 2000*.01;
#average of last 50 bars
def avgvol =  average(volume,50);
#total volume of last 5 bars
def last5mins = (volume);
#average volume multiplied by desired percentage
def percent_of_avg = avgvol*percent_as_decimal;
# scans for volume is greater than than then 50 minute average by over 2000%
plot scan = last5mins>percent_of_avg;
 
Last edited:
@XeoNoX Thank you really appreciate it I will keep you posted.

Thank you once again, is there any way to add this into a custom column on a watch list ? for whatever time frame and that shows the percentage of volume?
 

Similar threads

Not the exact question you're looking for?

Start a new thread and receive assistance from our community.

87k+ Posts
751 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