TWAP
Definition of Time Weighted Average Price Algorithm
Time-Weighted Average Price (TWAP) is a trading algorithm based on weighted average price used to execution of bigger orders without excessive impact on the market price. It may be easy to guess trading pattern of the running strategy if its orders are not modified in a special way, so parameters can be adjusted to make strategy harder to track. The most common solutions are randomizing orders’ size and/or delay time between them. It is possible to limit quantity to not exceed a defined percent of volume particip, to miniamlize strategies’ impact on the market.
Time-Weighted Average Price (TWAP) is another trading algorithm based on weighted average price and in compare to Volume Weighted Average Price its calculations are even simplier. Also it’s one of the first execution algorithms and unlike most algo trading strategies it’s passive execution algorithm that waits for proper market price to come, doesn’t chase it.
Before diving into the details of TWAP calulations and its appliance as a trading strategy, let’s look at this interesting short video on algorithmic trading in general.
TWAP AS A TRADING STRATEGY
Market Data
- Last trade
- Best quote
- Order book
- Statistics
Algorithm Parameters
PARAMETER NAME | DESCRIPTION | ESSENTIAL |
---|---|---|
Target Quantity | Overall quantity to be realized by strategy | Yes |
Step~Size | Quantity to realize in single order | Yes |
Delay | Delay time between following orders | Yes |
Start Time | Time when strategy begins to submit orders | Yes |
End Time | Time when strategy ends to submit orders | No |
Price Limit | Price limit for orders | No |
Side | Market side for orders | Yes |
Algorithm Conditions
Open position
Strategy opens positions every time the delay value is reached and market price is not higher that strategy’s price limit. If maximum volume particip is reached, sending orders is suspended. Strategy stops its execution when order’s quantity exceed Target Quantity.
Termination
Strategy ends when End Time is reached or declared orders’ quantity has been realized.
Time frame
TWAP strategy works in declared period of time (if Start Time and End Time are specified) or till reaching Target Quantity. Frequency of strategy positions opening depends on Delay, Price Limit parameter and market price. Strategy can be executed in both: daily and long-term trading.
Typical Price = (Close+High+Low+Open)/4
Let’s just take a look at example results calculated on 1-minute interval intraday Morgan Stanley’s stock.
Time | Close | High | Low | Open | Typical Price | TWAP |
09:30:00 | 38.90 | 38.96 | 38.90 | 38.96 | 38.93 | 38.930 |
09:31:00 | 38.94 | 38.97 | 38.86 | 38.92 | 38.92 | 38.926 |
09:32:00 | 38.91 | 38.96 | 38.91 | 38.94 | 38.93 | 38.928 |
09:33:00 | 38.89 | 38.94 | 38.88 | 38.92 | 38.91 | 38.922 |
09:34:00 | 38.90 | 38.94 | 38.90 | 38.90 | 38.91 | 38.920 |
09:35:00 | 38.97 | 38.97 | 38.90 | 38.90 | 38.93 | 38.922 |
09:36:00 | 38.92 | 38.96 | 38.92 | 38.96 | 38.94 | 38.925 |
09:37:00 | 38.90 | 38.93 | 38.86 | 38.93 | 38.91 | 38.922 |
09:38:00 | 38.90 | 38.92 | 38.89 | 38.89 | 38.90 | 38.920 |
09:39:00 | 38.92 | 38.92 | 38.88 | 38.91 | 38.91 | 38.918 |
09:40:00 | 38.90 | 38.92 | 38.88 | 38.91 | 38.90 | 38.917 |
09:41:00 | 38.84 | 38.89 | 38.82 | 38.89 | 38.86 | 38.912 |
09:42:00 | 38.87 | 38.87 | 38.84 | 38.84 | 38.86 | 38.908 |
09:43:00 | 38.85 | 38.89 | 38.84 | 38.89 | 38.87 | 38.905 |
09:44:00 | 38.81 | 38.85 | 38.80 | 38.85 | 38.83 | 38.900 |
09:45:00 | 38.69 | 38.80 | 38.67 | 38.80 | 38.74 | 38.890 |
Use of TWAP Strategy
The most common use of TWAP is for distributing big orders throughout the trading day. For example let’s say you want to buy 100,000 shares of Morgan Stanley. Putting one such a big order would vastly impact the market and the price most likely would start to raise. To prevent that, investor can define time period in TWAP Strategy over which they want to buy shares. It will slice evenly big order into smaller ones and execute them over defined period.
TWAP could be used as alternative to VWAP, but because of itssimplicity we have to remember about some pitfalls. Even if we slice big orders, we do it evenly, thus there is a possibility to hit on low liquidity period when our splitted order will impact the market hard. That’s why it’s recommended to use TWAP over short periods or on stocks that are believed to not have any volume profile to follow.
- ect access trading strategies, 4Myeloma Press, 2010.
Good practice – be random
There is also another threat coming directly from dividing big order evenly, namely, other traders or predatory algorithms. Obviously trading in such a predictable way can lead to situation where other traders or algorithms would look through our strategy and start to “game” us.
Barry Johnson in his book suggests adding some randomness to the strategy as a solution to the issue. He says that “We can use the linear nature of the target completion profile to adopt a more flexible trading approach. At any given time, we can determine the target quantity the order should have achieve just by looking up the corresponding value on the completion rate chart.”
In practice it means that when we have run 4-hour TWAP we don’t slice the order into evenly parts, but otherwise we focus on percentage completion. So for instance we would want to have 25% of the strategy completed by first hour, 50% by second and 75% by third. That gives a more freedom into size of orders, so we can be more random with it and hence less predictable for other traders on the market.
TWAP vs VWAP
As both indicators use same mechanism, i.e. weighted average price, it’s common to compare them. Despite that VWAP’s nature is more complex and includes volume in its calculations, on instruments with low turnover TWAP and VWAP values can be close. On the other hand when a session starts to be more volatile both indicators will diverge.
On a table below there are TWAP and VWAP calculated for whole trading day. As we can see at the beginning of the trading day the difference is less than a cent, but on close the difference raised up to 2 cents. It happened because during the day there were some small volume trades for lower price that didn’t affected VWAP, but did TWAP.
Time | Close | High | Low | Open | TWAP | VWAP |
09:44:00 | 38.81 | 38.85 | 38.80 | 38.85 | 38.900 | 38.904 |
09:45:00 | 38.69 | 38.80 | 38.67 | 38.80 | 38.890 | 38.887 |
15:57:00 | 38.70 | 38.70 | 38.68 | 38.69 | 38.666 | 38.686 |
15:58:00 | 38.71 | 38.72 | 38.68 | 38.70 | 38.666 | 38.686 |
References
- H. Kent Baker, Greg Filbeck. “Portfolio Theory of Management” (2013) , pp.421
- Barry Johnson “Algorithmic & Trading DMA – An introduction to direct access trading strategies” (2010), pp. 123-126
Recommended readings:
Basket Orders, Bollinger Bands, CSI, MACD, Market Close, Parabolic SAR, POV, RSI, Slow Stachastic Osilliator, VWAP, William %R, Adoptive Shortfall, Triangular Arbitrage