PROTECTED SOURCE SCRIPT

Z-Score Pairs Trading

Zaktualizowano
Title: Z-Score Pairs Trading Indicator

Description:
This indicator implements a Z-score based pairs trading strategy, allowing traders to identify potential statistical arbitrage opportunities between two selected assets.

Key Features:
- Calculates Z-score for the price difference between any two user-selected symbols
- Visualizes Z-score with customizable thresholds for signals
- Generates long and short signals based on extreme Z-score values
- Adaptable to various markets including stocks, ETFs, and commodities

How It Works:
1. The indicator calculates the price difference between two selected symbols.
2. It then computes the Z-score of this difference, showing how far the current spread deviates from its historical average.
3. When the Z-score exceeds set thresholds (default ±2), the indicator generates trading signals.

Settings:
- Symbol A and Symbol B: Select any two tradable symbols to compare
- Lookback Period: Number of periods for calculating the moving average and standard deviation

Interpretation:
- Z-score above 2: Potential short signal (pair is likely overextended)
- Z-score below -2: Potential long signal (pair is likely oversold)
- Z-score between -2 and 2: Normal trading range, no signals

Visual Aids:
- Blue line: Z-score
- Dashed lines: Threshold levels at 0, ±1, and ±2
- Green triangles: Long signals
- Red triangles: Short signals

Disclaimer:
This indicator is for educational and research purposes only. Trading carries a high level of risk. Always conduct your own analysis and manage your risk appropriately before entering any trade.
Made by @marekfleisi
Informacje o Wersji
Dual Z-Score Pairs Trading Indicator

A statistical arbitrage strategy using dual timeframe Z-scores to identify trading opportunities between highly correlated pairs, optimized for crypto markets like BTC/USDT vs ETH/USDT.

Key Features:
• Dual Z-score calculation (1900/500 periods)
• Real-time correlation monitoring
• Clear visual trading signals
• Statistical arbitrage approach
• Perfect for crypto pairs

How It Works:
1. Long-term Z-score (1900 periods): Captures major trends
2. Short-term Z-score (500 periods): Captures immediate opportunities

Trading Signals:
When both Z-scores below -2:
• LONG first pair (e.g., BTC/USDT)
• SHORT second pair (e.g., ETH/USDT)

When both Z-scores above +2:
• SHORT first pair (e.g., BTC/USDT)
• LONG second pair (e.g., ETH/USDT)

Position Scaling:
• Initial entry: Z-score ±2 (30% size)
• First scale: Z-score ±3 (30% more)
• Second scale: Z-score ±4 (40% more)
Higher Z-scores indicate stronger mean reversion probability.

Visual Guide:
• Blue line: Long-term Z-score
• Orange line: Short-term Z-score
• Red/Green lines: ±2 thresholds
• Gray fill: Z-score difference
• Green/Red triangles: Entry signals

Trading Rules:
1. Wait for ±2 threshold cross
2. Check correlation (>0.8)
3. Enter both positions
4. Exit at Z-score zero cross
5. Stop if correlation drops

Requirements:
• Correlation above 0.8
• Good market liquidity
• Stable market conditions

Risk Management:
• Trade both pairs always
• Use 1-2x leverage max
• Equal position sizing
• Exit at zero cross
• Stop at correlation break

Setup Example:
Symbol A: BTC/USDT
Symbol B: ETH/USDT
Long Period: 1900
Short Period: 500
Threshold: ±2.0

Quick Start:
1. Find correlated pair
2. Wait for ±2 threshold
3. Enter 30% position
4. Scale at ±3 and ±4
5. Exit at zero cross

Disclaimer:
Educational purposes only. Trading carries significant risks.

Made by @marekfleisi

#arbitrage #correlation #pairstrading #zscore #crypto #bitcoin #ethereum #trading #quant #meanreversion
algotradingarbitragecorrelationpairstradingPortfolio managementproptradingquantitativetradingRelative Strength Index (RSI)spreadtradingstatisticalarbitrage

Skrypt chroniony

Ten skrypt został opublikowany z zamkniętym kodem źródłowym i możesz z niego dowolnie korzystać. Możesz go dodać do ulubionych, żeby używać go na wykresie. Nie możesz przeglądać ani modyfikować jego kodu źródłowego.

Chcesz użyć tego skryptu na wykresie?


Również na:

Wyłączenie odpowiedzialności