ThinkorSwim Volume Spike Alert and Scanner

@DarthVaider in this site look for:

1) TrendReversal script for the buy and sell. It may look different from the script. I customized it to my style and strategy.
2) Hull Moving Average Turning Points and Concavity (2nd Derivatives) for the colored lines. I have set price=(H+L)/2, hma length = 2, and loopback=2.

I hope that helps. Good luck!

@cabe1332
Can you share your chart setup (workspace)
 

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

Can you share your chart setup (workspace)
@Rocky20 the chart setup and workspace are customized to my trading style. I have learned, put in the time, and TOS coding from this site. All are searchable and available here. My workspace came from here, develop piece by piece, and test what works best. Up to date, I check this site on "What's New" and scripts others are developing to better our trading lives. I am asking you to put time and effort to learn what works best for you. Usethinkscript.com has great knowledgeable and resourceful people here ready to help. But, you just have to search or ask the right question.

Good Luck! @cabe1332
 
@cabe1332 can you please tell me how you got that RSI label on your screen? The one that says "RSI Overbought: 98"
@MJTrade the RSI label script is all over this site, you just have to make use of the search.

To save you some time, the script I use is below. Good Luck! @cabe1332

# RSI Label
# cabe1332

# Note: You can modify the inputs

# start code

input overbought = 80;
input oversold = 20;
input rsilength = 5;

def rsi = reference RSI(length = rsilength)."RSI";

#Label
AddLabel(yes,
if rsi < oversold then "RSI Oversold: " + round(rsi,0) + " " else
if rsi > overbought then "RSI Overbought: " +round(rsi,0) + " " else
if rsi > rsi[1] then "RSI Rising: " + round(rsi,0) + " " else "RSI Falling: " +round(rsi,0) + " ",
if rsi < oversold then Color.orange else
if rsi > overbought then Color.red else
if rsi > rsi[1] then Color.green else Color.green);

# end code RSI
 
Try this @Asianraisin go to scan, select add filter, go to study, go to the tiny pencil on the right, hit delete, go to thinkscript editor on the top left, copy and paste the code above into it, change the aggregation to 1 minute at the very top left, hit okay, and scan, nothing will come up right now because market closed but you can now save this as a scan by ... clicking the little notebook next to "no matching symbols" click alert when scan results change, name your scan and you should be able to find it under your watchlist. In the morning things should pop up if it's working correctly. You can maybe find out early before the open if it is working by turning on the EXT next to the aggregation you've chosen.

11:45 Paris: Since there is considerable interest in volume studies in recent days, here's a volume spike alert that was posted some time back.

Code:
# Volume Spike Alert
# Student
# 12.17.2016

# Fires off an alert on a 6-10X volume spike, so you can catch a rocket early

def AvgVol = Average(volume, 6);
def VolX = (volume > AvgVol[1] * 6) and (volume < AvgVol[1] * 10) and (SecondsFromTime(0930) >= 1800) and (SecondsTillTime(1600) > 900);
def VolXX = (volume > AvgVol[1] * 10) and (SecondsFromTime(0930) >= 1800) and (SecondsTillTime(1600) > 900);
def VolUP = volume > AvgVol;

Alert(VolX, GetSymbolPart() + " has a large volume spike." + volume, Alert.BAR, Sound.Bell);
Alert(VolXX, GetSymbolPart() + " has a very large volume spike." + volume, Alert.BAR, Sound.Bell);
hey guys, probably know the answer but i have to ask just for reassurance, is it possible to to highlight or flag (mark) the stock that just triggered the volume alert?
 
hey guys, probably know the answer but i have to ask just for reassurance, is it possible to to highlight or flag (mark) the stock that just triggered the volume alert?

The closest you can get to what I think you're looking for is to set an alert on the scan query to trigger when symbols are added. The alert will appear in the Message Center, which isn't exactly attention grabbing. You can also have the alert send email and/or mobile push notification to the TOS mobile app so at least there's a notification sound.
 
