# Average Volume Stats Indicator for ThinkOrSwim (Free Download)

Indicator Free Beginner 26 min video 34 lines of code Mar 12, 2023 Updated Oct 21, 2026

Free average volume indicator for ThinkOrSwim. Labels show today's volume, its 30-day and 90-day averages, and today's volume as a percent of each.

## Overview

In this tutorial I build an average volume indicator for ThinkOrSwim from scratch. It prints 3 labels at the top of the price chart: today's volume, the 30-day average volume and the 90-day average volume. Each average label also shows today's volume as a percentage of that average.

The labels always read daily volume, even on a 1-minute chart. An average label turns green when today's volume is above it, both lengths are inputs you can change, and a short number format trims the share counts down to millions. It's a beginner thinkScript tutorial, and the finished study is a free download.

## Key Takeaways

- The Average Volume Stats indicator prints 3 labels on the ThinkOrSwim price chart: today's volume, the 30-day average volume and the 90-day average volume, with today's volume as a percent of each average.

- Volume comes from volume(period = "Day"), so the volume label shows the day's volume even on a 1-minute chart, and both averages are built from daily volume.

- An average label turns green when today's volume is above 100% of that average and stays light gray at 100% or below.

- Both averages are inputs, 30 and 90 days by default. In the video I also ran 180 and 360 days, then 5 and 10 days.

- In the video, SPY had traded 189 million shares: 228% of its 180-day average of 83 million and 210% of its 360-day average of 90 million.

## What the Average Volume Stats Indicator Shows

The Average Volume Stats indicator answers one question in the top left corner of your chart: how does today's volume compare with normal? It reads the day's volume, averages it over 2 lengths you choose, and divides today's volume by each average.

Average volume is the mean number of shares traded per day over a set number of days. A 30-day average volume adds up the last 30 daily volumes and divides by 30. Comparing today's volume with that average shows whether today is busier or quieter than usual for the stock.

In the video, Tesla had traded 191 million shares against a 180-day average of 115 million, so the labels were green. Microsoft's labels stayed gray because its volume that day was at or below both averages. You see at a glance whether a stock's volume stands out, without reading bars in the volume panel.

Label What it shows Color

Volume Today's volume, from the daily bar Always light gray

30D Avg Average daily volume over the last 30 days, then today's volume as a percent of it Green above 100%, light gray at 100% or below

90D Avg The same over the last 90 days Green above 100%, light gray at 100% or below

The number in front of "D Avg" comes from the length input, so the labels read 180D Avg and 360D Avg when you set the lengths to 180 and 360. A vertical bar separates each average from its percentage.

## How It Compares With Our Other Volume Tools

Average Volume Stats is the simplest of our free volume tools: one symbol, 2 plain averages, and the result printed as numbers. Today's volume divided by its average is what many traders call relative volume, so a reading of 228% means 2.28 times the usual daily volume.

- Our Volume Intensity indicator uses the same volume-to-average ratio for 5 symbols at once and shows it as colored dots instead of numbers.

- The unusual volume scans measure volume in standard deviations with ThinkOrSwim's Relative Volume StDev study, so they flag volume far above normal.

- The increasing volume scans look for 3 bars in a row of rising, above-average volume.

The labels give you context on a chart you're already looking at. The scans search the market for you. Our roundup of the [best volume indicators for ThinkOrSwim](https://tosindicators.com/research/best-volume-indicators-thinkorswim-relative-volume-vwap-obv) covers relative volume alongside VWAP and OBV.

## Average Volume Stats Settings

The Average Volume Stats indicator has 3 inputs. Double-click the study on your chart to change them, and the labels recalculate as soon as you apply.

Input Default What it does

numFormat short short shows volume and the averages in millions. long shows the full share count, rounded to whole shares.

length1 30 Days in the first average. The first average label's text follows it.

length2 90 Days in the second average.

