TWAP or Time Weighted Average Price is another variant of VWAP (Volume Weighted Average Price). It is mostly used for large institutional investors to execute large orders without disturbing the market volatility. TWAP is defined as the average price of the stock for the specified period of time. It differs from VWAP as there is no volume involved in the calculation. In this post we will understand how to calculate TWAP and use it for trading. We will also explore TWAP AFL and Excel sheet.

# How to Calculate TWAP?

TWAP is calculated by taking average of Open, High, Low and Close price of each bar, and then calculating the average of these averages for ‘n’ number of periods. For Ex: if you want TWAP value for 10 periods, then:

- Take Average of Open, High, Low and Close values of each individual 10 bars. Say it a1,a2,a3…..a10
- Take average of a1 to a10. TWAP= (a1+a2+a3………..+a10)/10

As simple as that, TWAP calculation does not require any complex mathematical equations. The calculation is even simpler than VWAP.

Here is the screenshot showing how to calculate TWAP:

Download the excel sheet from below link:

# TWAP AFL

Check out the TWAP AFL below from WiseStockTrader. This AFL is designed for intraday but can be easily modified for daily or weekly timeframe

_SECTION_BEGIN("TWAP"); /* The TWAP for a stock is calculated by Averaging OHLC in each bar then averaging the whole previous bars Jarrah */ Bars_so_far_today = 1 + BarsSince( Day() != Ref(Day(), -1)); StartBar = ValueWhen(TimeNum() == 090000, BarIndex()); TodayClose = Sum(C,Bars_so_far_today); TodayHigh = Sum(H,Bars_so_far_today); TodayLow = Sum(L,Bars_so_far_today); TodayOpen = Sum(O,Bars_so_far_today); TWAP = (TodayClose + TodayHigh + TodayLow + TodayOpen)/4 ; IIf (BarIndex() >= StartBar, ATWAP = TWAP / Bars_so_far_today,0); Plot (ATWAP,"TWAP",colorYellow, styleThick); _SECTION_END();

# TWAP Application for Traders

TWAP is a must for retail traders who are practicing High Frequency Trading or other forms for Quantitative trading. It is useful for smart execution of orders by distributing it randomly throughout the day. Suppose your trading algorithm gives a buy signal and you want to buy 10000 stocks of TCS. You should divide this order into smaller chunks say 1000 each, and then execute trades based on TWAP value. Price below TWAP is generally undervalued and price above TWAP is overvalued. Placing order in smaller chunks would also lessen the impact on market and result in smooth execution.

**Also Read: Risk Reward Ratio: An ultimate tool for Success in Stock Market**

# TWAP vs VWAP

Below are some contrasting differences between TWAP and VWAP:-

- TWAP is weighted based on time, VWAP is weighted based on time and volume.
- Small volume trades do not impact TWAP but it does impact VWAP
- TWAP calculation is fairly simple while VWAP calculation is complex
- VWAP trade will buy or sell 40% of a trade in the first half of the day and then the other 60% in the second half of the day. A TWAP trade would most likely execute an even 50/50 volume in the first and second half of the day.