# Anchored VWAP

Page: https://tosindicators.com/indicators/anchored-vwap  
Video: https://www.youtube.com/watch?v=bIxMpIf6yIU  
Section: Indicators  
Skill: Beginner  
Access: free  
Updated: 2026-02-12

## 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.

## thinkScript code

```
# 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;
input anchorTime = 0930;

# Boolean conditions to test if we're past anchor point
def postAnchorDate = GetYYYYMMDD() >= anchorDate;
def postAnchorTime = SecondsFromTime(anchorTime) >= 0;

# Anchored VWAP calculation
plot anchoredVWAP = TotalSum(if postAnchorDate and postAnchorTime 
                             then ((high + low + close) / 3) * volume 
                             else 0) / 
                   TotalSum(if postAnchorDate and postAnchorTime 
                             then volume 
                             else 0);

# Styling
anchoredVWAP.SetStyle(Curve.FIRM);
anchoredVWAP.SetLineWeight(3);
anchoredVWAP.AssignValueColor(Color.CYAN);
```

## Questions

### How do I create an Anchored VWAP indicator in ThinkOrSwim?

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.

### What date and time format should I use for Anchored VWAP?

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.

### When should I anchor VWAP to a specific date and time?

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.

### Why isn't my Anchored VWAP line showing up on the chart?

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.

### How is Anchored VWAP different from regular VWAP?

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.

### Can I use multiple Anchored VWAP indicators on the same chart?

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.

### How do I modify the Anchored VWAP code for different price calculations?

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.

### What are the best practices for choosing Anchored VWAP anchor points?

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.

## Related

- [Best Volume Indicators for ThinkorSwim: Relative Volume, VWAP, and OBV](https://tosindicators.com/research/best-volume-indicators-thinkorswim-relative-volume-vwap-obv)
- [Anchored VWAP – March 2020 vs. June 2022](https://tosindicators.com/research/anchored-vwap-march-2020-vs-june-2022)
- [Anchored VWAP Scans](https://tosindicators.com/scans/anchored-vwap-scan)
- [VScore](https://tosindicators.com/indicators/vscore)
- [How to Build a Heiken Ashi Trend Dots Indicator in ThinkOrSwim](https://tosindicators.com/indicators/heiken-ashi)
- [Commodities Tracker](https://tosindicators.com/indicators/commodities-tracker)

