ThinkorSwim Volume Spike Alert and Scanner

I now get "AddLabel is not allowed in this context"

If this is a Scan, correct... You need plot... I think I mentioned that above in Post #3... If I didn't, I meant to... Plot is the only way the scanner knows if the condition is met or not...
 
Has anyone encountered Volume based scan alerts taking time in TOS platform?
There are scanned watchlist alerts which alert whenever the results of the scan changes. These alerts can be 3-7min delayed.
 
Attention all stock traders! Are you tired of missing out on the beginning of a stock's price surge? Do you want to stay ahead of the game and beat those expensive momentum scanner subscriptions? Look no further because we have the solution for you!

Introducing our FREE Stock Alert Script for Thinkorswim - the best kept secret of successful traders. Our script analyzes price, volume, buyers, and sellers to identify potential trend changes and significant price movements in a stock. Plus, our alert system is lightning fast and ensures you're notified immediately.

No more wasting time searching for stocks or waiting on news and earnings. Our script monitors the market, your scans, and watchlist with ease, so you can focus on trading. It's a scalper/day trader's dream come true!

But be careful at market open - our script will fire up with many choices until the market calms down in usually 15-20 minutes. Don't miss out on this game-changing tool! Check out our video and give it a try. And don't forget to like, subscribe, and comment because there's more to come.

Note: Make sure to read the instructions in the script and adjust to your trading preference.


Watch The Video:

Copy Below Here

Code:
#hint: Stock Alert - Created by @uptwobucks   This script is designed to identify volume spikes in a stock and display them in the watchlist column. The script calculates the relative volume for the current bar and the percentage change in volume relative to the average volume. If the percentage change in volume exceeds a user-defined threshold (Set Below), the script considers it a volume spike and displays the results in the watch list column. The watch list column displays the percent of change in volume and is colored either light green or light red, depending on whether the current bar is bullish or bearish. Additionally, the watch list column will include the words "Bullish" or "Bearish" to provide further context about the volume spike. This script can be useful for immediately identifying potential trend changes and immediately identify significant price movements in a stock based on changes in volume. To use this script, once you see Bullish or Bearish and the percentage displayed is rapidly rising or falling take action depending if you want to go long or short. If the percentage is displayed but not moving, it could just be a single purchase and no action is needed. Sort your watch list by %Change descending. You can adjust the 0.0 to your trading style. 100.0 is 1%, 200.0 is 2% and so on.

# You can change this setting: "def spike_percentage_threshold = 0.0" to the spike you prefer. This setting can be changed to, 0.0 = any movement, 100.0 = 1% (Recommended), 200.0 is 2%. My personal preference is 0.0

#IMPORTANT: To use this script sort by "Volume Descending" to avoid chasing stocks up and down the page.

def spike_percentage_threshold = 0.0;

# Calculate the relative volume for the current bar
def rel_vol = volume / Average(volume, 50);

# Calculate the percentage change in volume relative to the average volume
def vol_change_pct = (rel_vol - 1.0) * 100.0;

# Determine if the current bar has a volume spike
def is_spike = vol_change_pct >= spike_percentage_threshold;

# Define the label value as the percentage change in volume if it is a spike, otherwise NaN
def label_value = if is_spike then vol_change_pct else Double.NaN;

# Determine if the current bar is bullish or bearish based on the close price
def is_bullish = close > open;
def is_bearish = close < open;

# Add the label to the watch list
AddLabel(yes,
         if is_spike and is_bullish then Concat(AsPercent(vol_change_pct / 10000.0), " - Bullish")
         else if is_spike and is_bearish then Concat(AsPercent(vol_change_pct / 10000.0), " - Bearish")
         else "",
         if is_spike and is_bullish then Color.LIGHT_GREEN
         else if is_spike and is_bearish then Color.LIGHT_RED
         else Color.BLACK);

Copy Above Here.
 
Last edited:
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);
I'm getting "exactly one plot expected" when I try making this filter
 
Attention all stock traders! Are you tired of missing out on the beginning of a stock's price surge? Do you want to stay ahead of the game and beat those expensive momentum scanner subscriptions? Look no further because we have the solution for you!

