forex.thedaintyarchstudio.com

Pairs Trading

Maria Yu June 7th, 2007

One of the first things I learned in Forex was that currency pairs have relationships. Some currencies tend to move in the same direction, some in inverse direction. These relationships are not hard to memorize, they are clearly indicated in my charts setup.

chart setup

By looking at these nine major pairs in my setup, how pairs move relatively to each other is seen directly and visually. I am grateful for my Forex teacher who taught me this setup from the very beginning.

The correlation between two pairs are determined by their correlation coefficient. The correlation coefficient is always a value between +1 and -1. When the correlation coefficient of two pairs is +1, these two pairs move in the same direction 100% of the time. When the correlation coefficient of two pairs is -1, these two pairs move in the opposite direction 100% of the time. This Currency Correlations Table is updated daily.

Basically the correlation coefficients are computed from the currency prices. Their mean, standard deviation (variance) and covariance are what’s need in the computation.

I found there are different strategies in applying Pairs Trading to Forex:

1. Statistical Arbitrage

2. Avoid cancellation

3. Diversification

4. Verification

Pairs Trading was initially used in equity trading. It is a market neutral strategy, meaning that the return from the strategy is uncorrelated with the market return. Applying Statistical Arbitrage to Forex is to trade two currency pairs at the same time, long one currency pair and short the other. Should two strongly correlated pairs substantially diverge from their statistical correlation they are expected to revert back to their mean. Profit is made in this mean-reverting move. This article explains Pairs Trading very well.

If trading same positions on two currency pairs with an inverse relationship, these trades will eventually cancel each other. Take EURUSD and USDCHF as an example: the two pairs have a near 100% correlation of -1 , so if we long both and EURUSD rallies, we don’t make profit because USDCHF sells off.

On the other hand, pairs with a positive correlation move in the same direction but at a different pace. Different countries have different monetary policies, splitting orders in different currencies may lower risks.

Market trend can be verified and confirmed in pairs with a strong correlation. One of my Forex teacher’s trader friend trades GBPUSD exclusively. Once he does his technical analysis on the GBPUSD then he does the same on EURUSD, USDCHF, and USDJPY. If EURUSD shows the same trend he adds another lot to the GBPUSD. If USDCHF also shows the same thing he adds another lot to the GBPUSD. Then if USDJPY also says the same thing he adds another lot to the GBPUSD. Multiple confirmation!

In light of this powerful “Pairs Trading - Statistical Arbitrage” strategy I developed automated trading tools for my trading platform, MetaTrader 4. These programs are called Exper Advisors (EAs), they can analyze the situation on the market, make decisions, open positions, move stops, take profits, and close trades. I will talk about my implementation first and then show my trading results.

Implementation of Pairs_Trading_Forex

1. Select two statistically strongly correlated currency pairs.

2. Use price data of two time frames, one shorter time frame and one longer. The shorter time frame is for the Expert Advisor to attach to and is used to get the current prices. The longer period is used to compute the Mean and Standard Deviations, which are calculated in terms of price ratios of currency pair1 and pair2.

3 . Set an entry point for the trade. It is suggested to enter when the price ratio of pair1 and pair2 is at least two standard deviations from their Mean. For testing purposes I used 1.5 and I got good results.

4. Determine which pair goes long and which pair goes short.

5. Check the 14-day RSI of the current price (I used close price) of pair1 and pair2. No trades are entered if the long candidate’s RSI is below 40 and the short candidate is over 60.

6. Set the profit goal, ideally at 2 standard deviations above the entry, but I found for day traders 0.5 to 0.75 standard deviations were more reachable.

7. Set the stop loss at 1.5 standard deviations below the entry.

8. Determine the lot ratio of these two pairs. It should be the same dollar amount in both positions.

9. I developed three versions of Pairs_Trading_Forex. One uses the simple moving averages to compute the Mean (I call this version Pairs_Trading_Forex_v2), one uses the bar close prices to compute the Mean (this version is Pairs_Trading_Forex_v3), and one uses Kalman Filtering to compute the current bar close prices and the Mean (this version is Pairs_Trading_KF). In my testing, when one version got triggered to enter a trade, the other ones would do the same, there might be just 1 or a couple pips apart.

10. For testing purposes I programmed my Expert Advisors to move stops. When a pair has 10 pips of profit it’s stop is moved to break even (the entry) . At 25 pips of profit, the stop is at 10 pips of profit.

Equilibrium Trading

While developing my “Pairs_Trading_Forex” Expert Advisor I got an idea about an Equilibrium Trading startegy. I noticed in May that the market would move one direction and then reverse it’s direction back to a particular position. My Forex teacher also talked about this equilibrium behavior at our almost weekly tune-up meeting. But how do we find where this equilibrium or pivot is? I thought I could apply the idea of trading two strongly correlated pairs (pairs trading) to trading one pair, when this one pair is doing equilibrium moves. This is because any one currency pair is perfectly correlated with itself, that means its correlation coefficient is +1. Therefore, I could use the Mean computed from a longer time period, say day chart, and use it as the equilibrium that this pair is moving toward to. Just like the mean-reverting behavior occurring in two pairs trading, one single pair could be oscillating back and forth about its longer time Mean. Yesterday (June 6, 2007) when I was testing my Expert Advisor for Equilibrium Trading I got the same Mean from week chart and day chart for the USDCAD.

