The Gateway to Algorithmic and Automated Trading

Dual Dollar Drama

Published in Automated Trader Magazine Issue 12 Q1 2009

Brian Coffaro, product manager for futures and foreign exchange at Bloomberg Tradebook, outlines the use of an FX algorithm to take a short position in AUDUSD.

The Scenario: A small London-based currency fund is bearish of Australia's economic prospects. The fund held a successful short position in AUDUSD through most of the late summer and early autumn of 2008, finally liquidating the position in early October. Since then, the fund's manager has been unconvinced by the rally in AUDUSD and expects it to make a second leg down in January.

He suspects that the recent early January highs around 0.7267 are likely to prove the top of the rally that started in late November 2008. However, he does not expect the anticipated decline to be anything like as protracted as the successful 2008 trade. He therefore needs to get a position on quickly before too much of the move occurs and takes the view that the falls in AUDUSD from January 7th to 9th quite possibly represent the beginning of the decline.

The Asset: AUDUSD. The bid/offer spread typically fluctuates around 5 pips, but can expand significantly in less liquid periods.
The Challenge: To sell 200m AUDUSD during the morning of January 12th 2009, at an average price of 0.6905 or better.

The Algo: An FX algorithm that accesses multiple liquidity sources. The algorithm has random iceberg functionality, so the trader can specify upper and lower limits and the algorithm will pick a random amount between those values that will actually be shown to the market. If the market starts to move away, a pegging function allows the trader's orders to be kept within a specified number of pips of the bid or offer. However, if the market starts to move in the trader's favour and an order slice is hit, a scale back function automatically moves the next slice a specified number of pips away from the previous trade, in the expectation of achieving further price improvement.

The Trader: The trader, who is based in London, handles all currency trades for the fund and uses a variety of proprietary technical tools to assist in market timing, including price and volatility divergence patterns.

figure 1
Figure 1 - Source: CQG, inc. © 2009. All rights reserved worldwide.

5.30am: AUDUSD has been trending steadily down during Sydney trading hours and is currently trading some 1.3% below last Friday's close. However, a minor rally has been underway over the past ninety minutes and as London-based volumes starts to pick up, the trader anticipates being able to sell into this.
He sets the algorithm parameters as follows:

• Displayed amount - random quantity anywhere between seven and thirteen million
• Peg level - ten pips from the current offer
• Scale back - five pips from the last price traded by the algo
• Limit price - no participation below 0.6885

5.43am: (Quantity filled - 9.3m) So far so good. The market has been moving steadily up over the past ten minutes and the algo has filled the first order slice at 0.6931. The trader opts to take advantage of the situation by increasing the scale back setting to eight pips. Market is now trading 0.6932-37.

6.06am: (Quantity filled - 18.1m) Still going well. The rally has continued and the algo has sold another slice at 0.6942. Market is now trading 0.6947-53.

6.11am: (Quantity filled - 18.1m) Potential trouble; the market has started to come off fast.

6.20am: (Quantity filled - 26.3m) Minor rally has allowed the execution of a third order slice.

7.05am: (Quantity filled - 47.2m) Market has been drifting between approx 0.6923 and 0.6938 for the past 45 minutes. By reducing the algo's scale back setting to three, the trader has managed to pick up two further order slices (see Figure 1). If things stay as they are, the trade should complete without grief.

7.40am: (Quantity filled - 47.2m) The trader anticipates that the market will make a further oscillation between 0.6923 and 0.6938 and increases the scale back setting to eight, expecting the market to trade back up into his order.

8.03am: (Quantity filled - 82.3m) Good call - it does just that, resulting in three further fills. The market has rallied up to 0.6938 and spent some ten minutes at around that level before pushing through to make a minor high at 0.6941.

figure 2

Figure 2 - Source: CQG, inc. © 2009. All rights reserved worldwide.

8.22am: (Quantity filled - 82.3m) Worrying; the market has dropped twenty pips in less than a minute. Two factors appear to be undermining the Australian dollar. Some rather unhelpful post-session (Sydney time) comments from assorted currency strategists highlight the poor prospects for the Australian job market. (December's domestic employment data is due out on Thursday January 15th and the outlook is poor.) Another factor has been a late flurry of USD 'safe haven buying' from a variety of Asian markets where stocks have had weak sessions. However, at 0.6908 the market is still comfortably above the trader's limit price.

8.25am: (Quantity filled - 82.3m) After missing a fast ten pip rally and suspecting that Australian news may continue to weigh on AUDUSD for the rest of the day, the trader opts for more aggressive settings and sets the scale back settings to two pips.

8.48am: (Quantity filled - 94.7m) A gradual rally over the past fifteen minutes has allowed a further order slice to be filled and the total trade nearly half completed.

8.55am: (Quantity filled - 94.7m) Serious trouble. The market has dropped nearly forty pips in the past six minutes and is now trading below the 0.6885 limit price, so the algo is inactive. All the trader can do is chew fingernails and stare at the screen.

9.09am: (Quantity filled - 94.7m) Possible hope. The market has potentially become over extended on the downside. The trader uses a variant on Bollinger bands to identify these situations. Instead of using a conventional moving average and standard deviation bands, these use a moving average and bands that are volatility weighted according to the time of day. (The weighting assigned is adjusted according to its position in relation to the average volatility for that time of day over the past x days.) The ten minute bar circled in yellow in Figure 2 has just clipped the second downside deviation band, which makes an imminent reversal probable.

9.10am: (Quantity filled - 94.7m) Further slight cause for optimism. A bullish divergence pattern between price and a short term oscillator has triggered on the open of the next ten minute bar (flagged with a green arrow in Figure 3a). However, the longer term picture for the session remains gloomy; Figure 3b shows the ten minute chart since midnight London time, together with the thirty and fifty period moving averages. If the market reverses, any rally may only be short term and the window of opportunity to unload the remaining 105.3m will be similarly brief. This is going to be seriously tight.

9.16am: (Quantity filled - 94.7m) Market has rallied sixteen pips in the last six minutes and just touched 0.6885. Realising he may have only a tiny opportunity to complete the order, the trader sets the scale back parameter to one pip and adjusts the randomised order slice range to between eleven and fifteen million.

9.25am: (Quantity filled - 120.2m) The market is now nine ticks above the trader's limit and two further slices have traded.

9.32am: (Quantity filled - 144.9m) The market has continued to rally, briefly hitting 0.6905 before falling back. Two more slices traded.

figure 3

Figure 3a - Source: CQG, inc. © 2009. All rights reserved worldwide.

figure 3b

Figure 3b - Source: CQG, inc. © 2009. All rights reserved worldwide.

9.38am: (Quantity filled - 144.9m) So close and yet so far, as AUDUSD is now fading rapidly now back towards the trader's limit.

With time and opportunity running out fast, the trader has no choice but to risk showing more of the order to the market and so increases the randomised order slice range to between fourteen and eighteen million.

9.39am: (Quantity filled - 178.3m) Two more slices filled, but it's the last chance to complete now as the market is dropping fast, so the trader sets the algo to fill the final 21.7m required as a single slice.

9.43am: (Quantity filled - 200m) Done (just)! The final slice trades at exactly the limit price. Objective achieved - average selling price for the whole trade is 0.690971.