@Slippage @Break Trader Want to make it more attention grabbing? You can detach the message center so the messages are front of you.
And/or scan query alerts can use custom sounds. 9 loud verses of "We're in the Money" is very attention grabbing although some family members may find it annoying :) (for trades going sideways, Lost In Space's Danger Danger Will Robinson on repeat is a great heads up!) :)
 
hey guys, probably know the answer but i have to ask just for reassurance, is it possible to to highlight or flag (mark) the stock that just triggered the volume alert?
@Break Trader, yes you can. I am assuming you want to flag or mark this on a watchlist. Hmm, an idea just popped in my head, a spike can be set with 1-minute aggregation and updates real-time with the RSI value real-time. Do you have the link or proper script for the volume spike. I've like to give it a try. @cabe1332
 
Last edited by a moderator:
@Break Trader, yes you can. I am assuming you want to flag or mark this on a watchlist. Hmm, an idea just popped in my head, a spike can be set with 1-minute aggregation and updates real-time with the RSI value real-time. Do you have the link or proper script for the volume spike. I've like to give it a try. @cabe1332
I considered this, too. It's a valid idea if the list being shown isn't the result of the volume spike scan. If it's the result of that scan then all of the symbols will have the same state in that column. And, when re-running the scan or using the scan query as a watchlist you have no way to tell which symbols were only added on the most recent refresh, which is what was requested.

The only time the column would be useful on the scan's results is if the scan was run manually and the results are stale. When they stop being valid the column will change to reflect that.
 
Last edited by a moderator:
I considered this, too. It's a valid idea if the list being shown isn't the result of the volume spike scan. If it's the result of that scan then all of the symbols will have the same state in that column. And, when re-running the scan or using the scan query as a watchlist you have no way to tell which symbols were only added on the most recent refresh, which is what was requested.

The only time the column would be useful on the scan's results is if the scan was running manually and the results are stale. When they stop being valid the column will change to reflect that.
Ok, give the script below a try. I added a ThumpsUP for volume spike. Add a volume column on the watchlist or scan using the script below. This will update real-time on a watchlist scan. Good luck! @cabe132

# ThumpsUP for Volume Spike
# @cabe1332 20210805

# start code
def v = Round(volume *.000001 , 1);
def AvgVol = Average(volume, 6);
def VolX = (volume > AvgVol[1] * 6) and (volume < AvgVol[1] * 10) and (SecondsFromTime(0930) >= 1800) and (SecondsTillTime(1600) > 900);
def VolXX = (volume > AvgVol[1] * 10) and (SecondsFromTime(0930) >= 1800) and (SecondsTillTime(1600) > 900);
def VolUP = volume > AvgVol;

#Label
AddLabel(yes, if VolUP then "👍 " + v + " M" else + v + " M", color.lime);

# end code
 
Last edited by a moderator:
@Slippage @Break Trader Want to make it more attention grabbing? You can detach the message center so the messages are front of you.
And/or scan query alerts can use custom sounds. 9 loud verses of "We're in the Money" is very attention grabbing although some family members may find it annoying :) (for trades going sideways, Lost In Space's Danger Danger Will Robinson on repeat is a great heads up!) :)
where do we get those custom alert sounds? i been on TOS for 55 or 6 years and could never figure out where and how to get custom sound alerts
 
where do we get those custom alert sounds? i been on TOS for 55 or 6 years and could never figure out where and how to get custom sound alerts

In a watchlist, select a scan query not a static list.
Click where its name is again to get the menu and select Alert when scan results change
In the list of sounds there's an option at the bottom to edit custom sounds.

You can access the same custom sounds option when you manually set alerts on specific symbols.

As far as I can remember, there's no way to use custom sounds in chart alerts via studies.
 
@cabe1332 dont know who the author is of this script and havent had a chance to test it out and see if actually works, it look like it does, i havent had a chance to see it in action during trading hours though

Code:
Code:
def afterStart = secondsfromtime(0645)>=0;
def beforeEnd = secondstilltime(1245)>=0;
def vol_length = 30;
def AVGV = Average(volume, vol_length);
def lastNmins = (volume);
# scans for volume is greater than 500% of  average volume
def conditionTrue = lastNmins >  (AVGV * 5);

plot alert = afterStart and beforeEnd and
   conditionTrue and conditionTrue[1] # volume increase
   and ATR(2) > ATR() * 2; # price range increase
 
@cabe1332 dont know who the author is of this script and havent had a chance to test it out and see if actually works, it look like it does, i havent had a chance to see it in action during trading hours though

Code:
Code:
def afterStart = secondsfromtime(0645)>=0;
def beforeEnd = secondstilltime(1245)>=0;
def vol_length = 30;
def AVGV = Average(volume, vol_length);
def lastNmins = (volume);
# scans for volume is greater than 500% of  average volume
def conditionTrue = lastNmins >  (AVGV * 5);

plot alert = afterStart and beforeEnd and
   conditionTrue and conditionTrue[1] # volume increase
   and ATR(2) > ATR() * 2; # price range increase
@Break Trader I don't know who the author is, but I modified and tested script on multi-aggregation. It scans for volume spikes. You can change the percent as you like, additional scan filters to filter, and set a TOS watchlist alert for any new symbol adds. It works well and I will use it myself. Good luck! @cabe1332

# Volume Increase scan by X%
# Works on any aggregation
# @cabe1332

# add as a study on your scan
# you can change the percent as you wish
# you can set up a TOS watchlist alert for changes

# start code
input pctvolchg = 5; # ie. 5 = 500% x spike
input vol_length = 30;
def AVGV = Average(volume, vol_length);
def lastNmins = (volume);
# scans for volume is greater than 500% of average volume
def conditionTrue = lastNmins > (AVGV * pctvolchg);

plot scan = conditionTrue and conditionTrue[1]
and ATR(2) > ATR() * 2; # price range increase

# end code
 
Last edited by a moderator:
I am trying to run this volume spike alert script and getting the following error:

"Exactly one plot expected"



Code:
# Volume Spike Alert
# Student
# 12.17.2016

# Fires off an alert on a 6-10X volume spike, so you can catch a rocket early

def AvgVol = Average(volume, 6);
def VolX = (volume > AvgVol[1] * 6) and (volume < AvgVol[1] * 10) and (SecondsFromTime(0930) >= 1800) and (SecondsTillTime(1600) > 900);
def VolXX = (volume > AvgVol[1] * 10) and (SecondsFromTime(0930) >= 1800) and (SecondsTillTime(1600) > 900);
def VolUP = volume > AvgVol;

Alert(VolX, GetSymbolPart() + " has a large volume spike." + volume, Alert.BAR, Sound.Bell);
Alert(VolXX, GetSymbolPart() + " has a very large volume spike." + volume, Alert.BAR, Sound.Bell);
 
@MacDude Thinkscript was created as a simple plotting language. So it assumes when you create a script that you are going to plot.
So we get it a plot and then we hide the plot. Everybody is happy :)
And these two lines to the bottom of your script:
Ruby:
plot idontcare = 1 ;
idontcare.hide();
 