Introducing our FREE Stock Alert Script for Thinkorswim - the best kept secret of successful traders. Our script analyzes price, volume, buyers, and sellers to identify potential trend changes and significant price movements in a stock. Plus, our alert system is lightning fast and ensures you're notified immediately.

No more wasting time searching for stocks or waiting on news and earnings. Our script monitors the market, your scans, and watchlist with ease, so you can focus on trading. It's a scalper/day trader's dream come true!

But be careful at market open - our script will fire up with many choices until the market calms down in usually 15-20 minutes. Don't miss out on this game-changing tool! Check out our video and give it a try. And don't forget to like, subscribe, and comment because there's more to come.

Note: Make sure to read the instructions in the script and adjust to your trading preference.


Watch The Video:

Copy Below Here

Code:
#hint: Stock Alert - Created by @uptwobucks   This script is designed to identify volume spikes in a stock and display them in the watchlist column. The script calculates the relative volume for the current bar and the percentage change in volume relative to the average volume. If the percentage change in volume exceeds a user-defined threshold (Set Below), the script considers it a volume spike and displays the results in the watch list column. The watch list column displays the percent of change in volume and is colored either light green or light red, depending on whether the current bar is bullish or bearish. Additionally, the watch list column will include the words "Bullish" or "Bearish" to provide further context about the volume spike. This script can be useful for immediately identifying potential trend changes and immediately identify significant price movements in a stock based on changes in volume. To use this script, once you see Bullish or Bearish and the percentage displayed is rapidly rising or falling take action depending if you want to go long or short. If the percentage is displayed but not moving, it could just be a single purchase and no action is needed. Sort your watch list by %Change descending. You can adjust the 0.0 to your trading style. 100.0 is 1%, 200.0 is 2% and so on.

# You can change this setting: "def spike_percentage_threshold = 0.0" to the spike you prefer. This setting can be changed to, 0.0 = any movement, 100.0 = 1% (Recommended), 200.0 is 2%. My personal preference is 0.0

#IMPORTANT: To use this script sort by "Volume Descending" to avoid chasing stocks up and down the page.

def spike_percentage_threshold = 0.0;

# Calculate the relative volume for the current bar
def rel_vol = volume / Average(volume, 50);

# Calculate the percentage change in volume relative to the average volume
def vol_change_pct = (rel_vol - 1.0) * 100.0;

# Determine if the current bar has a volume spike
def is_spike = vol_change_pct >= spike_percentage_threshold;

# Define the label value as the percentage change in volume if it is a spike, otherwise NaN
def label_value = if is_spike then vol_change_pct else Double.NaN;

# Determine if the current bar is bullish or bearish based on the close price
def is_bullish = close > open;
def is_bearish = close < open;

# Add the label to the watch list
AddLabel(yes,
         if is_spike and is_bullish then Concat(AsPercent(vol_change_pct / 10000.0), " - Bullish")
         else if is_spike and is_bearish then Concat(AsPercent(vol_change_pct / 10000.0), " - Bearish")
         else "",
         if is_spike and is_bullish then Color.LIGHT_GREEN
         else if is_spike and is_bearish then Color.LIGHT_RED
         else Color.BLACK);

Copy Above Here.
Good morning UpTwoBucks. I have tried to import but when I paste it into CREATE STUDY, I get an error that says ADD LABEL IS NOT ALLOWED IN THE CONTENT. I have tried numerous times to follow the video directions but it doesn't seem to help. Can you give me some guidance as to what I may be missing?

EDITED:
Ha. Got it. Works great within the watchlist. Thank you for the post.
 
Good morning UpTwoBucks. I have tried to import but when I paste it into CREATE STUDY, I get an error that says ADD LABEL IS NOT ALLOWED IN THE CONTENT. I have tried numerous times to follow the video directions but it doesn't seem to help. Can you give me some guidance as to what I may be missing?
This is right off my pc:
Ruby:
# Set the percentage threshold for the spike
def spike_percentage_threshold = 300.0;

# Calculate the relative volume for the current bar
def rel_vol = volume / Average(volume, 50);

# Calculate the percentage change in volume relative to the average volume
def vol_change_pct = (rel_vol - 1.0) * 100.0;

