Spread Mean Reversion Strategy [SciQua]

Spread Mean Reversion Strategy [SciQua]
╰───────────────────────────────────────╯
This invite-only futures spread strategy applies a statistical mean reversion framework, executing limit orders exclusively at calculated Z-score thresholds for precise, rules-based entries and exits. It is designed for CME-style spreads and synthetic instruments with well-defined reversion tendencies.
╭────────────╮
Core Concept
╰────────────╯
The strategy calculates a rolling mean and standard deviation of a chosen spread or synthetic price series, then computes the Z-score to measure deviation from the mean in standard deviation units.
- Long entries trigger when Z crosses upward through a negative entry threshold (`-devEnter`). A buy limit is placed exactly at the price corresponding to that Z-score, optionally offset by a configurable tick amount.
- Short entries trigger when Z crosses downward through a positive entry threshold (`+devEnter`). A sell limit is placed at the corresponding threshold price, also with optional offset.
- Exits use the same threshold method, with an independent `Close Limit Offset` to fine-tune exit placement.
╭────────────╮
Key Features
╰────────────╯
- Persistence filter – Requires the Z-score to remain beyond threshold for a configurable number of bars before entry.
- Cooldown after exits – Prevents immediate re-entry to reduce over-trading.
- Daily and weekend flattening – Force-flattens positions via limit orders before exchange maintenance breaks and weekend closes.
- Auto-rollover detection with persistence – Detects when the second contract month’s daily volume exceeds the first for a set number of days, then blocks new entries (optional).
- Configurable tick offsets – Independently adjust entry and exit levels relative to threshold prices.
- Minimum spread width filter – Blocks trades when long/short entry thresholds are too close together.
- Contract multiplier override – Allows correct sizing for synthetic symbols where `syminfo.pointvalue` is incorrect or missing.
- Limit-only execution – All entries, exits, and forced-flat actions are executed with limit orders for price control.
╭────────────────────╮
Entry Blocking Rules
╰────────────────────╯
New trades are blocked:
- During daily maintenance break pre-windows
- During weekend close pre-windows
- After rollover triggers, if `Block After Roll` is enabled
╭────────────────────────╮
Intended Markets & Usage
╰────────────────────────╯
- Built for futures spreads and synthetic instruments, including calendar spreads.
- Performs best in markets with clear seasonal or statistical mean-reverting tendencies.
- Not designed for strongly trending, non-reverting markets.
╭──────────────────────────╮
Risk Management & Defaults
╰──────────────────────────╯
- Fixed default position size of 1 contract (qty calc function available for customization).
- Realistic commission and slippage assumptions pre-set.
- Pyramiding disabled by default.
- Default Z-score levels: Entry at ±2.0, Exit at ±0.5.
- Separate tick offset controls for entries and exits.
Note: This strategy is for research and backtesting purposes only. Past performance does not guarantee future results. All use is subject to explicit written permission from the author.
Скрипт с ограниченным доступом
Только пользователи, одобренные автором, могут получить доступ к этому скрипту. Вам нужно отправить запрос и получить разрешение на его использование. Обычно доступ предоставляется после оплаты. Для получения подробной информации следуйте инструкциям автора ниже или свяжитесь с JoshuaDanford напрямую.
TradingView НЕ рекомендует платить за скрипт или использовать его, если вы не доверяете его автору и не понимаете, как скрипт работает. Вы всегда можете найти бесплатные скрипты с открытым исходным кодом в Скриптах сообщества.
Инструкции от автора
Внимание: перед тем как запрашивать доступ, прочитайте наши правила для скриптов с ограниченным доступом.
TradingView indicators, backtesting tools, weekly contests, and live market analysis.
Join free, compete, win, and stay updated at sciqua.com
Отказ от ответственности
Скрипт с ограниченным доступом
Только пользователи, одобренные автором, могут получить доступ к этому скрипту. Вам нужно отправить запрос и получить разрешение на его использование. Обычно доступ предоставляется после оплаты. Для получения подробной информации следуйте инструкциям автора ниже или свяжитесь с JoshuaDanford напрямую.
TradingView НЕ рекомендует платить за скрипт или использовать его, если вы не доверяете его автору и не понимаете, как скрипт работает. Вы всегда можете найти бесплатные скрипты с открытым исходным кодом в Скриптах сообщества.
Инструкции от автора
Внимание: перед тем как запрашивать доступ, прочитайте наши правила для скриптов с ограниченным доступом.
TradingView indicators, backtesting tools, weekly contests, and live market analysis.
Join free, compete, win, and stay updated at sciqua.com