The need for a plot can also be circumvented by using AddLabel() in place of plot... Either one will eliminate the error for Studies, Strategies, and Custom Watchlist Columns... Scans, however, do require a plot which returns 1 or either 0 or Double.NaN in order to return results... Alert() does not fire in Custom Watchlist Columns or Scans...
 
Last edited:
The need for a plot can also be circumvented by using AddLabel() in place of plot... Either one will eliminate the error for Studies, Strategies, and Custom Watchlist Columns... Scans, however, do require a plot which returns 1 or either 0 or Double.NaN in order to return results... Alert() does not fire in Custom Watchlist Columns or Scans...
So I added :


def AvgVol = Average(volume, 6);

def VolX = (volume > AvgVol[1] * 6) and (volume < AvgVol[1] * 10) and (SecondsFromTime(0930) >= 1800) and (SecondsTillTime(1600) > 900);

def VolXX = (volume > AvgVol[1] * 10) and (SecondsFromTime(0930) >= 1800) and (SecondsTillTime(1600) > 900);

def VolUP = volume > AvgVol;
#plot VolUP = Volume > AvgVol;
AddLabel(yes, if (Volume > AvgVol then "Uptrend") else ("Downtrend"), Color.RED);

Im getting the following error message: Invalid Statement: AddLabel at 21:1
 
Close... You have then "UpTrend" within the Parentheses, which aren't required...

Ruby:
AddLabel(yes, if Volume > AvgVol then "Uptrend" else "Downtrend", Color.RED);
 

Not the exact question you're looking for?

Start a new thread and receive assistance from our community.

87k+ Posts
199 Online
Create Post

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