VWAP Trading Strategy (Backtest) - Quantified Strategies (2024)

Investors and analysts are always looking for ways to analyze the market, and one method of evaluating the current price of a stock to determine whether it is relatively overpriced or underpriced compared to the average trading price for the day is using the VWAP.

Abbreviated as VWAP, the volume-weighted average price is the average price of a stock weighted by the total trading volume. The VWAP is a trading benchmark that represents the average price an asset has traded at throughout the day when both volume and price are considered. It provides traders with pricing insight into both the trend and value of the asset.

Want to know more about VWAP, let’s dive in. Additionally, we make a VWAP trading strategy backtest at the end of the article.

Table of contents:

VWAP Trading Strategy (Backtest)

A few months back we made a wide backtest of all the different types of moving averages – including the VWAP moving average:

  • Moving average trading strategies comparison

Let’s repeat our main findings from that specific backtest we did on the VWAP strategy (4 different backtests on SPY – S&P 500):

  • Strategy 1: When the close of SPY crosses BELOW the N-day VWAP moving average, we buy SPY at the close. We sell when SPY’s closes ABOVE the same average. We use CAGR as the performance metric.
  • Strategy 2: Opposite, when the close of SPY crosses ABOVE the N-day VWAP moving average, we buy SPY at the close. We sell when SPY’s closes BELOW the same average. We use CAGR as the performance metric.
  • Strategy 3: When the close of SPY crosses BELOW the N-day VWAP moving average, we sell after N-days. We use average gain per trade in percent to evaluate performance, not CAGR.
  • Strategy 4: When the close of SPY crosses ABOVE the N-day VWAP moving average, we sell after N-days. We use average gain per trade in percent to evaluate performance, not CAGR.

The results of the first two backtests look like this:

Strategy 1

Period5102550100200
CAR8.187.85.095.052.672.93
MDD-27.93-33.22-38.71-40.27-50.57-49.2

Strategy 2

Period5102550100200
CAR1.421.814.434.486.866.38
MDD-62.58-57.08-41.1-41.68-45.99-40.12

What can we conclude from backtest 1 and 2?

Perhaps as expected, in the short run it shows that mean reversion strategies work, while in the long run, it’s better to use a trend-following approach.

  • Pros And Cons Of Mean Reverting Systems
  • What is trend following?

When we use a short number of days in the moving average, the best strategy is to buy when stocks drop below the average and sell when it turns around and closes above the moving average (buy on weakness and sell on strength). This can clearly be seen in the first test above for the 5-day moving average. The 5-day moving average returns a CAGR of 8.18%, which is almost as good as buy and hold even though the time spent in the market is substantially lower.

In the second backtest, the best strategy is to use many days in the moving average. The longer, the better. The 200-day moving average returns 6.38%, which is pretty good.

The results from backtests 3 and 4 look like this (the results are not CAGR, but average gains per trade):

Strategy 3

Period5102550100200
50.30.451.012.273.858.66
100.120.551.162.344.558.78
250.190.571.12.064.169.08
500.250.591.041.865.4511.17
1000.831.061.953.225.5810.24
2000.20.491.032.824.467.21

Strategy 4

Period5102550100200
50.220.190.852.064.169.1
100.130.231.11.894.328.34
250.190.170.951.524.27.67
500.110.270.611.314.498.98
1000.360.441.362.314.988.07
200-0.11-0.39-0.042.033.867.13

Again, the longer you are invested in stocks, the better returns you get. Inflation and earnings growth make sure of that.

However, be aware that we have tested just four strategies of the moving average and this might not be the optimal trading strategy. There might be better trading strategies out there. There are basically unlimited ways you can use a moving average and your imagination is probably the most restricting factor!

What is VWAP?

As the name suggests, the volume-weighted average price (VWAP) is the average price of a stock weighted by the total trading volume. VWAP is a commonly used benchmark derived from a ratio of the average share price for a stock compared to the total volume of shares traded over a particular time frame.

It is used to calculate the average price of a stock over a period of time and helps compare the current price of the stock to a benchmark, making it easier for investors to decide when to enter and exit the market.

In other words, it helps investors and analysts evaluate the current price of a stock and determine whether it is relatively overpriced or underpriced compared to the average trading price for the day. The VWAP can also assist investors in determining their approach toward a stock (active or passive) so as to make the right trade at the right time.

