This study will plot a color coded box in the volume pane that shows the percentage of daily average volume that a stock has traded for the current day. The two inputs are:
1. How many days of past volume to average (from 1 to 60, currently)
2. An alert level in percent of average volume
In the picture above, “days” was 60 and the alert was set to 100, meaning that if GOOG traded more shares for the day than the average daily volume of the past 60 days, the box would turn from red to green and you would get an alert. Here’s an example of how C looked at the end of the day today (the alert at 100 never triggered):
You could set this study with a level of say 20, and use it during the first 30 minutes of the market to be alerted to stocks with high volume relative to their average. Of course you’d have to have plots open, since I don’t think it works on a watchlist. It’s meant to be used real-time, as it always shows the sum of the current day so far. You can configure the alerts and also turn the chart label off if you hate the box but still want the alert.
The hardest part was writing a gigantic definition for average daily volume that accepted a variable input. To get the volume from the daily timeframe, you use
That would return today’s volume on the daily timeframe. To get yesterday’s daily volume, you’d use
You can imagine that a 3 day average volume would look like this:
So imagine that stretched out to 60 times. Yikes. Then I just compared today’s volume to the average volume, calculated a percentage, and then used the addchartlabel() function to make the box. I changed the color coding with the assignvaluecolor() function, depending on if the percentage was above or below the alert level. I added my alerts block code, changed the alert parameter to percentage>=alert level, and that’s a wrap.
So now you know how to make one of your own, or you can use mine if you donate to my blog. The file “DailyAvgVolSTUDY.zip” is in the “Released Thinkscript Studies” section of my Google Site. If you are not yet a donor, you can become one by clicking the button below: