OPEN-SOURCE SCRIPT
Compression Breakout System

WHAT IT DOES
CBS trades the volatility cycle on daily bars. Volatility is cyclical: compression precedes expansion. The system waits for a statistically quiet base, buys the first range break that comes with real participation, and rides the expansion leg on a wide trail. Long-only, designed for trending large-caps and liquid index ETFs.
HOW IT WORKS
1) COMPRESSION DETECTION — Bollinger Band width (20, 2) is expressed as a percentage of the basis and ranked against its own trailing 126-day distribution. A "squeeze" is a bottom-quartile reading (width percentile rank below 25). Because this is a percentile rank rather than an absolute width threshold, it self-normalizes across symbols and volatility regimes — nothing to re-tune per asset.
2) TRIGGER — a close above the prior 20-day high, within 5 bars of the last squeeze reading, on above-average volume (volume above its 20-day mean), while price holds above the 200-day SMA. Location plus participation plus trend — no prediction.
3) POSITION SIZING — fixed-fractional: each trade risks a configurable percentage of equity (default 4%), with the position sized off the 2-ATR stop distance and capped at 100% of equity. Volatile symbols automatically get smaller positions, and a failed breakout always costs roughly the same fraction of the account.
4) EXITS — a hard stop 2 ATR under entry (failed break = thesis falsified), and a 3-ATR chandelier trail from the high-water mark. There is deliberately no profit target: expansion legs are long-tailed and the trail, not a target, books them.
BACKTEST PROPERTIES (fully disclosed)
All results use 0.05% commission per side, 1 tick slippage, fills on close of the signal bar, $10,000 initial capital. On AAPL daily 2005-2026 the default configuration shows +899% net, profit factor 4.33, 59% winners, max drawdown 14.4%. Split-sample with parameters frozen: 2005-2015 +164% (PF 3.35), 2015-2026 +293% (PF 4.97). Slippage stress at 5 ticks per side: +256% (PF 4.77). Cross-symbol with frozen parameters: NVDA +658% (PF 3.26); MSFT +46% (PF 1.32) — the honest miss: the system needs names that actually produce post-squeeze expansion, and low-volatility grinders barely clear costs.
WHAT WAS TESTED AND REJECTED
100%-of-equity sizing was rejected: the identical signal stack produced an 89% drawdown in AAPL's choppy pre-2005 era. Risk sizing is what turns a signal into a system. The backtest start/end inputs exist so any subperiod can be scored from the settings dialog without touching code.
INPUTS
Bollinger length and multiplier; width rank window; squeeze threshold and age; breakout lookback; trend SMA length; ATR length; initial stop multiple; chandelier trail multiple; risk % per trade; backtest start/end dates.
LIMITATIONS
These are in-sample backtests on liquid US equities — upper bounds on expectancy, not forecasts. The system trades infrequently (roughly 2-3 trades per year per symbol) and holds through pullbacks by design. Validate on your own symbols and windows before relying on it. Not financial advice.
CBS trades the volatility cycle on daily bars. Volatility is cyclical: compression precedes expansion. The system waits for a statistically quiet base, buys the first range break that comes with real participation, and rides the expansion leg on a wide trail. Long-only, designed for trending large-caps and liquid index ETFs.
HOW IT WORKS
1) COMPRESSION DETECTION — Bollinger Band width (20, 2) is expressed as a percentage of the basis and ranked against its own trailing 126-day distribution. A "squeeze" is a bottom-quartile reading (width percentile rank below 25). Because this is a percentile rank rather than an absolute width threshold, it self-normalizes across symbols and volatility regimes — nothing to re-tune per asset.
2) TRIGGER — a close above the prior 20-day high, within 5 bars of the last squeeze reading, on above-average volume (volume above its 20-day mean), while price holds above the 200-day SMA. Location plus participation plus trend — no prediction.
3) POSITION SIZING — fixed-fractional: each trade risks a configurable percentage of equity (default 4%), with the position sized off the 2-ATR stop distance and capped at 100% of equity. Volatile symbols automatically get smaller positions, and a failed breakout always costs roughly the same fraction of the account.
4) EXITS — a hard stop 2 ATR under entry (failed break = thesis falsified), and a 3-ATR chandelier trail from the high-water mark. There is deliberately no profit target: expansion legs are long-tailed and the trail, not a target, books them.
BACKTEST PROPERTIES (fully disclosed)
All results use 0.05% commission per side, 1 tick slippage, fills on close of the signal bar, $10,000 initial capital. On AAPL daily 2005-2026 the default configuration shows +899% net, profit factor 4.33, 59% winners, max drawdown 14.4%. Split-sample with parameters frozen: 2005-2015 +164% (PF 3.35), 2015-2026 +293% (PF 4.97). Slippage stress at 5 ticks per side: +256% (PF 4.77). Cross-symbol with frozen parameters: NVDA +658% (PF 3.26); MSFT +46% (PF 1.32) — the honest miss: the system needs names that actually produce post-squeeze expansion, and low-volatility grinders barely clear costs.
WHAT WAS TESTED AND REJECTED
100%-of-equity sizing was rejected: the identical signal stack produced an 89% drawdown in AAPL's choppy pre-2005 era. Risk sizing is what turns a signal into a system. The backtest start/end inputs exist so any subperiod can be scored from the settings dialog without touching code.
INPUTS
Bollinger length and multiplier; width rank window; squeeze threshold and age; breakout lookback; trend SMA length; ATR length; initial stop multiple; chandelier trail multiple; risk % per trade; backtest start/end dates.
LIMITATIONS
These are in-sample backtests on liquid US equities — upper bounds on expectancy, not forecasts. The system trades infrequently (roughly 2-3 trades per year per symbol) and holds through pullbacks by design. Validate on your own symbols and windows before relying on it. Not financial advice.
Mã nguồn mở
Theo đúng tinh thần TradingView, tác giả của tập lệnh này đã công bố nó dưới dạng mã nguồn mở, để các nhà giao dịch có thể xem xét và xác minh chức năng. Chúc mừng tác giả! Mặc dù bạn có thể sử dụng miễn phí, hãy nhớ rằng việc công bố lại mã phải tuân theo Nội quy.
Thông báo miễn trừ trách nhiệm
Thông tin và các ấn phẩm này không nhằm mục đích, và không cấu thành, lời khuyên hoặc khuyến nghị về tài chính, đầu tư, giao dịch hay các loại khác do TradingView cung cấp hoặc xác nhận. Đọc thêm tại Điều khoản Sử dụng.
Mã nguồn mở
Theo đúng tinh thần TradingView, tác giả của tập lệnh này đã công bố nó dưới dạng mã nguồn mở, để các nhà giao dịch có thể xem xét và xác minh chức năng. Chúc mừng tác giả! Mặc dù bạn có thể sử dụng miễn phí, hãy nhớ rằng việc công bố lại mã phải tuân theo Nội quy.
Thông báo miễn trừ trách nhiệm
Thông tin và các ấn phẩm này không nhằm mục đích, và không cấu thành, lời khuyên hoặc khuyến nghị về tài chính, đầu tư, giao dịch hay các loại khác do TradingView cung cấp hoặc xác nhận. Đọc thêm tại Điều khoản Sử dụng.