Skip to main content Anchored VWAP Indicator For ThinkOrSwim Skip to main content Skip to content
Master the TTM Squeeze with our comprehensive 19-module course Start Learning →
TOS Indicators
  • Tools

    Categories

    • Indicators
    • Backtesters
    • Scans
    • Dashboards
    • thinkScript
    • Member Resources
    Browse Full Library

    Featured Tutorials

    Heiken Ashi Trend Indicator
    Heiken Ashi Trend Indicator
    Indicators

    Download our Custom Heiken Ashi indicator for ThinkOrSwim. Full ThinkScript code, formula...

    Learn more →
    Commodities Tracker
    Commodities Tracker
    Indicators

    For acceleration signals: trend-following strategies and buying pullbacks. For deceleration signals: short...

    Learn more →
    Build an Election Backtester in 10 Minutes
    Build an Election Backtester in 10 Minutes
    Backtesters

    Learn how to create a Post-Election Backtester in ThinkOrSwim to analyze market...

    Learn more →

    Popular Posts

    Unusual Volume
    Unusual Volume
    Scans

    Build 4 scans to easily find stocks with greater than...

    Learn more →
    Upcoming Earnings with High Short Interest
    Upcoming Earnings with High Short Interest
    Scans

    Build a scan to find stocks that are likely to...

    Learn more →
    Unusual Volume Pro Scans
    Unusual Volume Pro Scans
    Scans

    4 additional scans to find unusual volume overlapping with key...

    Learn more →
  • Courses
    Squeeze Course
    Squeeze Course
    19 Modules

    Scan, backtest, and trade the TTM Squeeze setup with precision.

    Unlock Course →
    Earnings Course
    Earnings Course
    3 Modules

    Master earnings plays with free indicators and proven strategies for ThinkOrSwim.

    Unlock Course →
    V-Shaped Reversals
    V-Shaped Reversals
    7 Modules

    Identify and trade powerful V-shaped reversal patterns with confidence and precision.

    Unlock Course →
    Fibonacci Trading
    Fibonacci Trading
    4 Modules

    Learn to trade Fibonacci retracements and extensions in ThinkOrSwim effectively.

    Unlock Course →
  • Products
    Futures Volatility Box Premium
    Futures Volatility Box

    Volatility models for 10 major futures markets, including micros & SPX.

    Explore Futures VB →
    Stock Volatility Box Premium
    Stock Volatility Box

    Dynamic support & resistance for 595+ stocks/ETFs, with a live scanner.

    Explore Stock VB →
    Opening Range Breakouts Premium
    Opening Range Breakouts

    Powerful live scanner & backtester for ORB strategies on 595+ stocks.

    Explore ORB Setups →
My Account
Back to Tutorials
Beginner 8 minutes ThinkOrSwim

Anchored VWAP

Step-by-step tutorial showing how to build a custom Anchored VWAP indicator for ThinkOrSwim using ThinkScript. Learn to anchor VWAP to any date and time for precise support and resistance analysis.

Download Indicator
How to install in ThinkOrSwim →
Table of Contents
  • The Problem with Regular VWAP
  • When Anchored VWAP Actually Matters
  • Building It From Scratch
  • Making It Look Professional
  • Real Example: Microsoft Earnings
  • Common Setup Mistakes
  • Advanced Applications
  • How the Code Actually Works
  • Practical Trading Tips

Introduction

The Anchored VWAP Indicator for ThinkOrSwim helps traders spot high-probability setups using volatility and trend alignment. By combining Average True Range (ATR) with moving averages, it filters stocks exhibiting compression near critical support levels. This tutorial focuses on two actionable scans: one for volatility spikes and another for consolidation patterns.

The first scan identifies stocks with ATR values exceeding their 50-day average, signaling unusual volatility. The second scan pinpoints assets compressing within 5% of their 50-day SMA while maintaining bullish moving average stack (8 EMA > 34 EMA > 50 SMA). These strategies help traders anticipate breakouts while managing risk through quantifiable volatility metrics.

Using real-world examples like Micron Technologies (MU) and NVIDIA (NVDA), you’ll learn to customize scans for intraday or swing trading. The tutorial includes step-by-step code implementation, parameter optimization, and live trading applications. Master these tools to streamline your market analysis and improve trade timing.

