OPEN-SOURCE SCRIPT

Pair Trading

74
PAIR TRADING
Description:
This indicator is a simple and intuitive tool for rotating between two assets based on their relative price ratio. By comparing the prices of Asset A and Asset B, it plots a “ratio line” (gray) with dynamic upper and lower boundaries (red and blue).

When the ratio reaches the red line, Asset A is expensive → rotate out of A and into B.
When the ratio touches the blue line, Asset A is cheap → rotate back into A.

The chart also shows:
🔹 Background highlights for visual cues
🔹 “Rotate to A” or “Rotate to B” markers for easy decisions
🔹 A live summary table with mean ratio, upper/lower boundaries, and current ratio

How to Use:
Select Asset A and Asset B in the settings.
Adjust the Lookback Period and Threshold if needed.
Watch the gray ratio line as it moves:

Above red line? → Consider rotating into B

Below blue line? → Consider rotating into A
Use the background color changes and rotation labels to spot clear rotation opportunities!

Why Pair Trading?
Pair trading is a powerful way to manage a portfolio because it neutralizes market direction risk and focuses on relative value.

By rotating between correlated assets, you can:
Smooth out returns
Avoid holding a weak asset too long
Capture reversion when assets diverge too far

This approach can enhance risk-adjusted returns and help keep your portfolio balanced and nimble!

How to Pick Pairs:
Choose assets with strong correlation or similar drivers.
Look for common trends (sector, macro).
Start with assets you know best (high-conviction ideas).
Make sure both have good liquidity for reliable trading!

TO HELP FIND CORRELATED ASSETS:
Use the Correlation Coefficient indicator in TradingView:
Click Indicators
Search for “Correlation Coefficient”
Add it to your chart
Input the symbol of the second asset (e.g., if you’re on MSTR, input TSLA).
This plots the rolling correlation coefficient — super helpful!

Pair trading can turn big swings into steady rotations and help you stay active even when the market is choppy. It’s a simple, practical approach to keep your portfolio balanced.

Penafian

Maklumat dan penerbitan adalah tidak dimaksudkan untuk menjadi, dan tidak membentuk, nasihat untuk kewangan, pelaburan, perdagangan dan jenis-jenis lain atau cadangan yang dibekalkan atau disahkan oleh TradingView. Baca dengan lebih lanjut di Terma Penggunaan.