http://forum.mql4.com/c/forum/2011/0...UD_CAD_CHF.png

http://forum.mql4.com/c/forum/2011/0...UD_CAD_CHF.png

http://forum.mql4.com/c/forum/2011/0...UD_CAD_CHF.png

Sister Sites

Simple Mean Reversion 570 replies

Pairs Trading: Reversion to the Mean 19 replies

Question for synthetic and non-synthetic currency pairs 0 replies

Cointegration, Synthetic hedges, mean reversion in R, Tech Thread 0 replies

- | Joined Sep 2007 | Status: Member | 297 Posts

DislikedHi,

this is derived from a system using PCA and eigenvalues. Please consider the factor of -1 concerning the spread when comparing the graphs.

RegardsIgnored

is this software available in the public domain? what is the logic of choosing which pairs to keep? and do you have any idea about how well the results hold out of sample?

Thanks

- | Joined Sep 2007 | Status: Member | 297 Posts

DislikedYour condition: Sum(Coef^2) = 1. Example, 0.6335^2 + 0.6773^2 + 0.3740^2 = 1

Recycle2 (Method4) condition: Sum(|Coef|) = 1. It is better.Ignored

this is interesting observation. May I ask why is it better to use the abs sum value?

thanks

- | Joined Sep 2007 | Status: Member | 297 Posts

thanks for the encouraging responses. Please find some comments/answers below.

1. On coefficient normalization:

The link mentioned by getch is IMHO dealing with a different matter. There they talk about weighted geometric means with weights having a econometric meaning. Our coeffs are basically a linear combination of time series that are coint'ed. You can look at it as projection of several time series through a vector. In order to not scale the time series, the vector length should have a length of 1. This corresponds to Sum(Coef^2) = 1 (at least my opinion).

Furthermore the raw coeffs need to be normalized from PIPs to Lots. When you do this you probably have to assign how many Dollars/Euros should equal one synthetic PIP. At this point you typically have to decide on the size of your investment, which introduces a (personal) global factor to the weights. For example you could force each synthetic PIP to equal exactly 1 Dollar/Euro or whatever. When you do this you basically normalize DollarSum(|Coef|) = 1 Dollar. So this is what getch recommends.

2. On general questions

The system shown was completely developed and coded by myself in R. I will not go to publish any details neither the source code, since it took me months to do develop it. I can however assure that all the information needed can be found in this thread, especially in some papers and EAs referred to here.

The system has a scanner which I run offline to find baskets that are coint'ed at a 1%-significance level. The reason I put my result into this thread was merely to confirm that 7bit-system and the recycle2-system more or less get the same results, which I find interesting since they were developed completely independent AND are based on different computations.

I am trading this live. However I have to admit that the recent massive drop of the USDCAD has caused some 4-sigma-events, which brought some losses. Can anybody actively trading these instruments confirm this ?

The out of sample results are fairly good, the hedge ratios hold at least a few days, sometimes up to 2 weeks.

Regards

DislikedHello,

thanks for the encouraging responses. Please find some comments/answers below.

1. On coefficient normalization:

The link mentioned by getch is IMHO dealing with a different matter. There they talk about weighted geometric means with weights having a econometric meaning. Our coeffs are basically a linear combination of time series that are coint'ed. You can look at it as projection of several time series through a vector. In order to not scale the time series, the vector length should have a length of 1. This corresponds to Sum(Coef^2) =...Ignored

Have you backtest this approach ?

Condition

http://forum.mql4.com/c/forum/2011/0...e2_Method1.png

Condition

http://forum.mql4.com/c/forum/2011/0...e2_Method4.png

Comparison:

http://forum.mql4.com/c/forum/2011/0...vs_Method1.png

I propose to compare Recycle2 with your method. Source data (AUDUSD_EURUSD_GBPUSD_USDCHF_USDJPY_USDCAD_NZDUSD) are here.

P.S. Changing factors in the dynamics can be found here.

DislikedHello,

I am trading this live. However I have to admit that the recent massive drop of the USDCAD has caused some 4-sigma-events, which brought some losses. Can anybody actively trading these instruments confirm this ?

RegardsIgnored

Yes the USDCAD drop has me in draw down at the moment but it seems to have stalled for the last 2 days. We will have to see what happens with "Trichet" & EU rate decision tonight and "NFP" tomorrow. In any event my stops are pretty tight at the moment.

Did you code MT4 to interface with "R" for your system?

Regards CKP

getch, thank you for posting the recycle results. At the moment I only can handle up to 4 currencies in my code. I have to do some coding work in order to expand it. (Not a technical problem, just some changes to do.) Will see if I can do at the weekend.

Ckp, drawdowns are always bad so I have already left the trade two days ago taking the loss. But anyhow, good to see that these days not only cause problems with my trading, but others doing stat arb are also suffering (is not meant sarcastic or offending), just a matter of fact.

I have not integrated this into MT4, although it could be done using 7-bit's interface software. The reason for this is, that the alpari demo which I use for development has large gaps in their historic data, even if you carefully download every needed history data (BTW: Due to the large amounts of 1H-data this often is not really recognized, it also affect backtests!) ... This makes cointegration analysis useless, so I decided to stay completely in the R domain and only visualize the results in MT4 (s. attachment).

Because this is coded as an indicator there are no (large scale) backtest data. I will probably look a little more extensive into out of band behavior and maybe post some results when I have done it.

Regards

http://forum.mql4.com/c/forum/2011/03/Method1.png

Method4 (

http://forum.mql4.com/c/forum/2011/03/Method4.png

Notes:

7bit Method - using linear regression (good).

chrnbr Method - using PCA and eigenvalues (better).

Recycle2 Method1 - like chrnbr.

Recycle2 Method4 - best spread.

- Joined Mar 2009 | Status: Member | 1,231 Posts

This one looks interesting (the lines are 0.5 stddev, I just started running a grid strategy on it (buy on each level when it goes down, sell on each level when it goes up), wish me luck):

Attached Image

- Joined Mar 2009 | Status: Member | 1,231 Posts

DislikedWhat is your profit target for the positions, 0,5 std, 1 std, mean level ?

Is it really "sell when it goes up" or is it "sell when spread>0" ?Ignored

An alternative would be to never close a trade until it reaches zero but this way I could not profit from all the smaller moves and corrections.

- Joined Mar 2009 | Status: Member | 1,231 Posts

I have started trading it last week at level 2 and now its at level 4 so at the moment I am in drawdown. I made some quick&dirty visual backtests (after observing how stable the coefficients are even during longer periods) and this seems to be quite profitable.