Volume Statistic Labels


Category:
0
0

Hello Hahn,

I was looking through the post and couldn’t find a post that gave detailed volume stats for a stock.

I wanted to know if it was possible if you could take this custom volume statistics studies and improve the mode and functionality of it. http://tos.mx/6SY1hB

 

The first thing is to modify the today volume label.

  • If the volumetoday is condition is greater than 1million, show the label as red
  • If the volumetoday is greater than 100k, show the label as green.

The second thing is to Add input and label for Dailey relative volume

  • If the daily relative volume is greater than 2, show label green
  • If the daily relative volume is 1-1.9 or show label yellow
  • If the daily relative volume is less than 1, then show label grey

 

The third modification is the today volume label doesn’t seem to calculate premarket and says N/A before 9:30am … how can we fix this?

 

Finally, please remove whatever is being plotted on the left axis by default

Marked as spam
Posted by (Questions: 22, Answers: 63)
Asked on August 29, 2018 5:01 am
1267 views
0
Private answer

Share Links

Those share links have an expiration date. So I avoid using them for material that is expected to have a long shelf life, such as this Q&A forum. At some point in the future, visitors to this post will find that share link you provided is invalid.

Details

The only reason I understood what you meant by “relative volume” is because I have seen you mention it in numerous other posts. Most who visit this post will not have a clue what “relative volume” means. So in the future, please be sure to use the full name of the study as it appears in Thinkorswim: “RelativeVolumeStDev”.

Intraday ONLY

This chart study is meant to plot only on an intraday time frame. No explanation is given as to how to interpret the various values that are displayed. So for the benefit of our audience I will at least take the time to explain how the values of each chart label are computed.

Extremely Limited Scope

The original study, as well as the modifications you requested have a very limited application. Since values are fixed, not based on a percent of current price/volume data. This chart study does not scale to lower or higher priced stocks. The values and color changes presented here: when plotting a $1 stock will be completely irrelevant when compared to the values plotted for a $1,000 stock. I do not like code that cannot scale across a wide variety of ticker symbols. How will the rest of our viewers understand which stocks this indicator can be applied to?

Explanation of Values

  1. Daily Avg: 30 period simple moving average of daily volume, excluding today’s daily volume.
  2. Today Volume: Total volume of the current trading day. (this excludes extended hours trade). No, extended hours trade data cannot be included in this figure.
  3. Unlabeled Percent Value: The percent of today’s volume (label 2) as compare to the 30 day average volume (label 1)
  4. Avg 30 Bars: 30 period simple moving average of volume at the current time frame selected for the chart.
  5. Current Bar Volume (Only Enter at 50k+ volume): The total volume of the current intraday bar. Changes to green when the volume of the bar exceeds 50k.
  6. RelativeVolumeStDev: Daily value of a built-in study named “RelativeVolumeStDev”. Changes color based on value, as described in the original question.

Here is the updated code:

declare lower;
#Inputs
input show30DayAvg = yes;
input showTodayVolume = yes;
input showPercentOf30DayAvg = yes;
input unusualVolumePercent = 200;
input show30BarAvg = yes;
input showCurrentBar = yes;
#RelativeVolumeStDev Inputs
input length = 60;
input allowNegativeValues = no;
def rawRelVol = (volume(period = "DAY") - Average(volume(period = "DAY"), length)) / StDev(volume(period = "DAY"), length);
def relVol = if allowNegativeValues then rawRelVol else Max(0, rawRelVol);
#Volume Data
def volLast30DayAvg = Average(volume(period = "DAY")[1], 30);
def today = volume(period = "DAY");
def percentOf30Day = Round((today / volLast30DayAvg) * 100, 0);
#def avg30Bars = VolumeAvg(30).VolAvg;
def avg30Bars = Average(volume[1], 30);
def curVolume = volume;
# Labels
AddLabel(show30DayAvg, "Daily Avg: " + Round(volLast30DayAvg, 0), Color.LIGHT_GRAY);
AddLabel(showTodayVolume, "Today Volume: " + today, (if volume > 1000000 then Color.RED else if volume > 100000 then Color.green 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, "Current Bar Volume (Only Enter at 50k+ volume): " + curVolume, (if curVolume >= 50000 then Color.GREEN else Color.red));
AddLabel(yes, Concat("RelativeVolumeStDev: ", relVol), if relVol > 2 then Color.GREEN else if relVol > 1 then Color.YELLOW else Color.GRAY);

Final Notes

There is no way to “fix” the N/A during extended hours. As explained above.

There are no plots with this study. So there is nothing to remove “from the left axis”.

Marked as spam
Posted by (Questions: 37, Answers: 4118)
Answered on August 29, 2018 9:13 am
0
Thank you Hahn, i understand where you are coming from an make future post with larger scope. However, this condition for colorizing today volume was not addressed. “The first thing is to modify the today volume label. The color scheme for todays volume should be this Volume under 249,000 = grey Volume 250,000 to 999,999= green Volume greater than 1,000,000= red
( at August 29, 2018 9:58 am)
0

Ok, but your original question was for two conditions with a third color left as implied:

From your post:
If the volumetoday is condition is greater than 1million, show the label as red
If the volumetoday is greater than 100k, show the label as green.

My solution does exactly that. So in order to modify it to these new conditions you will go to the solution I provide and locate this line of code:

AddLabel(showTodayVolume, “Today Volume: ” + today, (if volume > 1000000 then Color.RED else if volume > 100000 then Color.green else Color.LIGHT_GRAY));

And replace it with this line of code:

AddLabel(showTodayVolume, “Today Volume: ” + today, (if volume > 1000000 then Color.RED else if volume > 250000 and volume < 1000000 then Color.green else Color.LIGHT_GRAY));

( at August 29, 2018 10:54 am)
0

The red label doesnt seem to be working with stocks over 1 million shares of volume. For example, check out EXPR.

It has 8mil volume at the time of this post but the box is still grey ?

( at August 29, 2018 12:38 pm)
0

Ah, you know what. That code displays daily volume in that label but the color changes are based on current volume of live intraday bar. That is based on the original source code. Here is how you modify that line to change color based on today’s daily volume:

AddLabel(showTodayVolume, “Today Volume: ” + today, (if today > 1000000 then Color.RED else if today > 250000 and today < 1000000 then Color.green else Color.LIGHT_GRAY));

( at August 29, 2018 12:58 pm)
0

awesome catch , its perfect

( at August 29, 2018 3:21 pm)