The Problem with Regular VWAP

If you use VWAP in ThinkOrSwim, you’ve probably noticed it resets every day at market open. That’s fine for some analysis, but what if you want to see how price has behaved since an earnings announcement at 2 PM? Or since a major reversal three days ago? Regular VWAP can’t help you there.

Anchored VWAP fixes this by letting you start the calculation from any date and time you choose. No more daily resets – just pure volume-weighted price action from the moment that matters to your trade.

When Anchored VWAP Actually Matters

This isn’t just another indicator to clutter your charts. Anchored VWAP works best in specific situations:

Day Trading Reversals: When you spot an intraday reversal, anchor VWAP to that exact time. Now you can see if the new direction has volume backing it or if it’s just noise.

Earnings Plays: Anchor to earnings announcement dates. Microsoft reports earnings on April 25th? Anchor your VWAP there and track how price respects that level in the following days.

Major Market Events: December 2018 lows, Fed announcements, breakouts from key levels – any time significant volume entered the market at a specific moment.

Building It From Scratch

Here’s exactly how to build Anchored VWAP in ThinkOrSwim’s ThinkScript editor. We’ll walk through each piece so you understand what’s happening.

Step 1: Start with Basic VWAP
VWAP is just the sum of (price × volume) divided by sum of volume. In ThinkScript:

plot anchoredVWAP = TotalSum(((high + low + close) / 3) * volume) / TotalSum(volume);

This gives you regular VWAP, but we need to add the anchoring logic.

Step 2: Add Your Anchor Inputs
Create two input variables so you can change the anchor point without editing code:

input anchorDate = 20190612;
input anchorTime = 0930;

Date format is YYYYMMDD. Time is 24-hour Eastern (0930 = 9:30 AM, 1445 = 2:45 PM).

Step 3: Create Boolean Tests
Now we need to test whether each bar is after our anchor point:

def postAnchorDate = GetYYYYMMDD() >= anchorDate;
def postAnchorTime = SecondsFromTime(anchorTime) >= 0;

The first line checks if the current bar’s date is on or after your anchor date. The second uses SecondsFromTime() – if it returns a positive number, you’re past the anchor time.

Step 4: Add Conditional Logic
Here’s where it gets interesting. We modify the VWAP calculation to only include bars that pass both tests:

plot anchoredVWAP = TotalSum(if postAnchorDate and postAnchorTime 
                             then ((high + low + close) / 3) * volume 
                             else 0) / 
                   TotalSum(if postAnchorDate and postAnchorTime 
                             then volume 
                             else 0);

This ensures only volume and price from your anchor point forward affects the calculation.

Making It Look Professional

Add some styling so the line stands out on your charts:

anchoredVWAP.SetStyle(Curve.FIRM);
anchoredVWAP.SetLineWeight(3);
anchoredVWAP.AssignValueColor(Color.CYAN);

Cyan color makes it easy to spot. Line weight of 3 ensures visibility on busy charts.

Real Example: Microsoft Earnings

Let’s say you want to track Microsoft’s price action since their April 25, 2019 earnings. Set anchorDate to 20190425, and suddenly you can see exactly how price has behaved since that catalyst.

In the example from the tutorial, price kept hitting Anchored VWAP as resistance for weeks – bouncing off it multiple times before finally breaking through. Once it broke above, that level became support.

This kind of analysis is impossible with regular VWAP because it resets daily, losing the connection to that specific earnings event.

Common Setup Mistakes

Wrong Date Format: Use YYYYMMDD format. June 12, 2019 = 20190612, not 6/12/19 or 12/6/19.

Time Zone Confusion: Anchor time always uses Eastern timezone. If you’re in Pacific time and want to anchor to 11:30 AM local, that’s 1430 Eastern.

Line Not Showing: The line only appears from your anchor point forward. If you anchor to tomorrow’s date, you won’t see anything.

Anchoring to Low-Volume Times: Avoid anchoring to overnight hours or thin trading periods. The VWAP calculation works best with significant volume.

Advanced Applications

Multiple Anchors: Run several Anchored VWAP indicators with different colors and anchor points. One for earnings, one for the daily open, one for a reversal.

