Volume Stats Format, Watchlist, Scan, Label for ThinkOrSwim

I am having issues with the last custom study input for the scan.
@Hlearner the errors are listed in the bottom:
VQ1XFsh.jpg

You have to fix your errors in the order they occur. In your image, you are not scrolled up to the 1st error.
So you may have other problems that we can't see. But going by the last error:
No such function: Ao_BoxVolumeStats at 1:1
I am going to hazard a guess that that you have entered the wrong study name.

Whatever you are trying to do, you will need to start over. Create your study, Name your study, Write down what you name your study, Put the name of your study into the Scan Hacker.

If you continue to have issues, please provide a screen grab of the errors listed, starting with the first one listed, not the last.
 

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

Does anyone have a simple label that shows the RVOL on the chart? Nothing fancy just a label at the top of the screen that shows the RVOL. Thanks
 
@shanakrp2752 This should get you what you what.

Add these 4 lines to the end of Volume_Labels 1.5.3 version, Can be found at https://usethinkscript.com/threads/...ist-scan-label-for-thinkorswim.970/post-47658

Ruby:
def VolDayPreAvg = Average(PreVol, length);
AddLabel(if GetAggregationPeriod() > AggregationPeriod.THIRTY_MIN or !ShowPreMktVol then 0 else 1, length+"PreMktAvg = " + Round(VolDayPreAvg * .000001, 2) + "M ", Color.YELLOW);
def VolDayPostAvg = Average(PostVol, length);
AddLabel(if GetAggregationPeriod() > AggregationPeriod.THIRTY_MIN or !ShowPostMktVol then 0 else 1, length+"PostMktVol = " + Round(VolDayPostAvg * .000001, 2) + "M ", Color.YELLOW);
 
Last edited:
I was looking at volume indicators and came across this thread. Made a closeup comparison of the Volume indicator in post #1 and the @horserider Volume Indicator referred to with a link in post #4. I pared down both indicators to show just the histograms and a 390 minute simple moving average on a 1 minute chart so you are comparing apples to apples. The @horserider Volume Indicator is clearly superior in seeing the variance of Total Volume relative to Moving Average. This is a function of the fact that in thinkscript coding you are not able to stack values in a histogram as you could in Excel or Google sheets. This is information you want to have to evaluate accurately. Image below.


mLnmPUC.jpg
@horserider or @rlohmeyer : is it possible to display the actual values of sellers and buyers for each bar? or how can I quickly identify sellers are fading off as the price came down and buyers stepped in so I can take long or vice versa. I'm looking for something that can quickly tell me whether buyers or sellers in control, Is there any indicator that can signal that type of information? Thank you!
 
Ive been looking for something that plots the rVol like Boiler Rooms script, but I came up with something that works almost as well. Needs to be cleaned up but I will share it and see if we cant finally get a Vertical Line on a volume chart that works

Code:
#### DYLDAUB JANUARY 2021 #######

# length and type of the same bar price difference MA.
input avgLength = 5;
input avgType = {SMA, EMA, WLD, INE, default AMA};

# overbought and oversold are visual aids.
# overbought with be drawn when OHLC are the same,
# and oversold will be drawn when they are not the same.
input overbought = 1.0;
input oversold = -1.0;

# weighting of flat bars to close, meaning if current bar is
# ...not flat then adjust price histogram by the weighted close.
# Set to zero to force previous flat bar value
# ...to be used, and not weight by close.

input weight = 2;

## VROC
def day = GetDay();
def isNewDay = day != day[1];

# volume displacement length, and std. dev. average length.
input vrocLength = 14;

# increment spike counters by this amount.
input vrocInc = 0.4;

# num. of std. deviations for signaling larger spikes.
input NumDevUp = 3.5;

# use a line for the VROC spike signal instead of plot.
input useLinesForVROC = No;

# increase or decrease (make negative) to adjust VROC signal location.
input vrocSigOffset = 1.0;

def tVROC = if volume[vrocLength] <> 0 then (volume / volume[vrocLength] - 1) else 0;
def isSpike = tVROC < tVROC[1] and tVROC[1] > tVROC[2];

# store the previous tVROC value because that's the peak.
def spikes = if isSpike then tVROC[1] else spikes[1];

def rHSpikes = if isNewDay then vrocInc else if isSpike and tVROC[1] > spikes[1] then rHSpikes[1] + vrocInc else rHSpikes[1];

def rLSpikes = if isNewDay then vrocInc else if isSpike and tVROC[1] < spikes[1] then rLSpikes[1] + vrocInc else rLSpikes[1];

plot SpikeDiff = rHSpikes - rLSpikes;
SpikeDiff.AssignValueColor(if SpikeDiff > 0 then Color.CYAN else Color.MAGENTA);