# Determine if the current bar has a volume spike
def is_spike = vol_change_pct >= spike_percentage_threshold;

# Define the label value as the percentage change in volume if it is a spike, otherwise NaN
def label_value = if is_spike then vol_change_pct else Double.NaN;

# Determine if the current bar is bullish or bearish based on the close price
def is_bullish = close > open;
def is_bearish = close < open;

# Add the label to the watch list
AddLabel(yes,
if is_spike and is_bullish then Concat(AsPercent(vol_change_pct / 10000.0), " - Bullish")
else if is_spike and is_bearish then Concat(AsPercent(vol_change_pct / 10000.0), " - Bearish")
else "",
if is_spike and is_bullish then Color.GREEN
else if is_spike and is_bearish then Color.dark_orange
else Color.BLACK);
 
Last edited by a moderator:
Good morning UpTwoBucks. I have tried to import but when I paste it into CREATE STUDY, I get an error that says ADD LABEL IS NOT ALLOWED IN THE CONTENT. I have tried numerous times to follow the video directions but it doesn't seem to help. Can you give me some guidance as to what I may be missing?

EDITED:
Ha. Got it. Works great within the watchlist. Thank you for the post.

Welcome

Do you know what the error was? I've only had two people have trouble but neither knew the issue.
 
Welcome

Do you know what the error was? I've only had two people have trouble but neither knew the issue.
Yes, the error was me. I didn't quite understand your video direction even though it was pretty clear. I was initially trying to create an indicator via a chart but once I went into watchlist to copy and load, it ended up to be quite easy. I really like the work you did on this and you approach to trading you have. Thanks again for your post.
 
Yes, the error was me. I didn't quite understand your video direction even though it was pretty clear. I was initially trying to create an indicator via a chart but once I went into watchlist to copy and load, it ended up to be quite easy. I really like the work you did on this and you approach to trading you have. Thanks again for your post.
Thank you.
 
Hi, does anyone know how to delete the bearish indicator on the script so only the bullish volume spike shows up on watchlist?
 

Attachments

  • Screenshot 2024-03-13 064047.png
    Screenshot 2024-03-13 064047.png
    166.3 KB · Views: 31
@Asianraisin You are close, please note that you probably meant "0900" rather than "9000" in your start time. I have use a bracketed time, note that times are interpreted by TOS in EST so you may wish to adjust that accordingly.

Here then is your scan.

Code:
def Active = SecondsFromTime(0900) > 0 and SecondsTillTime(1430) >= 0;
plot scan = Active and volume > 8*average(volume, 390);
Would this work in stock hacker is your trying to catch volume spikes on contracts?
 
Hi, does anyone know how to delete the bearish indicator on the script so only the bullish volume spike shows up on watchlist?
Next time copy the code into the forum

This should be what you need


Code:
AddLabel(yes, if is_spike and is_bullish then
AsPercent(Vol_change_pct / 10000.0) else "",
if is_spike and is_bullish then Color.GREEN else Color.BLACK);
 
As Good As It Gets Above Average Volume Strength takes place when buyers pile on, or the bulls/bears get into an arm wrestling tug of war?

This indicator shows yellow dots on the candle when above volume activity is taking place. The picture shows it added to my AGAIG-BestTradingChartSetup which I recently posted here on usethinkscript.

Showing on my screen: Code:
Ruby:
##AsGoodAsItGets_AboveAverageVolumeTrendStrength 4/15/24
##Above volume strength takes place when buyers pile on or the bulls/bears get into a tug of war?

input volumeAveragegLow = 13;
input volumePercentThreshold = 21;
def averageVolume = Average(volume, volumeAveragegLow);
def percentVolume = 100 * ((volume - averageVolume[1]) /averageVolume[1]);
def percentDot = percentvolume >= VolumePercentThreshold;
plot volumeStrength = if percentDot then hl2 else Double.NaN;
volumeStrength.SetPaintingStrategy(PaintingStrategy.POINTS);
volumeStrength.SetLineWeight(5);
volumeStrength.SetDefaultColor(color.yellow);

##End Code
 
Last edited by a moderator:

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

Similar threads

Not the exact question you're looking for?

Start a new thread and receive assistance from our community.

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