TWAP Calculations
TWAP calculation is simple since it does not involve volume and does not need any complicated mathematical equation. To calculate TWAP you take the average of High, Open, Low, and Close price of each bar. Then find the average of these averages for a number of periods n’. For instance, if you want the value of TWAP for 8 periods, then:
• Retrieve the average values of High, Open, Low and Close of each individual 8 bars. For example, a1, a2, a3, a4, a5, a6, a7, a8
• Get the average of a1 to a8.
• TWAP= (a1+a2+a3+a4+a5+a6+a7+a8)/8
A practical example
Assume a trader wants to track the TWAP of a issuers cryptocurrency for 8 trading days. During the first day, the tokens open at 34, close at 36, achieved high of 38 and low of 32. The daily average of that particular day is (34+36+38+32)/4 or 35. The trader repeats the process and procedures each day for 8 days, then find the average of the results to get the 8-day TWAP.
TWAP strategy is significant when traders want to evenly spread the trades out over a particular period. If you are a retail trader who is exercising High-Frequency Trading or other types of Quantitative Trading then TWAP is a must for you. It is important for excellent execution of orders through random distribution throughout the day. Assume your trading algorithm provides a buy signal and you need to purchase 20000 cryptocurrency tokens of XYZ. You need to apportion this order into smaller orders like 2000 each and then execute trades on the basis of TWAP value. To know whether the price is overvalued or undervalued, you compare it with the TWAP value. When the price is below TWAP value it is undervalued and overvalued price is above TWAP value. Executing order in smaller orders also minimizes the effect on the market and leads to smooth execution of the trade.
However, there are some threats coming directly from apportioning big order evenly such as other traders or predatory algorithms. It is recommended that some randomness be added to the TWAP strategy as a solution to these threats. The linear nature of the target completion profile can be used to adopt a more flexible trading strategy. At any particular time, the target quantity the order should be achieved can be determined by finding the corresponding value on the completion rate chart. Practically, it implies that when you have run 4-hour TWAP you do not apportion the order into even portions, but concentrate on percentage completion. For example, you would want to have 30% of TWAP strategy completed the first hour, 55% by the second hour and 85% by the third hour. This provides more freedom into orders’ size so you can be more random with it and thus less foreseeable for other traders in the market.