Statistical Arb/Pairs trading strategy!

Two more trades today on EU/GU and EJ/GJ finished with profit today.

I think I’m finished today because spreads (commissions) are starting to get bigger

Well done. I’m interested in what trades you were taking today (what times and what were your entry/exit indications)?

I notice that they are both E/G trades. Given the correlation between the EU and EJ, you could have just taken one trade but doubled your lot size. Both trades would have moved the same way, but the trade costs would have been cheaper. That is, trading the EU/GU and EJ/GJ, themselves being highly correlated, you effectively have two trades on the EG…

Anyway, well done, nice way to end the week. Have a good weekend…

Later i Will post pictures. I think the commission wad the same. 5 pip spread for each, if i had doubled the size that would end with same number of pips in spread.

There are some times when they are correlated like this one, but sometimes they are not. I trade both because that times.

I think Jedster is correct that you’re on the right track with your calculations. It is interesting to note how much the betas have changed over the past week+ on these pairs. The question is whether the longer term beta relationship reasserts itself, or if the shorter term variation is the start of a new trend in the betas.

I’ve seen these numbers drift over time so recalculating from time to time is probably wise, though doing so with enough data to ensure that local disturbances aren’t extrapolated as trends. If your strategy gets you flat each week then weekly / monthly recalculation could be done without needing to alter position sizes. But the lookback period should be a multiple of the optimization period (if weekly then 2+ weeks) to prevent optimizing on values that may become quickly obsolete when reversion occurs. If the holding period is longer, then less frequent recalculation of the betas over a longer lookback period is wiser to keep position readjustment costs down. It sounds like you’re doing a great job!

Ok, this is the picture of the way I trade the statarb technique.

I made some indicators and I’m testing an EA that helps rebalancing and other things. Still too soon to know if it works on the long term, but I’m testing it with about 6 pairs of pairs and found a lot of bugs that are now fixed.

What I do basically is to draw the “mean”, that is the SMA. I use the 120 period on 5m, but I found all pairs have different best setting that also varies on time. I then draw the first and second standard deviation, aka bollinger bands of also 120 period.

I also use the third pair, EURGBP as an indicator, not to trade it. What I do is I measure the divergence from the mean of both pairs, then I calculate the difference between the two divergences, let say that EU is about 20 pips from the mean, and GU is about 42 pips from the mean, that leaves me with a 42-20=22 pip divergence that should be filled when both of the return to the mean.

I confirm this when at least one of them is exceeding it’s standard deviation, and also when the EURGBP is exceeding the standard deviation. So I have at least 20 pip divergence (like Kelton suggested, and that also worked very good on 5m), a confirmation from the pair’s standard deviations, and another confirmation from the EURGBP standard deviation. Then I place the trade calculating the beta

[I]betaGU=cov(GU,EU)/var(EU)[/I]
[I]betaEU=cov(EU,EU)/var(EU)
[/I]
and sizing the positions based on 1-betaGU for GU, and 1-betaEU for EU. You can see there that I’m using 0.02 minilots for EU and 0.01 minilots for GU as an initial entry.

The last trade last only 20 minutes and won about 20 pips. That trade was made with the last version of my EA. It entered with a 20 pip divergence (when the arrows are drawn then it is 20 pip divergence).

In this trade EU was on the 20 pip level from it’s mean (first yellow line is SMA+20 pips), and above it’s first standard deviation, and when the trade started, GU was below it’s mean (red line). Then GU suddenly started coming up, while EU continue almost stalled on the first standard deviation. That move on GU reduced the divergence, and when they got very near, about 1 pip divergence between both, my EA finished the trade closing all the open trades on EU/GU.

On the bottom chart, there is EURGBP with the same standard deviations and sma+/-20 and 50 pips. You can see that when the trade entered, the EURGBP was above its first standard deviation, and when the trade closed it was almost crossing it’s mean. Because that, I can use it as an indicator, to confirm my trades, and it is giving wonderful results!

I started my real account on last Friday, on Wednesday I added enough equity to reach 200 USD, because I needed that to be able to balance the trades, now, it is 203.31, that is about 1.5 % on two days.