Math + Art = More

One realization I got while reading Ganapathy’s “Pairs Trading” book was that all the analysis, Math, modeling, computation in trading were so similar to my Master’s and PhD’s research work in contact mechanics. The time series and Kalman filitering techniques reminded me so much of my cyclic loading curves and kinematic-hardening, shakedown, ratcheting, incremental projection, and steady-state methods. Here is the link to get a picture of my Math work.

Trading Results

June 5, 2007 Tuesday

I started testing my automated Pairs Trading (Statistical Arbitrage) and Equilibrium Trading programs on Tuesday morning, June 5, 2007. While testing I was still making adjustments.

The GBPUSD and EURUSD got entered for pairs trading. In the beginning it was a loss but it then turned green. These trades were triggered by Pairs_Trading_Forex_v2. The screen shots of the trades and the EURUSD day chart can be viewed here. These trades I just used 1 lot for each pair, but I should have calculated their lot ratio. Their correlation of this week was good so I used 500 trading days (+0.97) to compute their Mean and Standard Deviation. The user input are shown in the GUIs. The Magic_Number is a number for me to identify which Expert Advisor (EA) I am testing and which chart the EA is attached to. It is also a number for the EA to manage and operate on the opened positions of these trades. A profit of $110.

The USDJPY and USDCAD got triggered independently for Equilibrium Trading. These three screen captures show the progression of the trades. Notice that in the third image the stop of USDCAD is at the entry. I programed my Expert Advisor to move the stop to the entry when a pair moves 10 pips. At 25 pips of profit, the stop will be moved to protect 10 pips of profit. The user input GUI is captured here. And a screen shot of the USDCAD’s day chart from the charting system I subscribe.

June 6, 2007 Wednesday

The (EURUSD, USDCHF) pairs and (EURUSD, AUDUSD) pairs got triggered for Pairs Trading. I was testing two versions of Pairs Trading EA, Pairs_Trading_Forex_v2 and Pairs_Trading_Forex_KF. The (EURUSD, AUDUSD) was triggered by both EAs but the (EURUSD, USDCHF) was only triggered by Pairs_Trading_Forex_KF. Ths might be due to earlier there was not enough money in the account to buy another (EURUSD, USDCHF). I closed a few trades before the (EURUSD, AUDUSD) got in. The correlation table for the day is here and the Fundamental Announcements. The screen captures of the trades are shown progressively on this page. A profit of $540.64.

June 7, 2007 Thursday

$2000

I woke up this morning and saw the Pairs Trading trades entered last night having a profit of over $2000 dollars. The (EURUSD, USDCHF) pairs got triggered by both the Pairs_Trading_Forex_v2 and Pairs_Trading_Forex_KF EAs. The (GBPUSD, AUDUSD) pairs got entered at 9:05 AM. Later at 5:25 PM the profit was $797.20.

A different chart setup and the correlation table for the GBPUSD are linked.

USDCHF entered Equilibrium Trading. I have two versions of EA, Equilibrium_Trading_v2 and Equilibrium_Trading_v3. The only difference is just the computation of the current price, v2 uses the bar close price, while v3 uses the average of ASK and BID prices. Both trades were triggered when the pairs’ 14-day RSI was below 60. However, USDCHF later climbed up to RSI > 70 so both trades were losses.

Conclusions

If I could make $2000 dollars while sleeping I would say Pairs Trading is magic. Here are my findings from my testing, comments from all traders are welcome.

1. Currency pairs maintain their correlation from time to time. If two pairs deviate from their relationship they try to go back to the statistical or historical correlation coefficient.

2. Each currency pair is perfectly correlated with itself, it maintains its own equilibrium by oscillating back and forth about this equilibrium.

3. Both the Pairs Trading Expert Advisor and the Equilibrium Trading Expert Advisor get triggered to enter trades. The currency pair triggered by the Pairs Trading EA may or may not be triggered by the Equilibrium Trading EA. Likewise, the pair triggered by the Equilibrium Trading EA may or may not be triggered by the Pairs Trading EA. When a pair really moves with momentum, most likely both EAs will be triggered. A few screen captures here show the trades entered by the Equilibrium Trading EA.

4. Using the correlation between two pairs is a good strategy to trade, so is using the correlation of a pair with itself. I do not know which correlation plays a more important role, it might change from time to time. Is it because a pair maintains its own equilibrium so it maintains its correlations with other pairs or is it because it observes its correlations with other pairs so it maintains its own equilibrium? The Market is a correlated place, so a pair might have to do both. It would be possible to trade just one pair against itself rather than adding a different pair with an opposite position, if the Equilibrium correlation is strong. Even so, the correlation between two pairs may have influences in determining the trading ranges.

