Unusual Volume Scan within last 10 bars rather than just current bar

TraderTheJoker

New member
Hi, I noticed on ThinkorSwim you can only find unusual volume based scan based on current candle volume. I wanted to find Unusual volume greater than 40 % last 50 periods in last 10 periods. So I can see the volume spikes on stocks several days ago as well. Appreciate if anyone on here can help me, Thank you.
 
Solution
i read your post several times, and i think i understand.

EDIT: --- fixed code

this looks back 50 bars to find the highest volume, starting from the previous bar.
multiplies that number by 1.4 ( 40% + 100%)
then checks if current volume is > it. if it is, then 1 else 0.
then check if at least 1 bar in the last 10, found higher volume.

Code:
def dat = volume;
def lookback1 = 50;
def hivol = highest( dat[1] , lookback1);
def per = 40;
def hi_per_value = (1+ ( per/100))*hivol;
def isvol_bigger = if (dat > hi_per_value) then 1 else 0;
def within_xbars = 10;
plot z = if sum(isvol_bigger, within_xbars) >= 1 then 1 else 0;

when there is a big volume bar, it will cause hivol to be true for the next 50 bars.
z will be true on that bar...
i read your post several times, and i think i understand.

EDIT: --- fixed code

this looks back 50 bars to find the highest volume, starting from the previous bar.
multiplies that number by 1.4 ( 40% + 100%)
then checks if current volume is > it. if it is, then 1 else 0.
then check if at least 1 bar in the last 10, found higher volume.

Code:
def dat = volume;
def lookback1 = 50;
def hivol = highest( dat[1] , lookback1);
def per = 40;
def hi_per_value = (1+ ( per/100))*hivol;
def isvol_bigger = if (dat > hi_per_value) then 1 else 0;
def within_xbars = 10;
plot z = if sum(isvol_bigger, within_xbars) >= 1 then 1 else 0;

when there is a big volume bar, it will cause hivol to be true for the next 50 bars.
z will be true on that bar and 9 bars after it. so when 1 big volume bar happens, there will be a trigger every bar , for 59 bars.
 
Last edited:
Solution

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

i read your post several times, and i think i understand.

this looks back 50 bars to find the highest volume, starting from the previous bar.
multiplies that number by 1.4 ( 40% + 100%)
then checks if current volume is > it. if it is, then 1 else 0.
then check if at least 1 bar in the last 10, found higher volume.

Code:
dat = volume;
def lookback1 = 50;
def hivol = highest( dat[1] , lookback1);
def per = 40;
def hi_per_value = (1+ ( per/100))*hivol;
def isvol_ bigger = if (dat > hi_per_value) then 1 else 0;
def within_xbars = 10;
plot z = if sum(isvol_ bigger, within_xbars) >= 1 then 1 else 0;

when there is a big volume bar, it will cause hivol to be true for the next 50 bars.
z will be true on that bar and 9 bars after it. so when 1 big volume bar happens, there will be a trigger every bar , for 59 bars.
Thank you for the speedy response, appreciate it!
 
i read your post several times, and i think i understand.

this looks back 50 bars to find the highest volume, starting from the previous bar.
multiplies that number by 1.4 ( 40% + 100%)
then checks if current volume is > it. if it is, then 1 else 0.
then check if at least 1 bar in the last 10, found higher volume.

Code:
dat = volume;
def lookback1 = 50;
def hivol = highest( dat[1] , lookback1);
def per = 40;
def hi_per_value = (1+ ( per/100))*hivol;
def isvol_ bigger = if (dat > hi_per_value) then 1 else 0;
def within_xbars = 10;
plot z = if sum(isvol_ bigger, within_xbars) >= 1 then 1 else 0;

when there is a big volume bar, it will cause hivol to be true for the next 50 bars.
z will be true on that bar and 9 bars after it. so when 1 big volume bar happens, there will be a trigger every bar , for 59 bars.
can we add more condition as volume can increase to short the stock to.
like how much stock move in last 50 day and last 10 day we can put that label on upper chart.dollar amount and percentage amount.
 
Hello @halcyonguy,

Thank you for building this indicator. Could you please use this same concept to build the version below? I would greatly appreciate it.

Criteria:
  • Looks back 50 bars to find single bar volume greater than X amount (say 5,000,000).
  • When current bar volume or previous 50 bars is ≥ X volume, then 1, else 0 for every bar after that within the trading day.
It has been hard to scan for a current or previous candle breaking a specific volume threshold. I know it is possible but I lack your skillset. I believe tweaking your Volume Lookback to scan for when that threshold has been breeched would be the solution--especially when quickly combing through a watchlist for that "z" value of 1 or 0 depending on which tickers meet criteria.

Here is an example. Say SPY traded 80,000,000 on a given day. This indicator would look back 50 bars to find a single bar volume greater than or equal to 5,000,000. When this criteria is met for the current bar or 50 bars back, "z" will be true for every bar after it until market close. This way, the criteria can be scanned for or quickly identified since any stock that meets criteria will have a "z" value of 1.

Thank you very much for your help.
 
sorry about that. i fixed it. i have a bad habit of trying to answer questions when i am away from my computer, meaning i type them up on my cell...
Hello halcyonguy, I am trying to use this scan you made but i am also getting a Invalid statement as the other user, I see your comments that this error was fixed but I don't see the newer corrections. Can you help with this? Thanks for yur help
 

Similar threads

Not the exact question you're looking for?

Start a new thread and receive assistance from our community.

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