Backtesting an Anchored VWAP Strategy

Backtesting an Anchored VWAP Strategy

, 4 min reading time

Anchored VWAP can be a useful tool when trying to determine the "fair price" of an instrument after large move. For example, anchoring a VWAP indicator to a recent low can give the trader an idea when price has pulled back enough to begin establishing a position.

The example above shows our VWAP tool for NinjaTrader anchored to a recent low on an hourly ES (SPY futures contract) chart. A bullish trader can wait until price connects with VWAP before entering a trade and help mitigate the risk of a a pull back.

Market Moving Events and Anchored VWAP

When it comes to analyzing market trends and making informed trading decisions, the Volume Weighted Average Price (VWAP) indicator is a valuable tool for traders. One interesting strategy is to anchor the VWAP indicator after significant market moving events, such as the release of key economic data like the Consumer Price Index (CPI) or Federal Reserve announcements.

Back Testing an Anchored VWAP Strategy After Market Moving Events

Given the recent market volatility surrounding CPI data and Federal Reserve announcements, using the VWAP indicator can provide traders with a quantitative measure of the average price at which a security has traded throughout the day.

The concept behind this back test is to apply an anchored VWAP to the candle corresponding to the time of the CPI release (8:30 AM EST) and observe how the market reacts to the information. If the closing price at the end of the day is above the VWAP by market close (4 PM), it is considered bullish, indicating a potential long position for the next trading day. Conversely, if the closing price is below the VWAP, it may signal a bearish trend.

We will use NinjaTrader's powerful back testing features to test this strategy. The first step is create a list of all of the CPI since 2023.

From there we dynamically create an anchored VWAP for all CPI dates that exist on the chart.

The implementation of the strategy happens in OnBarUpdate(). The first block of code finds and paints the background of the chart green or red if the end of day prices ends above or below VWAP respectively. The second block of code enters long or short depending on yesterdays close at 11am EST to avoid the opening volatility.

Performance

Disclaimer: This strategy is intended to demonstrate the application of AVWAP in a simplistic, naive algorithm. This has not been tested in real-world trading and past performance is not indicative of future results. Use this guide for educational purposes only.

Let's take a look at some of the trades.

The first CPI release day closes above VWAP which is considered bullish. However, the volatility continues until the next day's open. Luckly, we narroly avoid this by entering at 11am. A good example of why trading the open contains significant risk.

Next, let's look at a losing trade. On this day we open a long position however we get stopped out on a large candle which was probably caused by a news event. A good reminder why a strategy only build on a single variable is not a viable way to trade.

The screenshots above show the settings and performance for the strategy.

  • Instrument: ES Futures
  • Period: 15 min
  • Time frame: Dec 2022 - Feb 2024 time frame
  • 25 point stop loss and take profit (100 ticks)
  • 11 trades
  • 0 slippage
  • 0.42 sharpe ratio
  • 4.6K profit

Conclusion

Anchored VWAP can be a useful indicator in identifying entry points and understanding market reactions to significant events For example, momentum traders can use it to enter at after a pullback from a local swing high or low. While the strategy showed promise in certain scenarios, it's important to remember that it's a basic, untested approach in real-world trading and should be combined with a comprehensive trading strategy.

We've demonstrated the integration of the Scalp Radar AVWAP indicator with NinjaTrader for testing trading strategies, which is critical when developing new trading methodologies.

Download the strategy. Note, you will need a purchased copy of Scalp Radar AVWAP for this to work.

Leave a comment

Leave a comment


Blog posts

Login

Forgot your password?

Don't have an account yet?
Create account