Pairs Trading MT4 Indicator – Market Formula = Forex Trader + Metatrader.

Simple pairs trading indicator for Metatrader 4 named Pairs with Beta for analyzing currency pair spreads. Allows custom multipliers (beta) to be used with the two pairs being analyzed, then plots the spread in a sub window.

For instance if EURUSD and GBPUSD are the two pairs being studied, and the beta for GBPUSD is 1.4, then the following formula would be plotted:

EURUSD * 1.0 – GBPUSD * 1.4 (shown below in dodger blue).

### Like this:

Like Loading...

*Related*

How do we calculate the beta between 2 pairs?

thanks for sharing the indicator

zhao, You’re welcome and thanks for your question! There are a number of ways to calculate Beta or the coefficients used to weight the pairs. The default method of course is equal weighting or simply trial and error. Better strategies exist, however.

Volatility could be used to adjust the weights. If symbol A is 1.3 times as volatile as symbol B (measure ATR over the past x days for the 2 symbols and compare volatility A/B) then trade 1.3x symbol B to 1x symbol A.

There is also the traditional method used in finance: http://en.wikipedia.org/wiki/Beta_(finance)

And finally, if you have access to a maths/statistics program like R, run a regression of the one symbol against the other (model <- lm(y~x)) and then call coef(model) to see the coefficients. I think this method is easier to implement than the finance Beta method.

In all the tests, the goal should be to increase the stationarity of the spread, and thus the consistency of a mean reversion strategy.

Hello Patrick,

many thanks, from your picture above, does that mean we need to have a zero line, when the plot is below the zero line, we buy EU and sell GU and vice versa?

– zhao

zhao,

From the blue line above, when it is heading down the first symbol is generally weaker than the second, so you’re correct it would be buy EU and sell GU.

Often mean reversion strategies are developed off from the spread and in the context of pairs trading. You might try searching for mean reversion strategies, but generally they involve a mean (average) and movement away from the mean a given # of standard deviations with the anticipation of reversion. There are lots of traders using Bollinger Bands so you might find some articles on that subject.

Although this thread is full of chit-chat, it might give you some background/ideas on how to implement a strategy.

http://www.elitetrader.com/vb/showthread.php?s=&threadid=148718&perpage=40&pagenumber=2

Hello Patrick,

I was reading your site and came across your ratroller EA on your site. is your ratroller trading the RAT Trades by TRO?

best regards.

– zhao

Hey Zhao,

I know who you’re talking about but wasn’t aware that he had a similarly titled strategy. RatRoller is a mutation of SnowRoller inspired by another trader on FF which attempts to pyramid into trending moves but has some directional logic built in. Alas, in both cases I must admit that while the concept is sound, the specific implementation didn’t prove consistent after several months of testing.

I leave the EAs up to display coding style and so others with a desire can have a base to build their own logic from. Ratroller works best when used as a trading aid in a discretionary method – picking the direction and allowing the EA to stack up positions in that direction. Of course if your direction picking is not so good, you might need a more automated approach like me.

Cheers!

Hello Patrick,

TRO’s rat reversals are very similiar.

Green Rat reversals:

1) price within 20 pips of current day’s low

2) Red candle formed and closed

3) Green candle form, note the high of the this green candle

4) if next candle is green and breaks high of the previous green candle go long.

and vice versa for Red Rat reversals

– zhao

Interesting, I guess rats really all do think alike! 😉

Thanks Zhao, that’s good to know!

Hi Patrick,

Thanks for your article.

Which method do you think is more precise to calculate Beta? I’m currently using the ATR method. The other question would be, who often needs to be calculated and updated? every new bar? Also, do you recommend a higher period(50) or a lower period(14) for the ATR indicator?

Thank you so much

Dave

Hi Dave,

I’m not sure if there is an ideal method for calculating beta in a general sense. The ATR method of beta calculation has the benefit of being fairly easy to understand and calculate. My preference is to use these methods as general heuristics rather than starting with the assumption that any of them will maximize profit of a given strategy (they don’t).

I think if there is a precise way to calculate beta, it would relate to a specific trading strategy that you are developing / using. For instance, given a mean reversion strategy where entry is at X standard deviations, (std deviation) length is y and the timeframe for calculation is z, then a given beta ratio A/B will tend to maximize the profit of the underlying trading strategy (at least in the backtest). Caveats regarding optimization / overfitting apply.

So in practice, I would simply start with the values given by a beta calculation method (such as ATR), then fine tune the values to the strategy I’m using. You could even average values from ATR 14 and 50 to split the difference.

As far as updates, this depends on how far back you test with your data. If you test over a few years with a strategy and a fixed given beta, then assuming the relationships stay intact, you probably wouldn’t need to update the beta calculation until about half the tested time out of sample.

Hi Patrick,

i Actually, i downloaded the Pair trading script and run it on my MT4 platform.Actually my question is : can i get the open high low close of the spread instead of getting it line.

Thanks in advance and best regards

Imad