It is worth noting that for those country ETF pairs that cointegrate, their underlying currency cross-rates are often stationary as well. Now, there are several advantages in trading currency cross rates instead of ETF pairs. When trading a stationary cross rate, you can enter a limit order to enter and exit, but trading pairs of ETF's involve market orders on at least one side. Also, ETF's can sometimes be hard-to-borrow, and their margin requirements are much more onerous than that of currencies. However, the one major disadvantage in trading cross rates is that they are not always available on your brokerage. For example, based on the cointegration of EWA and EZA you would think that trading AUDZAR would be quite profitable. And you would be right,

*theoretically*, except that AUDZAR is not available for trading on Interactive Brokers. If you know of a good Forex brokerage that have many emerging markets cross-rates for trading, especially those of Latin American countries, please let the rest of us know!

## 33 comments:

Check out Oanda... I'm not a client and don't know if AUD/ZAR is directly tradable or if it would be a double transaction using AUD/USD & ZAR/USD but from a cursory search they seem to have the most historical data on obscure currencies. For example, I was able to lookup what the exchange rate is for Afghan-to-Moroccan currencies. Also, if you open a $1000 account you can request historical tick data back to 2004, and if you're an academic you can claim an exemption to the $1000 deposit.

( This might sound like an ad of sorts but I'm just in the process of comparing brokers for myself )

www.oanda.com

Joshua,

Unfortunately, if we need to affect a double transaction, then this vitiates the main advantage of trading cross rates I described in the post: trading 2 instruments involve at least one market order. It also doubles the transaction costs. What I was looking for is a single instrument implementation of AUDZAR and other emerging market currencies pairs.

Ernie

Ernie,

I know... couldn't find info on what specific pairs they have for trading. Have you already checked them out?

Ernie,

Could you please elaborate on the issue of market vs limit? I get that trading the cross rate involves trading one instrument as opposed to two, but how is that related to market and limit orders? Thanks.

Look at GFT (global forex). I just checked and they have AUD/ZAR pair.

Anon,

If we are trading 1 instrument using a Bollinger band strategy, then we just need to place limit orders on the top and bottom bands. If we are pair-trading 2 instruments, then we can place limit orders on one instrument, but if that order is executed, we need to immediately hedge our exposure by sending MKT orders on the other side.

Ernie

JC,

Thanks much for your info. I checked with GFT and indeed they have lots of cross rates. http://www.gftforex.com/forex/currencies-to-trade.asp

Also, Peter from Alphacet.com told me the Currenex (owned by State Street bank) also offers many cross rates for institutional investors.

Ernie

The problem with exotic cross-rates is that they are not really natively traded even in the inter-bank dealing world (ie this is why they are called cross rates: because they are a cross between 2 majors / usually against USD).

The result is that the spread is usually nearly as large as for the 2 major trades. But it is indeed more efficient/practical to trade.

Although OANDA offers an API, in which case it would not make much difference

Jez,

You have a good point there. We will have to see how liquid they are in reality.

Ernie

Ernie I wanted to check some ZScore math logic I'm doing if I may.

If the trade we want is 100 ABC against 90 XYZ, I'm first calculating (100* Closing price of ABC) - (90* Closing price of XYZ) to get a spread, mySpread.

I then calculate the SMA of mySpread for period zPeriod, and the StdDev of mySpread for zPeriod.

My ZSCore is then (mySpread - the SMA calculated above), divided by StdDev calculated above... right?

I'm coding it in C# with some custom methods so I'm not sure how useful posting the raw code here would be.

The code works, but I have nothing to compare it to.

I note in your Matlab code on page 57 you are using a function called mean. I'm not a Matlab guy. Is that the arithmatic mean of your entire dataset? Is your spreadSTD also on the whole dataset? or is using rolling n periods (say, 28 period SMA and 28 period StdDev) a workable solution?

Many thanks for your thoughts and looking forward to Quantitaive Trading II :)

Hi Anon,

I believe your zscore logic is correct.

The mean on page 57 of my book is over the entire training set. You can substitute that with a SMA.

Ernie

Hi Ernest,

I was just curious how you calculated the zscore of your cointegrated pairs. Did you perform linear regression on the pair and used the resulting residuals i.e. zscore = residual - mean(residual)/stdev(residual). Or did you perform linear regression on the prices of the pair, find the beta, used the beta to find the spread i.e Spread = StockA - HedgeRatio*StockB. Then calculate the zscore of the spread.

Thanks

Hi Trevor,

I used the second method you suggested.

Ernie

Ernie,

On a different note, could you please explain how you tackle the problem of rolling over while using futures contract in pairs trading? eg how would one use eurodollar futures contracts in pairs trading for a significantly longer period of time as the front contracts keep expiring every 3 months.

Abhishek,

If you are pair trading futures contracts, you should rollover just as your normally would (e.g. at a a week before expiration.)

The main problem is how you adjust the prices when you backtest the strategy. This would require a lot more discussions.

Ernie

Ernie,

Great book, I got it as a gift. I invest as a hobby so I'm not as proficient as many of your readers. Although you are getting me there ;-) I calculated my first sharpe ratio and drawdown percentages and drawdown times using the example in excel you have in your book. Thanks for the book and blog. I am reading and trying to learn.

I have questions on pair trading after reading the book and blog. I am still not sure of a few things:

AS an example to discuss (assume a cointegrated pair):

ABC-XYZ

Z-score -2

shares ABC 100

shares XYZ 100