You can see that I closed the trades when the pair spread was also HUGE! 19.6 pips for the pair spread, that is what caused me problems on another trade on AUDCHF/NZDCHF, that I fixed rebalancing the trade.

And I’m starting thinking that trading EURGBP is not the same that trading EURUSD/GBPUSD. In essence, with same lot size, it could be the same, but tell me something, let suppose that both EU and GU are in a downtrend, but EU is moving at half of the speed than GU, remember, both in down trend.

So the move on E/G is in uptrend, because GBP is reducing it’s value faster than EUR. If you are trading on EG, and you are long, great! but think about this, at some moment, EUR started moving faster than GBP, so now EG is in a downtrend, and you are long. You can wait but if the EU/GU continue moving downtrend with EU moving faster than GU, you will surely hit your stop loss on EG, and that’s the end of story if trading EG. BUT if you are trading EU/GU, you can rebalance your trade adding to GU or reducing EU making it “beta neutral”, so the pair can continue going down and down, and you can sustain your positions without a problem for long time. When something happens, like a brief reversal or a correlation error, you can take some profits, and you will end the story with profits, compared with EG that finished with a loss.

What do you think about this?

So the move on E/G is in uptrend, because GBP is reducing it’s value faster than EUR. If you are trading on EG, and you are long, great! but think about this, at some moment, EUR started moving faster than GBP, so now EG is in a downtrend, and you are long. You can wait but if the EU/GU continue moving downtrend with EU moving faster than GU, you will surely hit your stop loss on EG, and that’s the end of story if trading EG. BUT if you are trading EU/GU, you can rebalance your trade adding to GU or reducing EU making it “beta neutral”, so the pair can continue going down and down, and you can sustain your positions without a problem for long time. When something happens, like a brief reversal or a correlation error, you can take some profits, and you will end the story with profits, compared with EG that finished with a loss.

That’s a really great insight into how altering the position sizing (rebalancing) can be beneficial to riding out large drawdowns and coming out on top in the end. Very interesting approach!

Yep, that’s a great post, very well describes the approach you are taking, thanks for putting in the effort to describe your technique.

I’m not sure I necessarily agree with some of it, but of course that is just my own view :slight_smile: Equally, I don’t want to come across like I’m picking holes, so rather than post something saying what I agree and disagree with, instead I’ll assemble a post describing the approach I use, my assumptions, my entries and exits and my reasons for ignoring this or that… or for not ignoring this and that, etc… I also have some unresolved issues so I’ll post them aswell.

Medisoft! Incredible! Congrats on your success…now I have some questions for you and others…

  1. Is the system you use to show the status of correlation of whatever pairs your using something you could share when you have it refined enough?..is your EA you just mentioned totally automated…placing trades, SL, TP, determining entry points with correct lot sizing according to you beta calculations? In other words, you could leave it going for a week and come back to check profits? (in theory, not practice) if so, I would love a copy!..(everybody else here would, too!)

  2. Would you be willing on your next trade to also simultaneously demo trade on another platform, identical trades, except on one use beta for lot sizing and on the demo just enter with same lot size for each pair…this way it will give a great picture of the difference between using beta and just putting in same lot size for each pair as far as the bottom line-profit! VERY CURIOUS!!!
    I want to see if the difference is significant…thanks in advance!

  3. Is the EU/GU the better pair, or does the AJ/AC still have the lower risk/higher profit potential that you said you found several posts ago?

Ok, now for TIMEHOPPER!, congrats also…thanks for spelling out the simplicity of this system, if I had all day to sit there with superimposed charts, I could do this easily-it’s all visual…now for my question for you if you don’t mind…

Just for my reference to try to calculate what I would be willing to risk, how much, exactly, as a percentage, of profit have you netted in the last 30 days?