Institutional investors, who often trade in large orders, use VWAP as a benchmark to determine the quality of executions.

For example, say a fund manager wants to acquire 20 thousand shares of company X at a price below the average price for the day, he would keep an eye on the VWAP and try to beat it because that is what will be used to judge whether he succeeded in getting in at a good price. Their average purchase price would be compared to the VWAP at the time the position was accumulated.

VWAP example in the chart

Most trading platforms and charting packages come with built-in VWAP. Once you attach the indicator to a price chart, the platform calculates the values and overlays the indicator line on the price chart.

On TradingView, the indicator is displayed as 3 lines: an upper green line, a middle blue line, and a lower green line. It is the middle blue line that shows the VWAP. See the charts below:

VWAP Trading Strategy (Backtest) - Quantified Strategies (2)
VWAP Trading Strategy (Backtest) - Quantified Strategies (3)

Notice that the indicator coalesced into a single line that wraps around the price bars on the D1 chart (first chart), but on the 5-min chart (second chart), it spreads out to show the 3 lines for each day’s trading session. This is because the indicator is calculated for intraday trading and is anchored for a day’s trading session.

Note that the timeframe is set at a trader’s discretion, so you can set it at any timeframe, other than five minutes, but since VWAP only uses intraday data, the timeframe can only be an intraday timeframe, else you won’t see the indicator lines.

  • Which Time Frame Is Best In Trading?

Understanding how the VWAP works

The VWAP works as a technical indicator that can be attached to the price chart, but is used only on intraday charts unless it is set to use another trading session (say weekly or monthly trading session), other than the daily trading session. It resets at the start of every new trading session. So, for a daily trading session, which is the usual configuration, it resets at the market open for the day and coalesces at the day’s market close.

As an intraday price measure, the VWAP can be used by intraday traders and investors to decide whether to adopt an active or passive approach to position entries. It’s a trading benchmark that represents the average price a security has traded at throughout the day, based on both volume and price. So, it can also be useful for making decisions on whether to enter or exit a given security.

  • 5 Exit Strategies in Trading

Intraday traders consider VWAP important because it gives them some pricing insight into both the trend and value of a security. So, they use it to help them buy at relatively inexpensive prices and sell at comparatively higher prices.

How is VWAP calculated?

Although your trading platform automatically does the calculations and displays the indicator on the chart, it doesn’t hurt to have an idea of how the indicator is calculated to broaden your understanding of the indicator.

Typically, VWAP starts calculating the opening price for each day and keeps adjusting in real time right up until the close of the day’s trading session. So, the calculation uses intraday data only. This is the formula for calculating VWAP:

VWAP = (Cumulative typical price x Volume)/Cumulative Volume

The steps in calculating VWAP

Here are the steps:

Step 1: Calculating the Typical Price (TP)

The calculation starts with getting the Typical Price (TP) price of the first completed candle on the chart. This means that the calculation is dependent on the time frame of the chart being observed. So, on a five-minute chart, it would calculate the Typical Price of the first five-minute candle. This is the average of the high price, the low price, and the closing price of the candle. The formula is

TP = (H+L+C)/3

Let’s assume these data: H = 50.50, L = 45.00, and C = 48.50.

TP = (50.50+45.00+48.50) / 3 = 48.00

Step 2: Calculating the TPV

The next step in the calculation is to multiply TP by the volume (V) of shares that traded within the period being measured to find the Total Price Volume (TPV). Assuming the volume is 40,000, the TPV is calculated as follows:

TPV = 48.00 x 40,000 = 1,920,000

Step 3: Calculating the VWAP for the first candle

Therefore, using the VWAP formula above:

VWAP = TPV / V (since it is just the first data set)

= 1,920,000 / 40,000 = 48.00

As you can see, the VWAP for the first candle ends up being the Typical Price because the volume component cancels out in the first iteration of the calculation.

Further steps in the calculation

For the next candle and subsequent ones, the formula then calculates cumulative price and volume:

VWAP = [TPV (Candle 1) + TPV (Candle 2) + ….] / [V (Candle 1) + V (Candle 2) + …]

