In mathematics and computer science, an algorithm is a set of instructions for calculations or a task. A trading algorithm is a model with steps required to trade an order in a specific way. For example, given an order to sell 100,000 shares of a stock, the algorithm can work in various ways. It can either give the rules to place this quantity as a single limit order at the current best market price.
Alternatively, it can divide this quantity into segments and execute the order over a couple of hours in the day. The algorithm decides the type, price and quantity for each of these small orders, based on a mixture of historical and live market data. Whatever the algorithm may be, its execution is fully automated through a computerized system which places these orders and monitors them.
Human intervention is generally not required in algorithmic trading. However, as per the algorithm, the computerized system can be controlled by a human trader in real time for modifying or canceling orders.
A simple algorithmic trading example is discussed below. The order is to sell 100,000 shares of a stock XYZ over the next four hours. A very simple, though impractical, an algorithm could be to sell 2500 shares every hour irrespective of market price. Such an algorithm is predictable and doesn’t take into account market prices and volumes.
On the other hand, an algorithm could take into consideration both these parameters. One such algorithm is based on the VWAP (Volume Weighted Average Price).
Volume weighted average price (VWAP) is a trading tool that is used by traders. These tools are used most frequently by short-term traders and in algorithm-based trading programs. It is used as a benchmark to decide the price at which the security should be bought or sold. The idea is if you buy a security at a price lower than the VWAP it is a good buy. Similarly, if you sell the security at a price higher than the VWAP then it is a good sell.
Anatomy of Automated VWAP Strategy
Having 3 key elements a VWAP Strategy consists of Analysis of incoming orders, Intelligent volume distribution, Work orders intelligently.
Analysis of Incoming orders
Analysis before a trade which filters out any orders that can be traded more appropriately using other meads. Any trades which are illiquid or very large relative to the average daily volume are diverted for manual attention.
Intelligent volume distribution
A key element of a successful automated VWAP strategy is an accurate estimate of the volume distribution. Over the desired time, the system generates a prediction of the stock’s volume pattern, full-day or partial-day. To match this projected volume pattern a trading distribution is created. More trading participation takes place during the periods of the day when the volume is expected to be the heaviest while minimizing the impact of trading during thin volume periods allowing the order to benefit from most liquid conditions.
Work orders intelligently
The last critical element of a successful automated strategy is the ability to obtain the best execution on individual trades around the expected volume distribution. A set of rules are used here to balance passive trades & earn spread against the need to stay on schedule for each time bin of the day. When markets are most liquid it taps into all available sources and trades most heavily.
If you can trade at better prices than those of volume-weighted average price (VWAP), this is often a point of evaluation for the ability of a trader. While being relatively straightforward, VWAP strategies are tough to implement.
Learn to extract earnings announcement dates from a financial markets portal using Python. Use the dates to build earnings announcement trading strategies. Read more in our post on ‘Extracting Historical Earnings Data Using Python‘.