Pair Trading Lab Algorithms & Strategies

From Pair Trading Lab WIKI
Revision as of 14:05, 11 May 2013 by Admin (Talk | contribs)

Jump to: navigation, search

Pair Trading Lab offers pair trading algorithms based on various mathematical models. In additional, extra trading rules are available on top of that. All these models are supported in both online backtester and PTL Trader. All extra rules are supported in PTL Trader, only some of them in the online backtester. The backtester will be updated later to support all of them too.

Mathematical models are these:


Ratio Model

This is on of the standard pair trading models described in literature. It is based in ratio of instrument prices, moving average and standard deviation. In other words, it is based on Bollinger Bands indicator.

Model parameters:

  • entry threshold for Z-score, typical value range is <1.5, 2.5>, 2.0 is used most often
  • exit threshold for Z-score, typical value is <-0.5, 0.5>, 0 is used most often
  • max Z-score (optional, to filter out extremes, typical value is >4 if used)
  • moving average period (typical range <10, 100>), default = 15
  • moving average type (algorithm), default = exponential
  • standard deviation period (typical range <10, 100>), default = 15
  • entry mode (simple, uptick, downtick)

(todo: detailed description)

Residual Model

Residual mode is based on linear regression. Linear regression of both stocks is constructed in order to fit a linear relationship between both instruments and estimate its best parameters. Then, standard deviation is applied on the regression residuum to estimate its statistical properties and calculate Z-score.

Model parameters:

  • entry threshold for Z-score, typical value range is <1.2, 2.5>, 1.5 is used most often
  • exit threshold for Z-score, typical value is <-0.5, 0.5>, 0 is used most often
  • max Z-score (optional, to filter out extremes, typical value is >4 if used)
  • linear regression period (floating window is used), typical range <15, 100>, default = 15

(todo: detailed description)

Extra Rules

In addition to trading rules determined by mathematical models, some extra useful rules are also supported:

Max Days (Time Stop Loss)

  • Type: Additional Exit Rule
  • Support: PTL Backtester & PTL Trader

This is the most important additional rule. It is a very powerful risk control tool of pair trading. The rule says "close pair position after N days in any case". This rule strictly limits your market exposure by automatically closing your position after N days either in profit or loss.

Its purposes are:

  • get rid of pair positions in loss before the pair diverges too much
  • make space (free slots) for other pairs in the portfolio (we don't want pairs to occupy money management slots for too long)

Default value is 20 (so no pair position can last more than 20 days). Useful range is 10-50 days.

Important remark: This is the only automated risk control method used in PTL Trader. Please you should always use this rule, there are no many reasons to keep losing positions for longer than one month. One month is really enough time for pair to converge back, it usually makes no sense to wait much longer. Of course, if you have good reasons to believe your pairs converge after longer periods, no problem - but we usually don't see many pairs like that and these pairs then block slots for long time.

This rule is enabled by default.

Min Price

  • Type: Entry Signal Filter
  • Support: PTL Trader

This rule is a filter for entry signals. It won't allow opening positions if the absolute price of any leg will drop below a predefined threshold value. You may use this filter, if you trade stocks with lower price and don't want prices to drop to "penny stock range". For instance, we don't trade stocks cheaper than 4-6 USD.

Min Profit/Loss

  • Type: Exit Signal Filter
  • Support: PTL Trader

This is an additional filter for exit signals. It will prevent closing positions if current position absolute profit/loss is lower than predefined value. You may use this filter for instance to prevent closing positions in a loss and wait for the break-even situation (then, you set the threshold value to 0, which means do not close position if the P/L is negative).

For those who think about how it can be the mathematical model may close position in the loss - yes, true, you close position when Z-Score crosses your exit threshold point, but please note than the moving average, standard deviation and linear regression drift every day as model is recalculated. So if you hold a pair positions for many days, closing position at your predefined point may not give you profit. Therefore, this rule allows you to hope that your position will still eventually converge (at least to your predefined P/L mark), so effectively you are shifting the exit point below your original model exit threshold value.

Important Remark: This rule obviously does not apply to the Max Days rule.

Min Profit Potential

  • Type: Entry Signal Filter
  • Support: PTL Trader
Personal tools