Unusual Volume For ThinkOrSwim

Simple script modification that helps me to confirm when a trend is broken. All it does is paint candles dark red or dark green if volume is 3x average. If you see anything wrong with the code please point it out thank you.

https://ibb.co/p2dmnFL - for an example on TSLA, I made good money trading puts off that broken trend.

Code:
#
# TD Ameritrade IP Company, Inc. (c) 2007-2021
# Modified VolumeAvg to paint candlesticks that are 3x the average volume.
# Make sure you put this in the Volume section of studies

declare lower;
declare zerobase;

input length = 50;

def AvgVol = Average(volume * 3);

plot Vol = volume;
plot VolAvg = Average(volume, length);

Vol.SetPaintingStrategy(PaintingStrategy.HISTOGRAM);
Vol.SetLineWeight(3);
Vol.DefineColor("Up", Color.UPTICK);
Vol.DefineColor("Down", Color.DOWNTICK);
Vol.AssignValueColor(if close > close[1] then Vol.color("Up") else if close < close[1] then Vol.color("Down") else GetColor(1));
VolAvg.SetDefaultColor(GetColor(8));

AssignPriceColor(if close > close[1] AND volume > AvgVol then color.DARK_GREEN else color.current);
AssignPriceColor(if close < close[1] AND volume > AvgVol then color.DARK_RED else color.current);
 
Last edited by a moderator:

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

@KCLLive After more careful inspection I can see the slightly darker candle... Between the small size and minimal color differentiation it was tough to notice...
 
@KCLLive After more careful inspection I can see the slightly darker candle... Between the small size and minimal color differentiation it was tough to notice...
Simple solution. I kept it easy for my eyes, I don’t like the bright neon colors for highlighting that others like. But you can change it as you see fit if you decide to use it :) just change DARK_RED or DARK_GREEN to the color of your choosing in the last two lines.

Code:
AssignPriceColor(if close < close[1] AND volume > AvgVol then color.DARK_RED else color.current);
 
I would like to convert this code into a study to find volume greater than 300%, preferably with a column that can display what percent has changed as well. below is the code for the script:






# CustVolumeStudy by 7of9 for BRT

declare lower;

#Inputs

input Show30DayAvg = yes;
input ShowTodayVolume = yes;
input ShowPercentOf30DayAvg = yes;
input UnusualVolumePercent = 200;
input Show30BarAvg = yes;
input ShowCurrentBar = yes;
input ShowPercentOf30BarAvg = yes;
input ShowSellVolumePercent = yes;

def O = open;
def H = high;
def C = close;
def L = low;
def V = volume;
def buying = V*(C-L)/(H-L);
def selling = V*(H-C)/(H-L);

# Selling Volume

Plot SellVol = selling;
SellVol.setPaintingStrategy(PaintingStrategy.Histogram);
SellVol.SetDefaultColor(Color.Red);
SellVol.HideTitle();
SellVol.HideBubble();
SellVol.SetLineWeight(5);

# Total Volume

Plot BuyVol = volume;
BuyVol.setPaintingStrategy(PaintingStrategy.Histogram);
BuyVol.SetDefaultColor(Color.Dark_Green);
BuyVol.HideTitle();
BuyVol.HideBubble();
BuyVol.SetLineWeight(5);

#Volume Data

def volLast30DayAvg = (volume(period = "DAY")[1] + volume(period = "DAY")[2] + volume(period = "DAY")[3] + volume(period = "DAY")[4] + volume(period = "DAY")[5] + volume(period = "DAY")[6] + volume(period = "DAY")[7] + volume(period = "DAY")[8] + volume(period = "DAY")[9] + volume(period = "DAY")[10] + volume(period = "DAY")[11] + volume(period = "DAY")[12] + volume(period = "DAY")[13] + volume(period = "DAY")[14] + volume(period = "DAY")[15] + volume(period = "DAY")[16] + volume(period = "DAY")[17] + volume(period = "DAY")[18] + volume(period = "DAY")[19] + volume(period = "DAY")[20] + volume(period = "DAY")[21] + volume(period = "DAY")[22] + volume(period = "DAY")[23] + volume(period = "DAY")[24] + volume(period = "DAY")[25] + volume(period = "DAY")[26] + volume(period = "DAY")[27] + volume(period = "DAY")[28] + volume(period = "DAY")[29] + volume(period = "DAY")[30]) / 30;
def today = volume(period = "DAY");
def percentOf30Day = Round((today / volLast30DayAvg) * 100, 0);
def avg30Bars = (volume[1] + volume[2] + volume[3] + volume[4] + volume[5] + volume[6] + volume[7] + volume[8] + volume[9] + volume[10] + volume[11] + volume[12] + volume[13] + volume[14] + volume[15] + volume[16] + volume[17] + volume[18] + volume[19] + volume[20] + volume[21] + volume[22] + volume[23] + volume[24] + volume[25] + volume[26] + volume[27] + volume[28] + volume[29] + volume[30]) / 30;
def curVolume = volume;
def percentOf30Bar = Round((curVolume / avg30Bars) * 100, 0);
def SellVolPercent = Round((Selling / Volume) * 100, 0);

# Labels

AddLabel(Show30DayAvg, "Avg 30 Days: " + Round(volLast30DayAvg, 0), Color.LIGHT_GRAY);

AddLabel(ShowTodayVolume, "Today: " + today, (if percentOf30Day >= UnusualVolumePercent then Color.GREEN else if percentOf30Day >= 100 then Color.ORANGE else Color.LIGHT_GRAY));

AddLabel(ShowPercentOf30DayAvg, percentOf30Day + "%", (if percentOf30Day >= UnusualVolumePercent then Color.GREEN else if percentOf30Day >= 100 then Color.ORANGE else Color.WHITE) );

AddLabel(Show30BarAvg, "Avg 30 Bars: " + Round(avg30Bars, 0), Color.LIGHT_GRAY);

AddLabel(ShowCurrentBar, "Cur Bar: " + curVolume, (if percentOf30Bar >= UnusualVolumePercent then Color.GREEN else if PercentOf30Bar >= 100 then Color.ORANGE else Color.LIGHT_GRAY));

AddLabel(ShowPercentOf30BarAvg, PercentOf30Bar + "%", (if PercentOf30Bar >= UnusualVolumePercent then Color.GREEN else if PercentOf30Bar >= 100 then Color.ORANGE else Color.WHITE) );

AddLabel(ShowSellVolumePercent, "Cur Bar Sell %: " + SellVolPercent, (if SellVolPercent > 51 then Color.RED else if SellVolPercent < 49 then Color.GREEN else Color.ORANGE));

input length = 50;

plot Vol = volume;
plot VolAvg = Average(volume, length);

Vol.SetPaintingStrategy(PaintingStrategy.HISTOGRAM);
Vol.SetLineWeight(3);
Vol.DefineColor("Up", Color.UPTICK);
Vol.DefineColor("Down", Color.DOWNTICK);
Vol.AssignValueColor(if close > close[1] then Vol.color("Up") else if close < close[1] then Vol.color("Down") else GetColor(1));
VolAvg.SetDefaultColor(GetColor(8));
 
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

yw1Y3fI.png


zqe8osh.png


My ThinkorSwim workspace: https://tos.mx/aIZeT6k

The basic concept of Z-Score is that it’s an oscillator denominated in standard deviations from the VWAP mean.
I am a new trader, how do i save your thinkorswim workspace to my chart. just cannot seem to do it. anyone can help?
 
@stamenski I went through all four pages and did not see an instance of any posters using this an option scanner.
But I switched it over to options and it did find results.
 
Hello,

As many of you know, we can enable volume to be displayed as an overlap in the upper part of the chart.
I like doing this because it allows me to compare volume easily while simultaneously looking at the chart/candles. I used to have volume in the lower sections, but found that I wasn't using it well because I was too focused on the chart.

The one thing, however, that I liked about having volume in the lower section was that it showed the average volume for one's desired timeframe as a horizontal line across the volume bars. This was nice because of the additional analysis it provided.

