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. اقرأ المزيد في شروط الاستخدام.