PROTECTED SOURCE SCRIPT
BTC/SOL Spread Strategy

Spread Percentage Trading Strategy
A mean reversion strategy for highly correlated asset pairs (e.g., BTC/SOL) that trades based on price ratio divergence.
CORE CONCEPT
This strategy monitors the logarithmic spread between two correlated assets and generates trading signals when the spread deviates significantly from its historical mean. It only trades the second asset (S2) while using the first asset (S1) as a reference for spread calculation.
HOW IT WORKS
Spread Calculation:
- Computes log spread: log(S1) - log(S2)
- Calculates rolling Z-score of the spread
- Identifies overbought/oversold conditions
Entry Signals:
- Long S2: When spread Z-score crosses above entry threshold (S1 relatively overpriced)
- Short S2: When spread Z-score crosses below negative entry threshold (S2 relatively overpriced)
Exit Signals:
- Positions close when Z-score reverts to exit threshold levels
KEY PARAMETERS
- Window: Rolling period for mean and standard deviation calculation (default: 144)
- Entry Threshold: Z-score level to trigger new positions (default: 1.5)
- Exit Threshold: Z-score level to close positions (default: 0.3)
FEATURES
✓ Vectorized backtesting engine
✓ Built-in parameter optimization
✓ Comprehensive performance metrics
✓ Visual analysis tools
✓ Position sizing with leverage support
RISK WARNING
This strategy:
- Assumes mean-reverting behavior in price ratios
- Does not guarantee future performance
- Uses leverage which amplifies both gains and losses
- Does not include transaction costs in base implementation
- Requires monitoring of correlation breakdown
RECOMMENDED USE
Best suited for pairs with:
- High historical correlation (>0.8)
- Similar market dynamics
- Sufficient liquidity
- Stable volatility patterns
Always backtest with realistic transaction costs and implement proper risk management including stop-losses and position limits.
DISCLAIMER
For educational purposes only. Past performance does not guarantee future results. Trade at your
A mean reversion strategy for highly correlated asset pairs (e.g., BTC/SOL) that trades based on price ratio divergence.
CORE CONCEPT
This strategy monitors the logarithmic spread between two correlated assets and generates trading signals when the spread deviates significantly from its historical mean. It only trades the second asset (S2) while using the first asset (S1) as a reference for spread calculation.
HOW IT WORKS
Spread Calculation:
- Computes log spread: log(S1) - log(S2)
- Calculates rolling Z-score of the spread
- Identifies overbought/oversold conditions
Entry Signals:
- Long S2: When spread Z-score crosses above entry threshold (S1 relatively overpriced)
- Short S2: When spread Z-score crosses below negative entry threshold (S2 relatively overpriced)
Exit Signals:
- Positions close when Z-score reverts to exit threshold levels
KEY PARAMETERS
- Window: Rolling period for mean and standard deviation calculation (default: 144)
- Entry Threshold: Z-score level to trigger new positions (default: 1.5)
- Exit Threshold: Z-score level to close positions (default: 0.3)
FEATURES
✓ Vectorized backtesting engine
✓ Built-in parameter optimization
✓ Comprehensive performance metrics
✓ Visual analysis tools
✓ Position sizing with leverage support
RISK WARNING
This strategy:
- Assumes mean-reverting behavior in price ratios
- Does not guarantee future performance
- Uses leverage which amplifies both gains and losses
- Does not include transaction costs in base implementation
- Requires monitoring of correlation breakdown
RECOMMENDED USE
Best suited for pairs with:
- High historical correlation (>0.8)
- Similar market dynamics
- Sufficient liquidity
- Stable volatility patterns
Always backtest with realistic transaction costs and implement proper risk management including stop-losses and position limits.
DISCLAIMER
For educational purposes only. Past performance does not guarantee future results. Trade at your
Скрипт с защищённым кодом
Этот скрипт опубликован с закрытым исходным кодом. Однако вы можете использовать его свободно и без каких-либо ограничений — читайте подробнее здесь.
Отказ от ответственности
Информация и публикации не предназначены для предоставления и не являются финансовыми, инвестиционными, торговыми или другими видами советов или рекомендаций, предоставленных или одобренных TradingView. Подробнее читайте в Условиях использования.
Скрипт с защищённым кодом
Этот скрипт опубликован с закрытым исходным кодом. Однако вы можете использовать его свободно и без каких-либо ограничений — читайте подробнее здесь.
Отказ от ответственности
Информация и публикации не предназначены для предоставления и не являются финансовыми, инвестиционными, торговыми или другими видами советов или рекомендаций, предоставленных или одобренных TradingView. Подробнее читайте в Условиях использования.