half-life 30 days.

To trade this, would you go long ABC and short XYZ for 100 shares each?

If the z-score was +2 would you still go long ABC and short XYZ for 100 shares each or do you have to do the OPPOSITE?

Thank you!

Could you please sum up the problem of rolling over of the futures contract in a couple of lines? :)

I am stuck while trying pair trading in futures contract, for I don't have enough ideas regarding how one would adjust the price of an expiring contract with the 2nd front month contract.

I had attended your workshop that you conducted for GHF group and while you were trying to find suitable futures contract for pair trading in oil futures, we had similar problems. May be you could throw some light on this adjusting the price for expiring contract issue. That would be great.

Thanks,

Abhishek

Abhishek,

There are 2 separate issues: 1) backtesting the futures pairs, and 2) live trading.

Regarding 1), you would backadjust the contracts to form continuous contracts, and use the price (not return) gaps on rollover days to perform the backadjustment.

Re: 2), you would just rollover both sides as usual before expiration, and use the backadjusted cotinuous contracts as in 1) to perform you calculations of MA, MSTD, hedgeRatio, etc.

Hope this helps,

Ernie

Anon,

Thanks for your kind words.

Yes, for Zscore=-2, long ABC and short XYZ for 100 shares each would be correct. Alternatively, you can long 100 shares of ABC, and short hedgeRatio shares of XYZ.

For Zscore=2, you would do the opposite.

Ernie

Dr. Chan, i am trying to fully understand the cointegration approach to find the "hedge ratio" for 2 assets. I am under the impression that this should be at least similar to running a regression of one asset against the other, so i was thinking the slope would be similar under both methods (method 1=cointegration using QR factorization ( like in your book) and method 2= using least squares (“regular” regression). Here is my MATLAB code to test this on a very simple example.

x=[10;11;13;11]

y=[18;20;28;22]

%cointegration method with QR factorization like Dr. Chan’s book

r11=norm(x,2)

q2=x./r11 % %%could also use:[q r] = qr(x,0) %matlab function

mybeta=r11\(q2'*y)

plot(x,mybeta*x,'r')

hold on

% now do least squares method

n=length(x)

vect=ones(n,1)

A=[vect,x]

Atraspose_times_b=A'*y

ab=[inv(A'*A)*(A'*y)]

alpha=ab(1,1)

beta=ab(2,1)

plot(x,alpha+beta*x)

The main point is the betas are quite different. Does your way somehow factor in the price difference of the two assets maybe? Where the simple regression approach leaves the investor to figure that out for himself? Can you tell us why the two methods can give such different betas? Could you also tell us what is a proper time frame of past data to use when finding the correct hedge ratio.

Thank you very much

Ernie, i agree with Jesse. Betas are different. Maybe we are making the exact same mistake but my hedge ratio when i use excel's ols is 1.19. When I chart the prices in excel it looks similar but don't know why they are different. I greatly appreciate your help.

Jesse, Marylander:

It is important to note that in my regression fit, I assumed the intercept is zero. The reason is that I believe fewer fitted parameters yield more a robust model, and I also don't believe that a non-zero intercept has any fundamental reason or significance.

The difference in the results you generated appear to stem from a non-zero intercept.

Best,

Ernie

Ernie,

Many thanks for the prompt repsonse. I bought your book and love it. It's a very very good intro to the quant trading world . Best,

Dr. Chan,

I was thinking you used the zero Y-intercept in your regression because you are operating under the assumption that the 2 securities are cointegrated. Therefore, if one security is worth zero the other security will be worth zero as well.

Also, Dr Chan you mentioned earlier that you test for cointegration and then run your regression separately to find the hedge ratio. Why is this? Do go a lot farther than just using your zero intercept regression in finding the proper hedge ratio?

Jesse,

Cointegration does not require zero intercept. I have explained the reason for using zero intercept in my reply to you and Marylander above.

I don't use the beta obtained through the cointegration fit as my hedge ratio because I often want use a much shorter lookback period for calculating hedge ratio, which won't be suitable for cointegration test.

Best,

Ernie

Ernie

Thanks Ernie!

Thanks Ernie!

Hi Ernie,

Neither the premium content button on the main blog page, nor the link in this post to epchan.com/subscriptions.html seem to work any longer. I am signed up, so am wondering how to get there.

Thanks

Hi Roger,

Try to go to http://www.epchan.com/subscription/spread.htm directly.

It may just be a temporary glitch at the web hosting site.

Ernie

Hi Ernie,

The direct link is failing for me as well. Also, the link to your consulting site is failing for me as well (epchan.com). I wanted to ask some questions about consulting and the upcoming pairs workshop. Chrome says it cannot connect, Firefox says the server at epchan.com is taking too long to respond, and Internet Explorer says my end is fine, and that epchan.com is taking too long to respond. I've tried this on three different machines.

Thanks

Hi Roger,

Sorry to hear about the connection problems. I have tried my site from 2 different machines and internet providers, and I haven't had problem reaching it. I haven't heard of complaints from other users yet. Sometimes it may be a regional internet problem.

You can email me directly at ernest AT epchan.com.

Thanks,

Ernie

Howdy are using Wordpress for your blog platform?

I'm new to the blog world but I'm trying to get started and

set up my own. Do you require any html coding knowledge to make your

own blog? Any help would be greatly appreciated!

Hi,

This blog is built on blogspot.com. No Wordpress or HTML knowledge required.

Ernie

Post a Comment