OPEN-SOURCE SCRIPT
Channel Reversion System

WHAT IT DOES
CRS buys weakness at structural support inside an established uptrend, and takes profit when price reverts to the middle of its range. It is deliberately a capital-efficiency system rather than a raw-return system: high hit rate, small symmetric trades, single-digit-to-teens drawdowns, and it sits in cash roughly 80% of the time. Built for liquid index ETFs (QQQ, SPY) on the daily timeframe.
HOW IT WORKS
1) STRUCTURE - a 50-day Donchian channel built on prior-bar highs and lows (no same-bar self-reference) maps the active trading range. The lower quarter of that channel is the accumulation zone.
2) TREND FILTER - entries exist only while price holds above its 200-day SMA. Mean reversion is traded WITH the prevailing trend, never against it; fading downtrends is how reversion accounts die. A close below the SMA while positioned is an immediate exit - trend gone, thesis gone.
3) ENTRY - close enters the lower quarter of the channel while the trend filter holds. Location plus regime, no prediction.
4) EXITS - profit target at the channel midline (the reversion to the middle of the range is the statistically reliable move); hard stop one ATR(14) below the channel floor (if the range itself fails, the location thesis is falsified); regime exit on the 200-SMA break.
BACKTEST PROPERTIES (fully disclosed)
0.05% commission per side, 1 tick slippage, fills on close, $10,000 initial capital. QQQ daily March 1999 - August 2026 (a 27-year window that includes the dot-com collapse and the 2008 crisis): +104% net, profit factor 2.28, 64% winners, 58 trades, max drawdown 15.2%. Cross-symbol with parameters frozen: SPY +67%, profit factor 1.80, 62% winners, max drawdown 8.5%. Stated plainly: CRS does NOT beat buy-and-hold on raw return - a system that is long roughly 20% of the time cannot outrun a secular bull market. What transfers across symbols untouched is the character: high hit rate, small symmetric win/loss sizes, small drawdown.
WHAT WAS TESTED AND REJECTED
A chandelier-trail "let winners ride" exit was tested and REJECTED with numbers: same net return, profit factor down from 2.28 to 1.79, win rate 64% to 47%, drawdown up from 15% to 19%. In a mean-reversion system the target IS the edge. A 3x leveraged wrapper (TQQQ) was also tested and REJECTED: profit factor collapsed to 1.43 and max drawdown tripled to 43% - leverage triples the noise around the structural stop.
INPUTS
Channel length (50), entry zone as % of channel (25), trend SMA length (200), ATR length (14), stop distance in ATR below the channel floor (1.0).
LIMITATIONS
In-sample, single-history backtests - upper bounds on expectancy, not forecasts. The QQQ/SPY pair shares one market era; genuine robustness claims need non-US indices and bear-heavy subperiods. Validate on your own symbols and windows before relying on it. Not financial advice.
CRS buys weakness at structural support inside an established uptrend, and takes profit when price reverts to the middle of its range. It is deliberately a capital-efficiency system rather than a raw-return system: high hit rate, small symmetric trades, single-digit-to-teens drawdowns, and it sits in cash roughly 80% of the time. Built for liquid index ETFs (QQQ, SPY) on the daily timeframe.
HOW IT WORKS
1) STRUCTURE - a 50-day Donchian channel built on prior-bar highs and lows (no same-bar self-reference) maps the active trading range. The lower quarter of that channel is the accumulation zone.
2) TREND FILTER - entries exist only while price holds above its 200-day SMA. Mean reversion is traded WITH the prevailing trend, never against it; fading downtrends is how reversion accounts die. A close below the SMA while positioned is an immediate exit - trend gone, thesis gone.
3) ENTRY - close enters the lower quarter of the channel while the trend filter holds. Location plus regime, no prediction.
4) EXITS - profit target at the channel midline (the reversion to the middle of the range is the statistically reliable move); hard stop one ATR(14) below the channel floor (if the range itself fails, the location thesis is falsified); regime exit on the 200-SMA break.
BACKTEST PROPERTIES (fully disclosed)
0.05% commission per side, 1 tick slippage, fills on close, $10,000 initial capital. QQQ daily March 1999 - August 2026 (a 27-year window that includes the dot-com collapse and the 2008 crisis): +104% net, profit factor 2.28, 64% winners, 58 trades, max drawdown 15.2%. Cross-symbol with parameters frozen: SPY +67%, profit factor 1.80, 62% winners, max drawdown 8.5%. Stated plainly: CRS does NOT beat buy-and-hold on raw return - a system that is long roughly 20% of the time cannot outrun a secular bull market. What transfers across symbols untouched is the character: high hit rate, small symmetric win/loss sizes, small drawdown.
WHAT WAS TESTED AND REJECTED
A chandelier-trail "let winners ride" exit was tested and REJECTED with numbers: same net return, profit factor down from 2.28 to 1.79, win rate 64% to 47%, drawdown up from 15% to 19%. In a mean-reversion system the target IS the edge. A 3x leveraged wrapper (TQQQ) was also tested and REJECTED: profit factor collapsed to 1.43 and max drawdown tripled to 43% - leverage triples the noise around the structural stop.
INPUTS
Channel length (50), entry zone as % of channel (25), trend SMA length (200), ATR length (14), stop distance in ATR below the channel floor (1.0).
LIMITATIONS
In-sample, single-history backtests - upper bounds on expectancy, not forecasts. The QQQ/SPY pair shares one market era; genuine robustness claims need non-US indices and bear-heavy subperiods. Validate on your own symbols and windows before relying on it. Not financial advice.
开源脚本
秉承TradingView的精神,该脚本的作者将其开源,以便交易者可以查看和验证其功能。向作者致敬!您可以免费使用该脚本,但请记住,重新发布代码须遵守我们的网站规则。
免责声明
这些信息和出版物并非旨在提供,也不构成TradingView提供或认可的任何形式的财务、投资、交易或其他类型的建议或推荐。请阅读使用条款了解更多信息。
开源脚本
秉承TradingView的精神,该脚本的作者将其开源,以便交易者可以查看和验证其功能。向作者致敬!您可以免费使用该脚本,但请记住,重新发布代码须遵守我们的网站规则。
免责声明
这些信息和出版物并非旨在提供,也不构成TradingView提供或认可的任何形式的财务、投资、交易或其他类型的建议或推荐。请阅读使用条款了解更多信息。