My question is whether anyone knows how to display the average volume (per one's desired tim frame) as a horizontal line on the upper, overlap volume bars?

Thank you!
 
Hello,

As many of you know, we can enable volume to be displayed as an overlap in the upper part of the chart.
I like doing this because it allows me to compare volume easily while simultaneously looking at the chart/candles. I used to have volume in the lower sections, but found that I wasn't using it well because I was too focused on the chart.

The one thing, however, that I liked about having volume in the lower section was that it showed the average volume for one's desired timeframe as a horizontal line across the volume bars. This was nice because of the additional analysis it provided.

My question is whether anyone knows how to display the average volume (per one's desired tim frame) as a horizontal line on the upper, overlap volume bars?

Thank you!
@KevinSammy , I found this nice little code on this forum that I am using. Check it out, it might be something similar to what you are asking for. It paints the candles that have 2x volume. You might find it useful.

#
# TD Ameritrade IP Company, Inc. (c) 2007-2021
# Modified VolumeAvg to paint candlesticks that are 3x the average volume.
# Make sure you put this in the Volume section of studies

declare lower;
declare zerobase;

input length = 50;

def AvgVol = Average(volume * 2);

plot Vol = volume;
plot VolAvg = Average(volume, length);

Vol.SetPaintingStrategy(PaintingStrategy.HISTOGRAM);
Vol.SetLineWeight(3);
Vol.DefineColor("Up", Color.UPTICK);
Vol.DefineColor("Down", Color.DOWNTICK);
Vol.AssignValueColor(if close > close[1] then Vol.color("Up") else if close < close[1] then Vol.color("Down") else GetColor(1));
VolAvg.SetDefaultColor(GetColor(8));

AssignPriceColor(if close > close[1] AND volume > AvgVol then color.White else color.current);
AssignPriceColor(if close < close[1] AND volume > AvgVol then color. Magenta else color.current);
 
Simple script modification that helps me to confirm when a trend is broken. All it does is paint candles dark red or dark green if volume is 3x average. If you see anything wrong with the code please point it out thank you.

https://ibb.co/p2dmnFL - for an example on TSLA, I made good money trading puts off that broken trend.

Code:
#
# TD Ameritrade IP Company, Inc. (c) 2007-2021
# Modified VolumeAvg to paint candlesticks that are 3x the average volume.
# Make sure you put this in the Volume section of studies

declare lower;
declare zerobase;

input length = 50;

def AvgVol = Average(volume * 3);

plot Vol = volume;
plot VolAvg = Average(volume, length);

Vol.SetPaintingStrategy(PaintingStrategy.HISTOGRAM);
Vol.SetLineWeight(3);
Vol.DefineColor("Up", Color.UPTICK);
Vol.DefineColor("Down", Color.DOWNTICK);
Vol.AssignValueColor(if close > close[1] then Vol.color("Up") else if close < close[1] then Vol.color("Down") else GetColor(1));
VolAvg.SetDefaultColor(GetColor(8));

AssignPriceColor(if close > close[1] AND volume > AvgVol then color.DARK_GREEN else color.current);
AssignPriceColor(if close < close[1] AND volume > AvgVol then color.DARK_RED else color.current);
I really like this indicator but Instead of changing the color of the candles can someone help me add arrows instead? Please.
 
I really like this indicator but Instead of changing the color of the candles can someone help me add arrows instead? Please.
Code:
#
# TD Ameritrade IP Company, Inc. (c) 2007-2021
# Modified VolumeAvg to paint candlesticks that are 3x the average volume.
# Make sure you put this in the Volume section of studies

declare lower;
declare zerobase;

input length = 50;

def AvgVol = Average(volume * 3);

plot Vol = volume;
plot VolAvg = Average(volume, length);

Vol.SetPaintingStrategy(PaintingStrategy.HISTOGRAM);
Vol.SetLineWeight(3);
Vol.DefineColor("Up", Color.UPTICK);
Vol.DefineColor("Down", Color.DOWNTICK);
Vol.AssignValueColor(if close > close[1] then Vol.color("Up") else if close < close[1] then Vol.color("Down") else GetColor(1));
VolAvg.SetDefaultColor(GetColor(8));

#AssignPriceColor(if close > close[1] AND volume > AvgVol then color.DARK_GREEN else color.current);
#AssignPriceColor(if close < close[1] AND volume > AvgVol then color.DARK_RED else color.current);

plot UpArrow= if close > close[1] AND volume > AvgVol then low else double.NaN ;
UpArrow.SetPaintingStrategy(PaintingStrategy.ARROW_up);
UpArrow.SetDefaultColor(color.blue) ;
UpArrow.SetLineWeight(1);

plot DnArrow = if  close < close[1] AND volume > AvgVol  then high else double.NaN ;
DnArrow .SetPaintingStrategy(PaintingStrategy.ARROW_down);
DnArrow .SetDefaultColor(color.magenta) ;
DnArrow .SetLineWeight(1);
 
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.
Did you ever find something for this? This is exactly what im looking for. There is one in Trading View that has been helpful, but TV doesn't capture all volume. I would like one for TOS. Any luck?

@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.
Trading View Has this indicator. However I would like one for TOS. VWAP is fine IMO. However, with what he is talking about will actually give more insite into if VWAP could potentially hold or not.
 

Similar threads

Not the exact question you're looking for?

Start a new thread and receive assistance from our community.

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