For our sample calculation, if we assume that the second candle closed with a typical price of 49.40, and a volume of 40,500, the TPV for the second candle would be 2,000,700. This would be added to the first candle’s TPV. Similarly, the cumulative volume is calculated by adding the volume for the second candle to the volume for the first candle, giving us a value of 80,500

The VWAP then is calculated by dividing the TPV sum by the cumulative volume. Thus, the VWAP after the second candle would be obtained as follows:

VWAP = [1,920,000 + 2,000,700] / 80,500 = 48.70

Note that this indicator is calculated for any intraday timeframe to show the VWAP for every data point in an intraday stock chart. The charting platform algorithms do the calculations automatically. You just have to attach the indicator on the chart and specify an intraday timeframe you want to see the indicator line.

What does VWAP tell you?

Since the VWAP combines price and volume in its calculation, analysts consider the indicator a better representative of the true average price of the stock than the moving average. Moreover, the calculation of the VWAP is independent of, and does not directly affect the stock’s closing price.

The VWAP indicator can tell you a lot about the price, depending on how you want to use it.

First, it gives you a context of the price trend and momentum regarding where the stock is trading — above or below — in relation to the VWAP line. If the stock is trading above the VWAP as the line rises, the stock is likely in an uptrend with bullish momentum. Conversely, if the stock is trading below the VWAP line as the line descends, the stock is likely in a downtrend with bearish momentum.

In addition to this, since institutional traders use the VWAP as a benchmark for execution activity, the VWAP price level is considered to be highly influential in intraday price action.

For instance, if Apple has a falling VWAP line but you want to take a long position, you may want to wait for the stock price to pierce the VWAP and reverse back up, showing that the short-term momentum is no long bearish before you make your trade.

The VWAP is, however, still considered a lagging indicator, as its calculation is based on historical data. But that doesn’t stop traders from using the indicator to establish support and resistance levels suitable for intraday trading. It provides a visual basis for supply and demand based on its relation to the stock price and the direction of the trend.

Moreover, the VWAP is a popular tool used by many traders, so it often presents the characteristics of a self-fulling prophecy.

For example, if a stock is trading higher but still below the VWAP line, traders may anticipate that it would rise to test the VWAP line, so they place buy orders, targeting the VWAP line. As more traders jump on board trying to get ahead of the others, the stock may naturally rise towards the VWAP.

Taking it a little further, bears that expect a rejection at the VWAP line may place their limit sell orders to short-sell the stock at the VWAP expecting profit takers and more sellers to come in and drag the price down. Whichever way you want to interpret it, the VWAP is most useful when combined with other indicators to confirm the longer-term trend.

  • Is It Possible To Make Money With Shorting Systems?
  • Pros And Cons Of Short Selling
  • 3 Short Selling Strategies

What Institutional traders use VWAP for

While intraday retail traders see VWAP as a trend indicator for short-term price moves, money managers and institutional traders often use it as benchmark price value to gauge the quality of their order executions from their market makers or traders. If they are constantly getting filled above the VWAP, it may cause the manager to seek other market makers or traders to carry out the order fills.

Also, when institutions want to get into a position but the price at which they get in can make a market impact, they use VWAP to gauge the liquidity and market impact of their orders. Placing huge orders at once will cause the price to rise triggering a chasing element to the fills. Subsequently, there may be a potential steep drop once the orders are filled.

Pros and cons of VWAP

The use of VWAP has some pros and cons. The pros are as follows:

  • In algorithmic trading, VWAP ratios can be used to determine the best price at which to buy or sell, in line with the volume of the market.
  • When trading large numbers of shares, the VWAP can be used to ensure that prices aren’t being overinflated by the trading volume.

Despite the benefits, there are some cons as well. The cons of VWAP include:

  • Lagging: The main problem with VWAP is that it is a cumulative indicator, meaning it relies on a vast amount of data points that will only increase in quantity throughout the day. With such a large data set, the VWAP line lags, just like the moving average, which is why most traders and investors only use one-minute and five-minute timeframes.
  • Only for short-term trading: The indicator is not really suitable for long-term trading since it uses intraday timeframe data.

Amibroker code for all moving averages