5. Checking the Correlation Table regularly is helpful in making trade decisions. If I see two currency pairs’ one week correlation being close to their 1-year or 2-year correlation I know these two pairs probably will not be triggered by my Expert Advisors. If I see day by day two pairs’ one week correlation getting closer to their longer time correlation I know there might be trading opportunities coming.

6. Taking profit of Pairs Trading at 0.5 Standard Deviation or lower might be more realistic for intraday trading.

7. Construct the pairs trading portfolio in terms of equal amount of dollar (or any one currency) on both the long and short position. I have seen in my testing that if I just traded one lot for each pair in the pairs’ trades regardless of the dollar amount in each position, it took longer to get profit if not never.

8. Need to have enough margin to do Pairs Trading. The idea of Pairs Trading is to trade two pairs at the same time, one goes long and the other goes short. When there is not enough money to execute the second trade after the first trade being executed it breaks the strategy. Or when there is a margin call, the broker might take out one of the pairs’ trades. Here is an example: I was running multiple EAs on multiple pairs this morning (June 8, 2007) on my demo account so there wasn’t enough money to buy USDCHF for (ERUUSD, USDCHF) at 1:1.62 lot ratio and to buy AUDUSD for (ERUUSD, AUDUSD) at 1:1.65 lot ratio. I ended up having multiple EURUSDs at 1 lot. Luckily, these EURUSDs were on the green side so I actually made a profit. This article suggests entering the sell position first, I don’t know if that makes a difference in Forex.

9. The Pairs Trading and Equilibrium Trading strategies work well when there is momentum in the market. They may not do well at Fundamental announcements. Entering late might be better to avoid picking up false signals.

10. The Pairs Trading and Equilibrium Trading Expert Advisors help me make trading decisions. I could just run the EAs on a demo account, when I see the trades starting making profits steadily I know the converging trend is on the way and I can enter trades confidently in the right positions on both pairs. On the other hand, if the pairs’ trades keep losing money I know I should enter my trades in their reverse positions. These pairs’ trades can also confirm my technical analysis, and when I see momentum arrows in my trading charts, I know I can add more lots.

References

ProAct Traders Visual Charting System

Currency Correlations Table

Finding Profit in Pairs

Trading Pairs

“Pairs Trading” by Ganapathy Vidyamurthy

Kalman Filter

Spread Bet Uses - Pairs Trading

Use Currency Correlations To Your Advantage

What is Pair Trading

5 Comments »

  1. Are the above profit from live account ?

    Mark

    Comment by Mark — June 12, 2007 @ 11:18 am

  2. The testing was done on my demo on June 5, 6, and 7.
    Again last night, June 11, I ran my Pairs Trading and Equilibrium Trading EA on my demo and spotted trading opportunities. (GBPUSD, AUDUSD) entered at 6:39 PM EST for (buy, sell), EURUSD enterd at 6:08 PM for sell. I purposely reduced the entry for Equilibrium Trading to 1 Standard Deviation so EURUSD got triggered by the EA.
    I checked my technical analysis and chart indicators then entered trades in the live account and got pips.
    The reason for setting Equilibrium Trading EA entry at 1 Standard Deviation was because most Forex pairs had been just at about that position for the last few days and I wanted to test the EA.
    In equity pairs trading the entry was suggested to be at 2 Standard Deviation, it might be high for Forex, but should be safer.

    Comment by Maria Yu — June 12, 2007 @ 2:10 pm

  3. very interesting !
    it is new for me, i work on other strategies (martingale, trend, counter-trend) and i found here new ideas !! thanks
    is it possible to have yours ea’s to work on it ?
    i found you on mybloglog, you are now one of my contacts

    i will be pleased to work with you

    Comment by steph — June 19, 2007 @ 9:36 am

  4. Interesting strategies!

    Regarding your statistical arbitrage tradings, for example, long eur/usd while short usd/chf at the same time, I think you are making a directional bet rather than using a market neutral strategy (which you would intend to do for a stat arb), since eur/usd and usd/chf are NEGATIVELY correlated. Basically, for this trade, assuming eur/chf is nearly flat, you are betting usd will depreciate with respect to eur and chf, so this is a directional bet.

    I have yet to see a working statistical arbitrage strategy with just two currency pairs.

    Comment by Zane — August 15, 2007 @ 12:15 am

  5. Thanks for this very interesting article. It casts good light on pairs trading.
    If have read it several times over, and also applied it to a trading system on a paper account.

    However, I agree to the point made by Zane. When you are trading GBPUSD against EURUSD, you are effectively trading EURGBP. This is especially true if you trade a dollar neutral strategy. And then you are no longer market neutral. You could of course argue that the rate of GBPUSD vs. EURUSD is trading around an equilibrium and history shows that you are mainly correct, but that would be a different discussion.

    Thanks againg. Very useful info indeed.

    Comment by Trader — September 12, 2007 @ 3:52 am

RSS feed for comments on this post. TrackBack URL

Leave a comment

All reserch work, programming, testing and web design are done by Maria Yu
Copyright © 2008 All Rights Reserved
Based on a WordPressTheme