What I am trying to figure out is if I could just have two 20 pips trades every 24 hours…10x20 pip trades a week, is 1% profit a day considered conservative with this system? Do you think it’s a stretch to profit 3% a day on these two trades with how wide divergence could go, say on the EU/GU, by increasing the lots that much? Medisoft had a total of 0.03 lots in the market with his $ 200 account…at 1:200 leverage, that is about $15USD, right? With that trade open, let’s say the broker has avail margin as about $175, just for the math, so for the account to blow the $175, the spread would have to widen by 583 more pips??? is that realistic/something that has happened/normal?..ok, so for 3%, putting $45 in, let’s say avail margin of $150…let’s actually round it up to 0.1 lot…1 pip equals 1 dollar P/L, then account would blow at 150 pip increase in spread above entry point, is this likely???

you guys have probably seen this before, usually on one of those $0.01 to $1 trillion in 1 week silly threads, but $500 compounded at 3% a day takes 249 days to hit you-know-what…$$$…but 1 percent hits that $$$ in 700 and something days, so 1% a day, would still be a dream come true!!!

Thanks for reading my rambling, this has me hooked, hard! Medisoft knows the other pattern trading strategies, we have both tried…would you say this, for you medisoft, even beats that? It’s hard to beat 1% consistent, everyday profits…I just wonder about 3%???

One last thing, medisoft, on your rebalancing the beta thing to beat a loss, are you saying it could change how the increase of the spread affects amount of loss?..would the broker spread on opening new positions be something to consider? Thanks again!

What if a correlating pair offers more, smaller trading opportunities by just say, opening a trade when they are20 pips apart, and closing when 5 pips apart, instead of touching? What I mean is what if a pair bounces up to a certain distance from the mean, then back away, could that area, found with research, offer more closing opportunities per day, than waiting longer for total “correlation”? Or would such a point be too inconsistent?

So, I wanted to summarise how I trade this strategy. It will be a fairly long post, so apologies in advance for that.

I see this in principle as a very simple strategy but I appear to look at it in a different way from others. EU and GU are highly correlated over a long period of time. On a long term chart (weekly/monthly), the correlation is around 0.85. To trade this intraday I look at the the hourly chart and the correlation is the same, or higher, currently around 0.9. This does of course vary, but generally it is always pretty high.

However for inbetween timeframes, the correlation is different. So, the daily is only 0.4 and the 5 min is 0.6. This tells me that during the day the pair are fairly correlated (1H chart), however you do get minute by minute changes in this high correlation (5m chart), and some days actually end up being different (daily chart) but ultimately we know they will reconverge and resume the same path (weekly chart).