Session-Based Analysis: Anchor to different market session opens – 9:30 AM for NYSE open, 8:00 AM for pre-market action, 2:00 PM for European close.

Event-Driven Trading: Keep a calendar of earnings, Fed meetings, and economic data. Anchor VWAP to these events to track institutional flow.

How the Code Actually Works

The genius of this approach is in the conditional logic. Instead of calculating VWAP from market open every day, we’re calculating it from any moment we choose.

The TotalSum() function normally sums all historical data. But by wrapping the price and volume calculations in if-statements, we’re telling it to only sum data from our anchor point forward.

Before the anchor point: the if-statement returns 0, so those bars don’t affect the calculation.
After the anchor point: the if-statement returns the actual price and volume data.

This creates a clean break where the VWAP calculation truly begins only from your chosen moment.

Practical Trading Tips

Support and Resistance: When price is above Anchored VWAP, it often provides support. When below, it often acts as resistance. This works because VWAP represents the average price at which volume has traded.

Breakout Confirmation: A decisive break above or below Anchored VWAP, especially with volume, often signals the start of a new trend phase.

Re-anchoring Strategy: As new significant events occur, consider updating your anchor point. Don’t let old anchor points overstay their relevance.

Volume Context: Anchored VWAP is most meaningful when anchored to high-volume events. Low-volume anchor points produce less reliable support/resistance levels.

Anchored VWAP transforms a simple daily reset indicator into a powerful tool for tracking institutional flow from any moment you choose. Whether you’re day trading around intraday levels or swing trading from major events, this gives you the flexibility to analyze exactly what matters for your trade setup.

Anchored VWAP.ts
# Anchored VWAP for ThinkOrSwim

# Created by TOS Indicators

# Full tutorial: tosindicators.com/indicators/anchored-vwap

# Input variables for anchor date and time

input anchorDate = 20190612;


// ... 29 more lines ...

Unlock This Code

Create a free account to access the full source code and download files.

Create Free Account Login
To create an Anchored VWAP in ThinkOrSwim, go to Studies > Create > ThinkScript Editor. Start with the basic VWAP formula: TotalSum(((high + low + close) / 3) * volume) / TotalSum(volume). Then add input variables for anchorDate and anchorTime, create boolean conditions to test if you're past the anchor point, and modify the VWAP calculation to only include bars from your anchor point forward.
Use YYYYMMDD format for dates (example: 20190612 for June 12, 2019) and 24-hour format for time in Eastern timezone (example: 0930 for 9:30 AM, 1445 for 2:45 PM). The time input uses Eastern timezone regardless of your location, so adjust accordingly if you're in a different timezone.
Anchor VWAP to significant market events with high volume: earnings announcements, major price reversals, breakouts from key levels, Fed announcements, or the start of significant trends. For day trading, anchor to intraday reversals or session opens. For swing trading, anchor to earnings dates, major lows/highs, or catalyst events that drove significant price movement.
The Anchored VWAP line only appears from your anchor point forward. Ensure your anchor date and time are in the past relative to your chart data. Check that you're using the correct date format (YYYYMMDD) and time format (24-hour Eastern). If viewing daily charts, make sure you have data after your anchor date. For intraday charts, verify the anchor time has passed.
Regular VWAP resets every day at market open, while Anchored VWAP starts calculating from any date and time you specify and continues indefinitely until you change the anchor point. This allows you to track volume-weighted price action from specific events like earnings, reversals, or breakouts, providing more relevant support and resistance levels than daily VWAP resets.
Yes, you can add multiple Anchored VWAP indicators with different anchor points. Consider using different colors for each (cyan, magenta, yellow) and anchor them to different significant events. For example, one anchored to earnings, another to a major reversal, and a third to the daily open. This provides multiple reference points for support and resistance analysis.
The default code uses typical price: (high + low + close) / 3. You can modify this to use just close price by changing the formula to "close * volume", or use (high + low) / 2 for midpoint price, or even hlc3 which is ThinkOrSwim's built-in typical price function. Experiment with different price calculations to see which works best for your trading style.
Choose anchor points with significant volume and clear price action: earnings announcements, gap opens, major breakouts or breakdowns, reversal patterns, and key support/resistance breaks. Avoid low-volume periods like overnight sessions or holidays. Update anchor points as new significant events occur, and consider the timeframe you're trading - intraday anchors for day trading, multi-day anchors for swing trading.