We have a product that contains the Amibroker code (some in Tradestation) for all the strategies that we have published for free. It also contains the logic of the strategy in plain English, and it’s thus very relevant for those traders backtesting in Python:

  • Code And Logic For All Free Strategies/Articles

Final words about the VWAP trading strategy

While both retail and professional traders may use the VWAP to help them determine price trends, the indicator is typically most useful to short-term traders.

FAQ:

– How is VWAP calculated?

VWAP is calculated by taking the cumulative typical price (average of high, low, and close prices) multiplied by the volume, and then dividing this by the cumulative volume. This calculation is performed iteratively throughout the trading day, providing a dynamic indicator of the average price.

– Why do investors use VWAP?

Investors use VWAP to evaluate whether a stock is overpriced or underpriced compared to the average trading price for the day. It aids in decision-making for entering or exiting the market and assists institutional investors in assessing the quality of their executions.

– What timeframes are suitable for using VWAP?

VWAP is typically used on intraday charts, as it resets at the beginning of each trading session. While the timeframe can be set at the trader’s discretion, it must be an intraday timeframe since VWAP relies on intraday data.

VWAP Trading Strategy (Backtest) - Quantified Strategies (2024)
Top Articles
No Luck With Dating Apps? (Try These 3 Tips!)
Return & Cancellation Policy | Depositphotos
Euro (EUR), aktuální kurzy měn
Unblocked Games Premium Worlds Hardest Game
Free Atm For Emerald Card Near Me
Guardians Of The Galaxy Showtimes Near Athol Cinemas 8
A Complete Guide To Major Scales
Sissy Transformation Guide | Venus Sissy Training
Free VIN Decoder Online | Decode any VIN
Oppenheimer & Co. Inc. Buys Shares of 798,472 AST SpaceMobile, Inc. (NASDAQ:ASTS)
Roblox Character Added
Craigslist Jobs Phoenix
Erskine Plus Portal
Sand Castle Parents Guide
Viha Email Login
Gdlauncher Downloading Game Files Loop
Q Management Inc
Who called you from +19192464227 (9192464227): 5 reviews
Ukc Message Board
Water Trends Inferno Pool Cleaner
Www Craigslist Com Bakersfield
Culver's Flavor Of The Day Taylor Dr
Johnnie Walker Double Black Costco
Evil Dead Rise Showtimes Near Regal Sawgrass & Imax
Joan M. Wallace - Baker Swan Funeral Home
25 Best Things to Do in Palermo, Sicily (Italy)
Understanding Gestalt Principles: Definition and Examples
Chamberlain College of Nursing | Tuition & Acceptance Rates 2024
Powerschool Mcvsd
Marokko houdt honderden mensen tegen die illegaal grens met Spaanse stad Ceuta wilden oversteken
2015 Kia Soul Serpentine Belt Diagram
Motorcycle Blue Book Value Honda
The Creator Showtimes Near Baxter Avenue Theatres
Dl.high Stakes Sweeps Download
Serenity Of Lathrop - Manteca Photos
How does paysafecard work? The only guide you need
All Things Algebra Unit 3 Homework 2 Answer Key
Drabcoplex Fishing Lure
Austin Automotive Buda
The Complete Guide To The Infamous "imskirby Incident"
התחבר/י או הירשם/הירשמי כדי לראות.
Cnp Tx Venmo
Reilly Auto Parts Store Hours
Borat: An Iconic Character Who Became More than Just a Film
Ts In Baton Rouge
Walmart Front Door Wreaths
Craigslist Free Cats Near Me
Diamond Desires Nyc
Billings City Landfill Hours
Otter Bustr
Predator revo radial owners
Latest Posts
Article information

Author: Foster Heidenreich CPA

Last Updated:

Views: 6154

Rating: 4.6 / 5 (76 voted)

Reviews: 83% of readers found this page helpful

Author information

Name: Foster Heidenreich CPA

Birthday: 1995-01-14

Address: 55021 Usha Garden, North Larisa, DE 19209

Phone: +6812240846623

Job: Corporate Healthcare Strategist

Hobby: Singing, Listening to music, Rafting, LARPing, Gardening, Quilting, Rappelling

Introduction: My name is Foster Heidenreich CPA, I am a delightful, quaint, glorious, quaint, faithful, enchanting, fine person who loves writing and wants to share my knowledge and understanding with you.