So how do I trade this?
I look at the triangle of currencies: EU/GU/EG. Firstly, I believe that long EU short GU positions are IDENTICAL to simply having a long EG position. I have posted previously at length explaining why (posts http://forums.babypips.com/free-forex-trading-systems/43659-statistical-arb-pairs-trading-strategy-22.html#post338604 and http://forums.babypips.com/free-forex-trading-systems/43659-statistical-arb-pairs-trading-strategy-22.html#post338634 for example).

Some people feel that they are hedged by opening two positions, or that the markets move differently and by holding two positions they have different exposure. If that is what they believe, then that is fine. There is nothing wrong with opening two positions, they will just not be taking advantage of the cheaper transaction cost that is available. Forex provides the unique situation that does not exist with other instruments. Trading correlation on stocks, indices, commodities, you have to take two positions, there is no choice. All I am saying is that with Forex being unique, mathematically, it is exactly the same as taking a single position in the EG. Unless someone can give me a mathematical example showing where it is not the same, I will continue to hold that view.

So there are two ways I try to look at this. The first is where both pairs move the same way, but one moves more than the other. This is a small time frame change that I see on the 5M chart. I expect the trade to be complete within around 5-30 bars (a couple of hours) and the target is about 10 pips.

The second is a complete change in the pair, where one goes up and the other goes down. These tend to happen when news is announced or something affects the market. However, importantly, whatever the cause, it has to affect both the EUR and the GBP. I want to see both currencies react to the news/market/whatever, but they react in a different way, the result being that one moves up and the other moves down. If the news/market/cause only affects one of the pair, then I don’t trade it. This is because news affecting just one currency could be the cause of a genuine (long term) divergence (or re-evaluation of the value of that currency against the other). I want to make sure that I don’t get caught up in that divergence. The move last Wednesday is a perfect example, where the GBP strengthened due to economic reasons.

So these are the occurances I would be looking for, however, I tend to only trade the latter. The first has too
small a target for my liking. I don’t like to see a trade target only 8-10 pips, but potentially widen to 30 or 40 (or much more in some cases) against me. It might be that if they were traded with very small position sizes, I could simply leave them open and they would eventually come back to my target. I don’t like to do that, it uses up margin that I cannot use for other trades, all for just 8-10 pips. Plus, there is the financing cost if the trade is open for a few days it could start eating up my potential profits. So, I stick to the second of the trade types.

What are my entry conditions. I use two charts, my first looks like this image. I did use this image in a previous post (http://forums.babypips.com/free-forex-trading-systems/43659-statistical-arb-pairs-trading-strategy-30.html#post340746), but I like this image as it also highlights a good trade:

(direct link http://i.imgur.com/7MIlW.png).

It is an EU chart, with the GU overlaid. The overlaid currency (GU) has been re-scaled to the EU chart, so its movements are relative to the EU. I can then see by how much (in pips) they have diverged in relative terms. I also have the ratio between them at the bottom of the chart and can see how many standard deviations that ratio is moving.

As described in that linked post, this ratio and the standard deviations is basically just like having bollinger bands on the EG chart, so I have exactly that as a second chart. I am still playing with the look of that chart, but at the moment it looks like this:

(direct link http://i.imgur.com/2t5wM.png)

(note, these images are not the same period of time).
I enter when the EG hits one of the the standard deviation bands. Which one? Well that depends as to whether it has broken up or down and whether it is in a trend. Historically, in an up trend, price rarely breaks below the -2SD line. very rarely! In fact, most of the time it only goes to -1SD and historically it rarely goes past the -2SD point. Therefore, I enter one position when it hits the -1SD line. If it diverges further, and goes all the way to the -2SD line, I enter a second position.

If the break is to the upside, then the conditions are not the same. The ratio regularly goes to 3 or 4 SD, even more sometimes. If it moves to say 4 or 5 SD, that is a pretty big move whichcould take a long time to revert. By the time it does revert back to the mean, the mean has risen, so the position would still be at a loss. This is the side of the trade that I haven’t quite got comfortable with yet. At the moment I’ll enter at the 3 or 4 SD boundary, but this is why I have said it will take months until I am happy as I am not yet sure about this entry. It happens more frequently, but I need to analyse more historical data to determine where the less risky situation is.

There is also the situation where there is no trend, and the breaks can be equally as high or as low. Again, I need to look into this further to determine statistically what the edge would be, but at the moment I enter around the 2 or 3SD boundary.

Note that this was citing an uptrend, obviously the reverse is the case for a down trend.

What do I use for my stop? This is not precise for me. I approximate where the price might hit the -3SD and set my stop, for both positions, just beyond that point. Risk is about 0.5% for the first trade. Second trade uses the same lot size, but given that the stop is much closer, the risk is less, but the potential profit is much greater. However the stop is in an approximate location as it is difficult to judge where that point would be. That is, if the price moves quickly or slowly, the point would be in different places.

As for position size, since I am entering off the EG I only have one position to enter. However previously when I was trading the EU/GU with two separate positions I was opening the same size for each position. The reason being, this strategy originated from stocks. The rule there is that you trade the same currency value for the stocks. So if stock A was twice the price of stock B, you trade half as many of stock A than stock B, so each position has an equal currency value. Translating this to forex, we simply have lot sizes (that are of equal value), so each position should be equal size. Were I trading two instruments that had different lot sizes, then yes, they would have different position sizes.

We have also had some discussion around the use of Beta. Beta is another measure of volatility. However, Beta is a long term measure of vol, not a short term one. Beta is calculated over months if not years of data, so trying to guage the changes of beta over a few minutes or a few hours isn’t what it is intended for and in fact, it could be these small changes of beta (or vol in general) that caused the divergence in the first place.

These currencies that are highly correlated have very similar vol. This is not totally unsurprising, given that they are highly correlated. If I look at the EU and GU charts using an ATR indicator, I can look at the values and they are virtually identical on every time frame, up until the 4H/daily. At that point, we start to get some small differences between them, but even at that timescale, a difference of 0.0005 is so relatively insignificant (over days) that trying to account for it in the trade just over complicates matters. Certainly on the 5M chart there is no difference (a difference 0.0001 or 0.0002 in my book is insignificant)

Further, if I were to have different position sizes, and I have a long and short position, it means that if both positions start moving in the same direction (because obviously they are highly correlated), then the value of each position will not change equally. One position will gain (or lose) more than the other. But that is not what we want, in a trending situation, we want both positions to gain or lose equally.

By trading just the EG, all these questions or issues of whether beta should be used or not, whether vol is a factor or not, etc, they are all taken away from me. I simply have one trade to place, I calculate (approximately where my stop will be) work out what my position size will, et voila…

So that’s what I do. The trades tend to be about 40-50 pips, they come along up to 3 times a week, but generally once or twice. I consider it significantly lower risk than trading on the 5M, although in fairness, I didn’t do it for too long, so it might be I didn’t try it for long enough. I do plan to look into this further, but I want to apply my trending logic to the 5M chart. That is, when the 5M chart is trending UP, I will only go long when the price/ratio touches the -1SD band, enter again if it touches the -2Sd and exit just beyound -3SD. I think I might be happier with that, there are likely to be more opportunites and not so much risk.

It’s also fair to say that I haven’t been trading a huge amount for the last couple of weeks. I am still looking after the kids (who are still on holiday and not back at school after the easter break!), so I can’t really get back onto this full time until next week. However, from then I’ll start re-investigating the 5M and post some trade setups as and when they happen.

[QUOTE=medisoft;337263]
For lot size, I use a percent of my account. If I want to win 2 % of my account on a spread of 20 pips, I calculate the lot size to win that percent if it moves 20 pips, on both pairs. If I had 1000 USD, and want to win 2 % of the account on a move of 20 pips (20 USD), then I size my trade so each pip is 1 dollar. That is about 0.1 full lots on EU and GU. So, if the spread between EU/GU is 20 pips, I place a trade like Kelton says, and when they touches again, I will win 20 pips, maybe 10 on EU and 10 on GU, maybe another combination.

QUOTE]

-MEDISOFT!..does this mean opening 0.05 of each pair for total combined trades of 0.1? if so, than with 1:200 that’s $50, leaving $950, 950 pips to play with, or allow a lot of drawdown before coming back to profit…my idea is do this twice a day for 4% a day, than…do you, or anyone else think this would work?

Today I just realized that. I was looking a trade that had 0.45 USD (well, I’m trading on 200 USD, so that was about 0.25 % of the account) and see that it was about 2.5 pips divergence, then it started increasing the divergence.

The trade finished hours later for a profit of about 0.50 USD, but it could be finished before if I had closed it when they was 2.5 pips, so I’m adding that to my strategy. I think 5 pips is too much, but 2.5-3 pips is great. Also on the backtests this way changes a lot the number of daily trades, from 1.01 daily trades on average, to 2.7! that is a lot more trades and a lot more pips hehehehe.

That sounds good, but I think I have a doubt: when does a pair is on uptrend, downtrend or sideways?

I think is the question everybody asks on directional trading, how to have an objective way to say that something is in a trend or not. If one knows certainly that something is in a trend, then maybe it is better to trade a directional strategy.

Do you have the stats of your trading in something like myfxbook? I think it will be illustrative to see the results of both strategies, trading with EU/GU and trading with EG :slight_smile:

Well so readers don’t have to search to find my previous posting… I was in the eur/usd and gbp/usd trade BEFORE the big move in the gbp last week (I made a post about it a few pages ago). After that huge move the plan was to wait until the gbp pulled back below the 1.6000 mark. Instead it moved up to the 1.6100 mark as of a little bit ago. Meanwhile my position in the eur spiked up over 50 pips but is really now unchanged at +/- about 10 pips from my first entry as of an hour or so ago. What does that mean for me… Glad you asked… It means that I have ADDED more to the position… the main reason is if I opened the position with a smaller deviation and the only thing that has really changed is now the gap is bigger, well that’s just an awesome opportunity. Since we want big gaps in order to work this system. So it’s still open and still not a major concern. I suspect that the eur is going to make major moves this week. As of this posting they are correlated again (over +80) so I’m not overly concerned about a major market move caused by the dollar and upsetting my apple cart.

On a side note the aud/us aud/cad position is now at +60 pips profit although I am confident I could squeeze more out of the trade I am quite happy… So i think i will close it. Even though I did not get a touch of the pairs on the charts. If i didn’t mention it it was taken on the 17th at 5pm.

STILL NO LOSING TRADES. Anyone else?

Cheers

ok, another question for medisoft (you’ll have to write a book to answer all my questions! LOL!) I use an Ipad, which can’t have EAs added to it directly, nor can I have superimposed MT4 windows, like a normal PC…Do you know much about VPS hosting, which I could remote in with? Can I have MT4 on that VPS and open the two windows, download the Vitrite, and use the system as Kelton started with so I can use my Ipad? or do VPS limit ability to load things like vitrite and manually trade, etc??

I think 4 % a day is pretty difficult with this strategy, you can take a lot of risk, but time will tell us. I’m slowly increasing risked amount on every winning trade, to see how much can be risked without increasing the drawdown of the account too much.

If you feel comfortable with 20 % drawdown, then you can do like you are saying, but for me that’s too much drawdown.

[quote=“pipcompounder,post:434,topic:42993”]

Congratz! I’m with you, still no losing trades. I traded the big move you said, and also closed it for profits last week :slight_smile:

I’m thinking about trading AUDUSD/AUDCAD but it is a little more difficult for me (my brain needs more caffeine hehehehe) to understand the “inverse” trades, when the common currency is not the base one, but the other.

Hi! I have a VPS on my own server. You can get a VPS on a LOT of places. I recommend you to look for Amazon Web Service (aws) for a windows 2003 VPS, it is cheap, secure enough and you are sure they are not interested on what you are running on them.

Also there are some brokers that offer that, like Liteforex (if you want to open an account with them, tell me first by PM!)

My own VPS has 1 core and 512 RAM with 10 GB hard drive, and I have 8 MT4 opened, two with real accounts and 6 with demo accounts testing the strategy with different parameters.

For vitrite I use my personal computer, because internet connections in Mexico are not pretty good hehehehe

If you see my screen shot, you can use any device that can draw bollinger bands and SMAs, it is easier if you can have two or three pairs opened at the same time like my screen shot, but it could be done with only one :slight_smile:

AAAAAHH my brain is on fire…oh, man! this thread is like fertilizer for my brain! I can’t stop coming up with stuff…

anyway, so can any and everybody tell me if they have had more than a 200 pips of drawdown against them with this strategy, ever? what I’m saying is I’m with you Timehopper, as far as no stoploss, because correlation should always eventually come back, at least enough for profit, so I’m thinking no stoploss at all, too, and if 200 pip is max DD ever known, then if I had $1000 account, I could trade just less than 0.4 lots at 1:200, $200 in, with $800 left which at 200 pip DD would hit $0, blown account…of course I wouldn’t risk this much, but maybe half?
0.2 lotsX20 pipsX2 trades a day=$80, which is 8% profit total, 4% each trade, each trade could have had 899 pips DD and then come back up to profit…am I getting somewhere?

hahahah! calm your self! Trading without stop loss is betting, not trading! hahahah

What I’m using is a dollar amount stop loss, not physical stop loss. And on my tests it is pretty rare to have a 200 pip drawdown, it could happen, but it is not frequent. The worst I have seen is about 50 pips.

You should also note there is a problem with this strategy: you need to be near you trade all the time, because you don’t know when it will become profitable. I think there are some EAs or scripts out there to close all open trades if the global floating profit is above $X or below -$Y, that could help with this strategy.