Here are some resources that you may find useful:

  • How to import an indicator into ThinkOrSwim (video tutorial)
Featured Tools:
Stock Volatility Box

Stock Volatility Box

Spot reversal zones across 600 stocks & ETFs.

  • Hourly & daily models
  • Powerful Live Scanner
  • Built for day traders
Futures Volatility Box

Futures Volatility Box

Pinpoint reversal zones in 10 major futures markets.

  • 5 models (incl. Scalper)
  • ThinkOrSwim & TradingView
  • SPX traders
ORB Setups

ORB Setups

Find the best Opening Range Breakout setups.

  • Powerful real-time scanner
  • Instant backtests
  • 2+ years data

Get Free Access

Create a free account for downloads and new tutorial alerts.

Create Free Account

More Tutorials Like This

Simple Breakout Tool

Simple Breakout Tool

Beginner • 14 minutes
Stacked Moving Averages

Stacked Moving Averages

Beginner-Friendly • 15 mins
Wilder's Momentum Concept

Wilder's Momentum Concept

Beginner • 23 minutes

Ready to Trade With an Edge?

Join 40,000+ traders using institutional-grade tools for ThinkOrSwim.

Get the Bundle
TOS Indicators

Premium thinkorswim indicators, scans, and trading tools to help you trade smarter.

ThinkOrSwim Tools

  • Indicators
  • Scans
  • Backtesters
  • Dashboards
  • thinkScript
  • Browse All

Courses

  • Squeeze Course
  • Earnings Course
  • V-Shaped Reversals
  • Fibonacci Trading

Products

  • Futures Volatility Box
  • Stock Volatility Box
  • ORB Setups
  • Shop All

Guides

  • TTM Squeeze
  • Automated Trading
  • Volatility Trading
  • Opening Range Breakouts
  • Trade Reports
  • Contact Us

© 2026 TOS Indicators. All rights reserved.

Privacy Policy Terms of Service Disclaimer

The information contained on this website is solely for educational purposes, and does not constitute investment advice. The risk of trading in securities markets can be substantial. You must review and agree to our Terms of Service prior to using this site.

U.S. Government Required Disclaimer - Commodity Futures Trading Commission. Futures and options trading has large potential rewards, but also large potential risk. You must be aware of the risks and be willing to accept them in order to invest in the futures and options markets. Don't trade with money you can't afford to lose. This website is neither a solicitation nor an offer to Buy/Sell futures or options. No representation is being made that any account will or is likely to achieve profits or losses similar to those discussed on this website. The past performance of any trading system or methodology is not necessarily indicative of future results.

Individual results may vary, and testimonials are not claimed to represent typical results. All testimonials are by real people, and may not reflect the typical purchaser's experience, and are not intended to represent or guarantee that anyone will achieve the same or similar results.

TOS Indicator's Traders and employees will NEVER manage or offer to manage a customer or individual's options, stocks, currencies, futures, or any financial markets or securities account. If someone claiming to represent or be associated with TOS Indicator solicits you for money or offers to manage your trading account, do not provide any personal information and contact us immediately.

CFTC RULE 4.41 - HYPOTHETICAL OR SIMULATED PERFORMANCE RESULTS HAVE CERTAIN LIMITATIONS. UNLIKE AN ACTUAL PERFORMANCE RECORD, SIMULATED RESULTS DO NOT REPRESENT ACTUAL TRADING. ALSO, SINCE THE TRADES HAVE NOT BEEN EXECUTED, THE RESULTS MAY HAVE UNDER-OR-OVER COMPENSATED FOR THE IMPACT, IF ANY, OF CERTAIN MARKET FACTORS, SUCH AS LACK OF LIQUIDITY, SIMULATED TRADING PROGRAMS IN GENERAL ARE ALSO SUBJECT TO THE FACT THAT THEY ARE DESIGNED WITH THE BENEFIT OF HINDSIGHT. NO REPRESENTATION IS BEING MADE THAT ANY ACCOUNT WILL OR IS LIKELY TO ACHIEVE PROFIT OR LOSSES SIMILAR TO THOSE SHOWN.