PairTradingLong

Description

The Pair Trading Long strategy is part of Domenico D'Errico's pair trading system. By design, this strategy is to be used along with Pair Trading Short. The two strategies provide entry and exit points for both the long and short securities traded in the pair. This requires that the second strategy be applied to the secondary symbol on a separate chart: consider either opening a detached chart window or using the chart grid.

The Pair Trading Long strategy adds long entry and exit simulated orders to the primary symbol chart based on the price ratio of that symbol to the secondary; the ratio is analyzed in reference to its fast and slow simple moving averages. Based on the selected trending mode of the price ratio, the simulated orders will be added once specific moving average breakout conditions are met. Consider adding the Price Ratio study to a lower subgraph in order to determine the suitable trending mode.

  • Trend following mode. In the trend following mode, the price ratio shows a clear trend: either bullish or bearish. Selecting this mode will have the strategy add a buy to open simulated order when the fast moving average crosses above the slow one. A sell to close simulated order will be added once the fast average crosses below the slow one.
  • Mean reversion mode. In the mean reversion mode, the price ratio shows continuation of a preceding trend after a retracement of about 50%. Selecting this mode will have the strategy add a buy to open simulated order when the price ratio crosses below its fast moving average. Conversely, a sell to close simulated order will be added when it crosses above.
  • Trend-and-pullback mode. In the trend-and-pullback mode, the price ratio shows numerous pullbacks in the main trend. Selecting this mode will have the strategy add a buy to open simulated order when the price ratio crosses below the fast moving average while being above the slow one. A sell to close simulated order will be added once the price ratio crosses above the fast average while being below the slow one.

Input Parameters

second symbol Defines the secondary symbol for the price ratio. This is also the symbol to apply the Pair Trading Short strategy to.
fast length Defines the length of the fast simple moving average.
slow length Defines the length of the slow simple moving average.
mode Select a suitable trending mode of the price ratio.

Further Reading

 1. "Pair Trading With A Twist" by Domenico D'Errico. Technical Analysis of Stocks & Commodities, December 2016.