In short format, a number above 1 million is rounded to whole millions, so 189,000,000 shares reads 189. Below 1 million, the download keeps 2 decimals, so 450,000 shares reads 0.45. The labels don't add an "M", so read every short-format number as millions.

## How to Add Average Volume Stats to ThinkOrSwim

The Average Volume Stats download installs as one study:

- Download the zip from this page. Inside is one study file, TI_AvgVolume_StatsSTUDY.ts.

- Import it as a study. Our guide on how to import a study into ThinkOrSwim walks through each click.

- Add the study to your chart. The code declares itself an upper study, so the labels print on the price panel.

- To build it by hand instead, click the Studies icon, choose Create, name the study, delete the starter code and paste in the code from the Code tab.

In the video I write the code from scratch, one concept at a time, and the next section follows the same order.

## How the Average Volume Code Works

The Average Volume Stats code has 4 parts: daily volume, 2 averages with their percentages, a switch for the number format, and 3 labels. Here is each step as I built it in the video.

### Step 1: Pull Daily Volume

(This step's code is free with an account.)

volume is a built-in variable in ThinkOrSwim, like the open or close of a candle. On its own it returns the volume of the chart's current bar, so when I switched my test chart to a 1-minute chart, the label changed to the 1-minute bar's volume.

Adding period = "Day" ties it to the daily bar. Now the label shows the same number on a 1-minute chart as on a daily chart. Our tutorial on [aggregation periods](https://tosindicators.com/thinkscript/aggregation-periods) covers this way of reading a larger timeframe in more depth.

### Step 2: Keep the Labels on the Price Panel

(This step's code is free with an account.)

My first test showed nothing on the chart. ThinkOrSwim had placed the new study in the volume subpanel, which I keep hidden. declare upper tells ThinkOrSwim the study always goes on the upper panel with the candles, so the labels print in the top left corner.

### Step 3: Two Averages Set by Inputs

(This step's code is free with an account.)

Average is a built-in function that returns the mean of a value over the length you give it. To test it, I first hard-coded a length of 50 and compared the label with the 50-bar average in ThinkOrSwim's VolumeAvg study, and the numbers matched. The [increasing volume scan tutorial](https://tosindicators.com/scans/increasing-volume) explains VolumeAvg.

A hard-coded 50 means editing the code every time you want a different length. An input puts the length in the study settings instead, so you double-click the study, type a new number and the labels update.

### Step 4: Today's Volume as a Percent of Each Average

(This step's code is free with an account.)

Dividing today's volume by the average gives a ratio. Above 1 means today's volume is above the average, and below 1 means it's below. In the video, Microsoft's ratio to its 30-day average came out at 0.9383. Wrapping it in AsPercent , another built-in function, turns that into 93.83%.

### Step 5: Build the Labels

AddLabel takes 3 things: when to show the label ( yes means always), what goes inside it, and its color. The + signs join text and numbers into one string. Our [AddLabel tutorial](https://tosindicators.com/thinkscript/labels) covers the function in more detail.

(This step's code is free with an account.)

The 90-day label is the same line with length2 , avg2Plot and pct2 .

The average labels start with length1 and length2 instead of a typed "30" and "90". When I first typed the numbers in and then changed the inputs to 180 and 360, the values updated but the labels still said 30 and 90. Reading the length from the input keeps the text and the math in step.

### Step 6: Color the Labels

The color rule compares the ratio with 1, not 100, because pct1 is stored as a ratio where 1 equals 100%. At or below 1 the label is light gray, and above 1 it turns green. Before I added this rule, SPY's labels read 228% and 210% and were still gray, which left the comparison to me.

### Step 7: The Short and Long Number Format

The numFormat input gives you a dropdown with 2 choices. The 3 display variables are declared first, with no value:

(This step's code is free with an account.)

ThinkOrSwim shows an error until every case of the switch assigns all 3, so each case sets volPlot , avg1Plot and avg2Plot .

(This step's code is free with an account.)

switch runs the case that matches the input.

Only the volume numbers change format, and the percentages stay as they are. In the video I rounded the short format to 0 decimals. The download adds one refinement: below 1 million shares it keeps 2 decimals, so a small number doesn't show as 0.

## Examples From the Video

The Average Volume Stats labels changed color and values as I moved between symbols in the video. These numbers come from the day I recorded, so your readings will differ.

- Tesla, 180 and 360 days. Tesla had traded 191 million shares against a 180-day average of 115 million. Today's volume was above both averages, so both labels were green.

- Microsoft. Both labels stayed gray. With the color rule in place, they read 99.76% and 93.49%, both at or below 100%.

- SPY, 180 and 360 days. SPY had traded 189 million shares. Its 180-day average was 83 million and its 360-day average 90 million, so the labels read 228% and 210% and both were green.

- SPY, 5 and 10 days. When I changed the lengths to 5 and 10 to compare short-term volume, the label text and the calculations both updated.

## How I Read the Labels

Average Volume Stats gives context for the price action on your chart. A green label tells you today's volume is above normal for that stock, and the percent tells you by how much. With a short and a long average side by side, you see whether today stands out against both.

I built it for traders who use volume to follow trends and want to see where price action stands out. A green label is about volume only. It says nothing about which way the next move goes. Before acting on a high-volume day, decide where your stop goes and size the trade so a stop-out costs a small, fixed share of your account.

## Adding a Third Average

A third average takes 4 additions that follow the same pattern as the first two:

- Add an input, for example input length3 = 180;

- Define its average and percent: def avg3 = Average(vol, length3); and def pct3 = vol/avg3;

- Declare def avg3Plot; and assign it in both the short case and the long case, the same way as avg2Plot.

- Copy the last AddLabel line and replace every 2 with a 3.

## Common Problems and Fixes

The table shows 6 Average Volume Stats problems that came up while I built the indicator in the video.

Problem Cause Fix

No labels after you apply the study ThinkOrSwim put the study in the volume subpanel, which may be hidden Add declare upper; or move the study to the price panel

The volume changes when you switch timeframes volume reads the chart's own bars Use volume(period = "Day")

Both average labels show the same number Both length inputs are set to the same value Open the settings and give them different lengths

A label still says 30D after you change the length The length is typed into the label text Start the label with length1 + "D Avg: "

An error that a variable never gets a value A switch case doesn't assign every display variable Assign volPlot , avg1Plot and avg2Plot in both cases

Labels stay gray above 100% No color rule yet, or a rule that compares with 100 Compare the ratio with 1

If your version won't compile, compare it line by line with the Code tab, or see our guide on [how to fix bugs in thinkScript code](https://tosindicators.com/thinkscript/fix-bugs). You'll find more free studies to practice on on our [indicators page](https://tosindicators.com/indicators).

## Average volume on real charts

Drawn from real daily bars with the code on this page, through Oct 20, 2026. The three labels read the day's volume and two averages of daily volume, 30 and 90 days by default, with the short number format (millions of shares). An average label turns green when the day's volume is above it. I picked the day by rule: the most recent session when SPY traded more than 1.5 times its 30-day average.

### SPY on Sep 18, 2026

SPY around Sep 18, 2026. The labels show the values for the circled day; on a live chart they show the current day.

SPY traded 58.8 million shares on Sep 18, 2026, 181% of its 30-day average of 32.4 million and 147% of its 90-day average of 40.1 million. It closed -0.1% on the day, with a high-to-low range of 0.5%. That was the third Friday of a quarter-end month, when stock options, index options and index futures all expire, and heavy volume on a quiet day is common then.

### By the numbers

40% Days above the 30-day average

8.4% Days above 150% of it

2.1% Median range on those heavy days

0.7% Median range on days at or below average

SPY daily, Jan 4, 2016 to Oct 20, 2026 (2,715 sessions). Range is the high minus the low as a share of the prior close. Heavy volume and wide ranges tended to arrive together, though not every heavy day is a big one.

The full thinkScript code is free with an account: [create one](https://tosindicators.com/register) or [sign in](https://tosindicators.com/login) on this page.

## Download

Average Volume Stats Indicator Download the Average Volume Stats indicator for ThinkOrSwim. The download is a .zip with one study file, TI_AvgVolume_StatsSTUDY.ts: the finished indicator from the video, with the 3 labels, 30-day and 90-day defaults, and the short and long number formats. Import it as a study. If you haven't added a custom study before, here's [how to import an indicator into your ThinkOrSwim platform](https://tosindicators.com/thinkscript/how-to-import-thinkorswim).

[Download free](https://tosindicators.com/indicators/average-volume)

## Video: Average Volume Stats, built line by line

26 minutes on YouTube.

[Watch on YouTube](https://www.youtube.com/watch?v=oupK-rqzbtQ)

## Questions

What does the Average Volume Stats indicator show?

It prints 3 labels on your ThinkOrSwim price chart: today's volume, the average daily volume over 30 days and over 90 days, and today's volume as a percent of each average. An average label turns green when today's volume is above that average and stays light gray at or below it. Both lengths can be changed in the settings.

How do I add average volume labels to a ThinkOrSwim chart?

Download the free study from this page and import TI_AvgVolume_StatsSTUDY.ts, or click Studies, choose Create, and paste in the code from the Code tab. The code declares itself an upper study, so the labels print in the top left corner of the price chart. Double-click the study to change the averages or the number format.

How do I show daily volume on an intraday chart in ThinkOrSwim?

Use volume(period = "Day") instead of volume. Plain volume returns the volume of the chart's current bar, so on a 1-minute chart it shows 1 minute of volume. With the period set to Day, the indicator reads the daily bar. In the video the volume label showed the same number on a 1-minute chart as on the daily chart, and both averages are built from that daily volume.

Why is my average volume label green?

A green label means today's volume is above that average. The indicator divides today's volume by the average, and when the result is above 1, which is 100%, the label turns green. At 100% or below it stays light gray. In the video, SPY read 228% of its 180-day average and 210% of its 360-day average, so both labels were green.

How do I change the 30-day and 90-day averages?

Double-click the study on your chart and change length1 and length2. The averages, the percentages and the label text all update, because the labels read the length from the inputs. In the video I tried 180 and 360 days, then 5 and 10 days to compare short-term volume.

What is the difference between the short and long number format?

Short, the default, shows volume and the averages in millions, so 189 million shares reads 189. Below 1 million shares, the download keeps 2 decimals, so 450,000 reads 0.45. Long shows the full share count rounded to whole shares. The percentages look the same in both formats.

Why doesn't my volume label show up on the chart?

The study most likely landed in the volume subpanel. When I first tested the code in the video, ThinkOrSwim placed it there, and I keep that panel hidden, so nothing showed. Adding declare upper at the top of the code keeps the study on the price panel, where the labels print in the top left corner.

How do I add a third average to the indicator?

Add a third input such as length3, define avg3 as the average of vol over length3 and pct3 as vol divided by avg3, declare avg3Plot and assign it in both the short and long cases, then copy the last AddLabel line and change every 2 to a 3. I describe these steps at the end of the video.

## Related tools

[Increasing Volume: Scan · Free](https://tosindicators.com/scans/increasing-volume)[Unusual Volume: Scan · Free](https://tosindicators.com/scans/unusual-volume)[Volume Intensity: Indicator · Free](https://tosindicators.com/indicators/volume-intensity)[Advanced Volume Zone Oscillator: Indicator · Free](https://tosindicators.com/indicators/vzo)[Super Bowl Indicator: Indicator · Free](https://tosindicators.com/indicators/superbowl)[Bollinger Bands Reversal: Indicator · Free](https://tosindicators.com/indicators/bollinger-bands-reversal)

## Get each new indicator by email

One email on Sundays with the week's new tool and its code. A free account also unlocks every .txt download.

No credit card. Unsubscribe anytime.
