AlgoTest Logo

Backtest An Option Buying Strategy Using VWAP

Backtest options trading strategies on AlgoTest

Backtest An Option Buying Strategy Using VWAP

Facebook
Twitter
LinkedIn
Email
Telegram
WhatsApp

In this blog post, we’ll show you how to backtest an option buying strategy using the VWAP indicator, available exclusively on AlgoTest.

A few days ago we shared a strategy on Twitter that used the #VWAP template to trade.

What is VWAP?

VWAP stands for the Volume Weighted Average Price. An intuitive way of thinking about this indicator is to think of it as a type of an average price. However, unlike average, VWAP uses weights to give some prices more priority over others when using them to calculate the average. Naturally, a follow-up question to this is, what prices are given more priority?

Answer – those prices at which the highest volume is traded are given the highest priority. If 10 lots of BANKNIFTY trade at ₹100 and 1000 lots trade at ₹110, then the simple average will just be (100+110)/2, which is ₹105. The VWAP, on the other hand, will be (100*10 + 110*1000)/(10 + 1000), which is ₹109.90. Notice how the VWAP is much closer to ₹110 as compared to the average price!

The VWAP Indicator

Now that you understand that the VWAP is an average, we can use this as an indicator to generate signals. AlgoTest has a #VWAP template where you can build simple strategies using this indicator. Our strategy logic will be very simple – we will buy a call if its price falls below VWAP, and we’ll sell it once its price goes back above VWAP.

Signal Leg

AlgoTest allows you the flexibility to calculate indicators on one instrument and take trades in any other instrument! The instrument on which we calculate our indicator is called the “Signal Leg”. In our example, let’s pick the call option whose price was Rs 200 at 9:30 am as our signal leg.

Backtest  Strategy
Selecting Signal Leg

Entry and Exit Indicators

Next, lets define our Entry and Exit Indicators. Since we’re using the VWAP template, we’ll keep the entry and exit indicators very simple. We buy a call when the price falls below the VWAP by a certain threshold, and we it when the price goes above the VWAP by the same threshold. In this case, let’s keep the threshold at 1%.

Also, AlgoTest allows us to use any combination of the Open, High, Low, and Close prices of a candle to calculate the VWAP. In our case, we will use the average of the High and Low prices to calculate the VWAP.

Our entry condition then becomes, “if the close price is less than VWAP – 1% of VWAP, we will buy a call”.
The exit condition will then become, “If the close price is greater than VWAP + 1% of VWAP, we will exit the long call”.

In both these cases, the price used to calculate VWAP is the average of the open, high, low, and close prices of the candle.

To sum up, we’ve created a band of 1% around the VWAP price. If the close price of our instrument falls below the VWAP price by 1%, we will initiate a buy trade, and if the close price goes back above the VWAP by 1%, we will sell the option.

Backtest Strategy in india
Entry and Exit Indicators

Trade Leg(s)

AlgoTest also allows us to select our Signal Leg as our Trade Leg. In this case, we want to trade our Signal Leg itself when the Entry Indicator condition is satisfied. This is easy to do in AlgoTest – just add a new leg and choose “Signal Leg” as the strike when we’re selecting our leg. Here is a screenshot that shows the trade leg.

VWAP template leg builder

Now that the strategy is fully defined, let’s backtest our option buying strategy using VWAP!

Conclusion

Now that the strategy logic has been revealed, we can now comment on when to run this strategy. As you can see in the results, this strategy does not give as good returns as our regular #920straddle.

So why should we ever run this strategy?

The answer is correlation. In our previous blog post, we highlighted the importance of adding truly uncorrelated strategies to your current options trading strategies. If you’re like the rest of us, you are probably selling more options than buying. An options buying system like this one will not boost returns but its non-correlation will help reduce drawdowns and drawdown periods. To give you context, this strategy has made money in March and April 2022, the two months where our #920straddle has suffered.

Here is a short video where we demo the VWAP template

2 thoughts on “Backtest An Option Buying Strategy Using VWAP”

  1. Hi Algotest,
    Below is an excerpt of the above article:
    “”Also, AlgoTest allows us to use any combination of the Open, High, Low, and Close prices of a candle to calculate the VWAP. In our case, we will use the average of the High and Low prices to calculate the VWAP.””
    It mentions open, high, low and close prices of a candle….I would like to know the timeframe of the candle …it cannot be of the daily frame, otherwise there is no logic, it has to be below maybe 1hour or 15min…please confirm

Leave a Comment

Your email address will not be published. Required fields are marked *

Popular Posts