## Daily Average Volume Study with Alerts for Think or Swim

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.

How I Did It

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

def dailyvol=volume(period=”DAY”);

That would return today’s volume on the daily timeframe. To get yesterday’s daily volume, you’d use

def yesterdayvol=volume(period=”DAY”)[1];

You can imagine that a 3 day average volume would look like this:

def threedayavgvol=(volume(period=”DAY”)[1]+volume(period=”DAY”)[2]+volume(period=”DAY”)[3])/3;

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:

### 8 Responses to “Daily Average Volume Study with Alerts for Think or Swim”

1. pik Says:

Pro,

Looks good and will donate as soon as I go net positive for the year 🙂

2. hello jones Says:

could you make a set of pivots using high, low, close, for N previous bars ?

where the input would be the number of bars ?

this way any pivot could made for any time frame.

i am currently using a 3 bar pivot indicator which i ripped off from a 3 day pivot indicator.
i love it. but i would like to be able to do more or less bars.

so that i could see larger time frame pivots on lower time charts.
for example, if i had a 6 bar pivot calc, i could see the 3 bar pivots from my 30 min chart, see them on the 15 min chart.
thanks

3. Prospectus Says:
4. Daily Average Volume Study with Alerts for Think or Swim » ThinkOrSwim | marketHEIST.com Says:

[…] Continue to Daily Average Volume Study with Alerts for Think or Swim […]

5. VicS Says:

not sure if this helps cut some code but I use this code to display volumes on my charts. this gives avg vol for 10 days.
def AvgVol10 = AbsValue(Ceil(Average(volume(period = “DAY”), 10)));
AddLabel(yes, ” AvgVol 10D=” + AvgVol10, Color.LIGHT_GREEN);

6. matrix gaming Says:

I sent donation but i never recieve the password for the zip file to open the zip.

7. Prospectus Says:

I just sent it, check your email

>

8. upendra Says:

I am trying to create scan query based on daily average volume study, but receiving below error:

Error processing referenced script DailyAvgVol: No such function: addchartlabel at 1:1
Expected double

Scan query which i am using:
DailyAvgVol() is greater than 100