# Pair Trading Lab Algorithms & Strategies

Pair Trading Lab offers pair trading algorithms based on various mathematical models. In additional, extra trading rules are available on top of that. Mathematical models are these:

## Contents |

## 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

### Min Profit/Loss

- Type: Exit Signal Filter
- Support: PTL Trader

### Min Profit Potential

- Type: Entry Signal Filter
- Support: PTL Trader