Pairs Trading Strategy

From SharpTrader Arbitrage Software Wiki: A Detailed Overview of High-Speed Trading Technology
Jump to navigation Jump to search
Introduction to Pairs Trading

Pairs trading is a market-neutral strategy that allows traders to profit from the relative performance of two historically correlated instruments, rather than relying on overall market direction. The core idea is simple: when the price relationship between two assets temporarily diverges from its historical norm, traders open offsetting positions expecting the prices to revert to their mean.

Originally developed by quantitative analysts at major Wall Street firms, pairs trading is now widely used across Forex, indices, commodities, and even cryptocurrencies. It is especially appealing in volatile or uncertain markets, where directional trades carry higher risk.

This strategy works best when:

  • The two instruments have a strong statistical correlation.
  • There is a temporary spread or price divergence.
  • There is a high likelihood of mean reversion.

In this guide, we will explore the fundamentals of pairs trading, how to select suitable instruments, and how to configure key parameters to maximize performance while minimizing risk. learn more...

Enabled – enables or disables trading on a selected instrument.

Symbol 1 – symbol name on side 1

Symbol 2 – symbol name on side 2.

Lot size 1 – lot size to be traded on side 1.

Lot size 2 – lot size to be traded on side 2.

Important: It is important to check the contract size for both the left and right instruments in the pair and adjust the lot sizes accordingly.

For example, if Instrument 1 (on the left) has a contract size of 100, and Instrument 2 (on the right) has a contract size of 1, then the lot size for Instrument 2 should be 100 times larger to properly balance the exposure. Additionally, you must verify the minimum allowed lot size for both instruments to ensure that your configured values are acceptable by the broker and the platform.

It is also required identify Quote currency, Commission per lot (for FIX API Broker) and Lot multiplier for Indices in the Sessions -> Indices tab.

S/L – hidden stoploss for an arbitrage trade, expressed in currency.

T/P – hidden takeprofit for an arbitrage trade, expressed in currency.

Min profit – starting point for trailing, expressed in currency.

Trail distance – distance arbitrage trade is trailed at.

Trailing step - Number of points by which stop loss is moved once trailing is activated.

Trail units – allows to switch trailing units between currency and percent's.

Order lifetime – maximum arbitrage deal duration (expressed in seconds)

Comment - Virtual comment added to each trade for identification

Z-index Open: Minimum Z-score deviation needed to open a trade.

Z-index Close: Z-score threshold at which the trade will be closed (if defined).

Timeframe -Candle period used for Z-index calculation (e.g., 15 Min). This timeframe determines how the correlation and Z-score are measured.

Min Slope - Minimum slope value to trigger a trade.

Slope Period - Number of bars used to calculate the slope.

Regression Coefficient - Minimum linear regression value required for entry.


Direction

ZIndexBased – we open orders if the value of the Current Zindex is greater than the value of the Zindex Open. If Current Zindex >= 0, we open sell order on left side and buy order on right side. If Current Zindex < 0, we open a buy order on the left side and a sell order on the right side.

PriceBased – we open orders if the value of the Current Zindex is greater than the value of the Zindex Open. If Current Ask price on left side is greater than Current Ask price on right side, we open sell order on left side and buy order on right side. Otherwise, we open a buy order on the left side and a sell order on the right side.

Buy1Sell2 - we open a buy order on the left side and a sell order on the right side, if the Current Zindex is greater than the value of Zindex Open and the Current Zindex < 0,

Sell1Buy2 - we open a sell order on the left side and a buy order on the right side if the value of the Current Zindex is greater than the value of the Zindex Open and the Current Zindex >= 0.

Reversed - we open orders if the value of Current Zindex is greater than the value of Zindex Open. If Current Zindex >= 0, we open buy order on left side and sell order on right side. If Current Zindex < 0, we open a sell order on the left side and a buy order on the right side.

Inversed - we open orders if the absolute value of the Current Zindex is lower than the value of the ZIndex Open. If Current Zindex >= 0, we open buy order on left side and sell order on right side. If Current Zindex < 0, we open a sell order on the left side and a buy order on the right side.

ZIndexSign – we open orders if the absolute value of the Current Zindex is greater than the absolute value of the Zindex Open, and both have the same sign. If Current Zindex >= 0, we open sell order on left side and buy order on right side. If Current Zindex < 0, we open buy order on left side and sell order on right side.

ZIndexSignInv– we open orders if the absolute value of the Current Zindex is greater than the absolute value of the Zindex Open, and both have the same sign. If Current Zindex >= 0, we open buy order on left side and sell order on right side. If Current Zindex < 0, we open a sell order on the left side and a buy order on the right side.


Max Spread Slow 1 – maximum allowed spread on side 1. If actual spread is higher than Max spread slow value, arbitrage signals are ignored.

Max Spread Slow 2 – maximum allowed spread side 2. If actual spread is higher than Max spread fast value, arbitrage signals are ignored.

Time correction (based on VPS's time)

  • Manual: You set time manually. In this case you need to set Time to start trade and Time to stop trade - Defines the daily time window during which trades are allowed for the pair.
  • Automatic: System calculates time offset automatically.

Min correlation - Minimum correlation between the two assets required for trading to be allowed.

Real-time statistical data from the system:

  • Curr Z-index: Current calculated Z-score.
  • Closing Z-index: Z-score at which the last trade was closed.
  • Min/Max Z-index: Historical min/max Z-score for analysis.
  • Curr Spread Slow 1 – current spread for instrument 1
  • Curr Spread Slow 2 – current spread for instrument 2
  • Profit - Displays the current net profit for that instrument pair.

🧮 Correlation Matrix

  • The main grid shows the Pearson correlation coefficients between symbol pairs.
  • Green cells indicate strong positive correlations (close to +1.00), where two instruments tend to move together.
  • Red cells indicate strong negative correlations (close to -1.00), where two instruments tend to move in opposite directions.
  • Darker colors represent stronger correlations; lighter or black cells represent weak or no correlation.

For example:

  • AUDUSD vs NZDUSD: 0.48 – moderately positive correlation.
  • AUDUSD vs USDCAD: -0.94 – very strong negative correlation.
  • BTCUSD vs ETHUSD: 0.88 – strong positive correlation.

🔘 Show Filter

  • You can filter pairs to show only those meeting specific criteria (e.g., All, Strong Correlations, etc.)

➕ Symbols List (Left Panel)

  • A list of available instruments that can be included or excluded from the analysis.
  • You can add new symbols using the input field and the "Add" button.

🔁 Recalculate Button

  • After adjusting parameters like timeframe or symbol list, press Recalculate to refresh the table.

This module is crucial for identifying pairs suitable for correlation-based trading, statistical arbitrage, or mean-reversion strategies.


Related YouTube videos:

https://youtu.be/Ncrbn4T4Mpk

https://youtu.be/kBjDGaGHrV8

https://youtu.be/q0NcSoqerkw