# Standard deviation of VROC spike.
def sDev = StDev(tVROC, vrocLength);
def upperVROC = Average(tVROC, vrocLength) + NumDevUp * sDev;

plot VROCSpike = if !useLinesForVROC and tVROC > upperVROC then overbought + vrocSigOffset else Double.NaN;
VROCSpike.SetPaintingStrategy(PaintingStrategy.ARROW_UP);
VROCSpike.HideBubble();
VROCSpike.HideTitle();
VROCSpike.AssignValueColor(SpikeDiff.TakeValueColor());

AddVerticalLine(useLinesForVROC and tVROC > upperVROC, "", SpikeDiff.TakeValueColor(), 3);

## VOLUME SPIKES
# determines type of volume spike signals.
# Off is no display, StdDev is using std. deviations,
# HighVol is using spikes above highest average.
input volumeSignals = {Off, default StdDev, HighVol};

# use a line for the volume spike signal instead of plot.
input useLinesForVolume = No;

# increase or decrease (make negative) to adjust VROC signal location.
input volumeSigOffset = 0.5;

# spectrum color displacement and std. dev. average length for volume.
input volumeLength = 10;

def isUU = close > close[volumeLength] and volume > volume[volumeLength];
def isUD = close > close[volumeLength] and volume < volume[volumeLength];
def isDU = close < close[volumeLength] and volume < volume[volumeLength];
def isDD = close < close[volumeLength] and volume > volume[volumeLength];

# num. of std. deviations for volume spikes.
input volNumDevUp = 2.75;

def sDevVol = StDev(volume, volumeLength);
def volUpper = if volumeSignals == volumeSignals.StdDev then Average(volume, volumeLength) + volNumDevUp * sDevVol else Highest(volume[1], volumeLength);

def isVolumeSpike = volumeSignals != volumeSignals.Off and volume > volUpper;

plot VolumeSpike = if !useLinesForVolume and isVolumeSpike then overbought + volumeSigOffset else Double.NaN;
VolumeSpike.SetPaintingStrategy(PaintingStrategy.SQUARES);
VolumeSpike.SetLineWeight(3);
VolumeSpike.HideBubble();
VolumeSpike.HideTitle();
VolumeSpike.AssignValueColor(if isUU then Color.GREEN else if isUD then Color.BLUE else if isDU then Color.ORANGE else if isDD then Color.RED else Color.GRAY);

AddVerticalLine(useLinesForVolume and isVolumeSpike, "SPIKE", if isUU then Color.GREEN else if isUD then Color.BLUE else if isDU then Color.ORANGE else if isDD then Color.RED else Color.GRAY, 2);

A1-GB-BUYSELLVOLUME-no-no-no-200-no.jpg
Is this working code? When I put the study, it just display a horizontal line. Can you share tos link?
 
@SuryaKiranC

I am getting error msg (Please see in bold). Please advise,

def VolDayPreAvg = Average(PreVol, length);

AddLabel(if GetAggregationPeriod() > AggregationPeriod.THIRTY_MIN or !ShowPreMktVol then 0 else 1, length+"PreMktAvg = " + Round(VolDayPreAvg * .000001, 2) + "M ", Color.YELLOW);

def VolDayPostAvg = Average(PostVol, length);

AddLabel(if GetAggregationPeriod() > AggregationPeriod.THIRTY_MIN or !ShowPostMktVol then 0 else 1, length+"PostMktVol = " + Round(VolDayPostAvg * .000001, 2) + "M ", Color.YELLOW);
Unfortunately, you didn't provide the exact error message nor what code that you appended this snippet to. So it is not possible to say where you went astray. :(

These were the steps you should have followed:
  1. copy the script from this post: https://usethinkscript.com/threads/...ist-scan-label-for-thinkorswim.970/post-47658
  2. save it in the study tab.
  3. copy the snippet provided by @SuryaKiranC in this post: https://usethinkscript.com/threads/...ist-scan-label-for-thinkorswim.970/post-47658
  4. paste it to the bottom of the script that you saved in step 2.
If you are still getting wonky results. We need the following:
  1. What code did you copy&paste? Even if you think it is the same as the one on the forum. We need to see yours. Maybe the issue is that you missed part of the code when you created the study. Copy&Paste YOUR code into your post.
  2. Provide a screen grab of the wonky results. Make sure to include the error message. I know the error box is small but you need to hit the little up tab next to the error. Scroll up and screen grab the 1st of the error messages.
After you post the above information, I am sure someone will be able to point you toward possible solutions.
Unsure of how to upload screenshots to the forum, Here are directions.
 
Last edited:
@itsjt562 Bit more details, like what version of code you are using, no need to post the whole code, unless you made any changes to the code, refer to the post you picked up the code from is good enough.

But as for the behavior you are describing is a limitation of TOS, the lowest available aggregation in TOS is 1m, we did use secondsfromtime and secondstilltime through out the code though. and turn off PreMkt postMrk above 30m timeframes.

