Home > Algorithmic Trading, Forex, Forex Trader, Forex Trader + Metatrader, Metatrader, MQL, MQL4, MT4, MT4 Indicators, Trader > Pairs Trading MT4 Indicator – Market Formula = Forex Trader + Metatrader

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

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).

Pairs Trading MT4 Indicator - Market Formula = Forex Trader + Metatrader

Advertisements
  1. zhao
    May 17, 2012 at 10:03 pm

    How do we calculate the beta between 2 pairs?
    thanks for sharing the indicator

    • May 17, 2012 at 11:02 pm

      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.

  2. Anonymous
    May 19, 2012 at 10:09 am

    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

    • May 20, 2012 at 12:57 am

      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

  3. zhao
    May 21, 2012 at 3:45 am

    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

    • May 21, 2012 at 4:04 am

      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!

  4. zhao
    May 21, 2012 at 7:37 am

    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

  5. Dave
    November 6, 2013 at 8:36 am

    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

    • November 8, 2013 at 2:50 am

      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.

  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: