
3. For each day, calculate the difference between the ratio and its moving
average.
4. Calculate the 20-day moving average of those differences.
5. For each day, calculate how many standard deviations the difference in
ratios is for that day from its moving average. Calculate the standard
deviation for each day using its prior 20 days.
6. For each day, if the standard deviation calculated is greater than 1.5
and QQQ is 2 percent greater than the prior day, then short QQQ. (In
other words, the spread between QQQ and SPY has become much
greater than usual. If this is true and QQQ had a big up move, then
QQQ is most likely the culprit and needs to be shorted.)
7. For each day, if the standard deviation calculated is less than –1.5 and
QQQ is 2 percent lower than the prior day, then buy QQQ.
8. Sell/cover when the standard deviation of the difference in the ratios is
less than 0.5 (in the case of a short) or greater than –0.5 (in the case of
a long).
The system is pretty complicated to put together and requires some
coding. The code is presented in the Appendix to this technique.
EXAMPLES
QQQ, 5/20/03
On May 19, 2003, QQQ fell almost 3.6 percent and SPY fell 2.3 percent. Sure
enough, this was larger than the usual ratio of percent changes between the
two exchange traded funds (ETFs), specifically more than 2 standard devi-
ations away from the average difference between the ratio between the
two assets and the 20-day moving average of that ratio. In Figure 2.1, the top
pane maps out the standard deviations between the ratio for that day and
the 20-day moving average of the ratio. In the second pane, the wavy line is
the ratio and the straighter line is the 20-day moving average of that ratio.
Since on May 19 QQQ had fallen over 2 percent, the system buys at the
open the next day at 27.76 and holds until the number of standard devia-
tions between the ratio and its moving average goes back above –0.5 stan-
dard deviations, which occurs on May 28. The system sells at 29.16 for a
5.04 percent profit.
How to Play the QQQ-SPY Spread Using Unilateral Pairs Trading 25
4199_P-02.qxd 12/30/03 3:14 PM Page 25