Why 30m and below, well those are the frames that can be made an even split in trading hours and market start and end time.
 
@itsjt562 Bit more details, like what version of code you are using, no need to post the whole code, unless you made any changes to the code, refer to the post you picked up the code from is good enough.

But as for the behavior you are describing is a limitation of TOS, the lowest available aggregation in TOS is 1m, we did use secondsfromtime and secondstilltime through out the code though. and turn off PreMkt postMrk above 30m timeframes.

Why 30m and below, well those are the frames that can be made an even split in trading hours and market start and end time.
Yes it’s on the time frame above 30 minutes. Is there anyway to get to your display properly on a 4 hour chart?
 
# Box Volume Stats
# Version 1.0
# Created by: Enigma
# Created: 05/18/17

#Inputs
input Show30DayAvg = yes;
input ShowTodayVolume = yes;
input ShowPercentOf30DayAvg = yes;
input UnusualVolumePercent = 200;
input Show30BarAvg = yes;
input ShowCurrentBar = yes;
input PreMktVol = yes;
input RTH1HrVol = yes;
input PostMktVol = yes;

#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 = VolumeAvg(30).VolAvg;
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;


# Labels
AddLabel(Show30DayAvg, "Daily Avg: " + 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 curVolume >= avg30Bars then Color.GREEN else Color.ORANGE));

#Pre, 1Hr RTH, AfterHours Volumes.
##if GetAggregationPeriod() >= AggregationPeriod.DAY then 0 else if PreMktVol then 1 else 0

input PrestartTime = 0400;
input PreendTime = 0929;

def PreMkt = SecondsFromTime(PrestartTime) >= 0 and SecondsTillTime(PreendTime) >= 0;
def PreVolMins = if PreMkt and !PreMkt[1] then volume
else if PreMkt then PreVolMins[1] + volume
else PreVolMins[1];
AddLabel(if GetAggregationPeriod() >= AggregationPeriod.DAY then 0 else if PreMktVol then 1 else 0, "PreMktVol = " + PreVolMins + " ", Color.YELLOW);
# End Volume PreMarket

input RTH1HrstartTime = 0930;
input RTH1HrendTime = 1029;

def RTH1Hr = SecondsFromTime(RTH1HrstartTime) >= 0 and SecondsTillTime(RTH1HrendTime) >= 0;
def RTH1HrMins = if RTH1Hr and !RTH1Hr[1] then volume
else if RTH1Hr then RTH1HrMins[1] + volume
else RTH1HrMins[1];
AddLabel(if GetAggregationPeriod() >= AggregationPeriod.DAY then 0 else if RTH1HrVol then 1 else 0, "RTH1HrVol = " + RTH1HrMins + " ", Color.YELLOW);
#End Volume RTH First 60 Mins

input PoststartTime = 1600;
input PostendTime = 1959;

def PostMkt = SecondsFromTime(PoststartTime) >= 0 and SecondsTillTime(PostendTime) >= 0;
def PostVolMins = if PostMkt and !PostMkt[1] then volume
else if PostMkt then PostVolMins[1] + volume
else PostVolMins[1];
AddLabel(if GetAggregationPeriod() >= AggregationPeriod.DAY then 0 else if PostMktVol then 1 else 0, "PostMktVol = " + PostVolMins + " ", Color.YELLOW);
# End Volume PostMarket



ive kind of scraped a bunch of this thread together as i want the labels. But i want the labels on a 4 hour chart.
 
Hello all,

I am looking for some help on volume visuals. I cannot find a script that shows the current total volume. I'm looking for a script that shows total volume and avg volume that could be added to any tab. Best way for me to describe what I am seeking is, in the trade tab in TOS, it displays volume. I would like to find something that would be a small white block (any color) below the ticker in the chart tab along with daily avg volume - Red if below avg and green if above avg. Any help would be greatly appreciated. Or, if anyone knows where something like this may be within this community if they could point me in the right direction.

Thank you.

-John
 
Hello all,

I am looking for some help on volume visuals. I cannot find a script that shows the current total volume. I'm looking for a script that shows total volume and avg volume that could be added to any tab. Best way for me to describe what I am seeking is, in the trade tab in TOS, it displays volume. I would like to find something that would be a small white block (any color) below the ticker in the chart tab along with daily avg volume - Red if below avg and green if above avg. Any help would be greatly appreciated. Or, if anyone knows where something like this may be within this community if they could point me in the right direction.

Thank you.

-John
The 1st post in this thread may suit you:
https://usethinkscript.com/threads/...ist-scan-label-for-thinkorswim.970/#post-7899
Otherwise, plug&play through these 12 pages of volume labels, watchlists, scans.
 

Similar threads

Not the exact question you're looking for?

Start a new thread and receive assistance from our community.

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