OPEN-SOURCE SCRIPT
SPX Option Wedge Breakout v1.5a (Dual + Micro)

# SPX Option Wedge Breakout (Dual + Micro) — by Miguel Licero
What it does
This indicator is designed to catch fast, 3–5-bar momentum bursts in **SPX options (OPRA)** or the underlying (SPX/ES). It combines two detection engines:
1. Wedge Breakout Engine
- Locates *falling-wedge* compression using recent swing pivots and verifies statistical tightness (channel width vs. ATR).
- Confirms breakout when price closes above the wedge’s upper guide **and** above **EMA-21**, with optional **VWAP** confluence and volume expansion.
2. Micro-Breakout Engine (sub-VWAP thrusts)
- Triggers when **EMA-9 crosses above EMA-21** and price **breaks the prior N-bar high (BOS)** with volume expansion.
- Specifically handles rallies that start **below VWAP**, requiring sufficient “room to VWAP” measured as a fraction of ATR.
This indicador provides a state machine overlay and a dashboard. Consider the following states:
IDLE – no setup
WATCH – valid compression + preconditions (OBV positive, RSI build zone, tightness)
TRIGGER-A – breakout *above VWAP* (Strict mode)
TRIGGER-B/Micro – Under VWAP thrust with room to VWAP or Micro-Breakout (Flexible mode - this is the most common case for SPX options)
Why I believe it works
In my observation i've found short, violent option moves often occur when:
(1) liquidity compresses then releases (wedge), or
(2) micro momentum flips under VWAP and snaps to VWAP/EMA-50 (delta + IV expansion).
The indicator surfaces these two structures with clear, tradeable signals.
---
Inputs (key parameters)
- EMAs: 9 / 21 / 50 / 200 (trend/micro-momentum and magnets/targets)
- VWAP: optional intraday confluence and distance metric
- Wedge: pivot widths (`left/right`), `tightK` (channel width vs ATR), `atrLen`
- Volume/OBV/RSI: `volLen`, `volBoost` (volume expansion factor), `obvLen` (slope via linreg), `rsiLen`
- VWAP Mode:
- Strict – breakout must be above VWAP (TRIGGER-A)
- Flexible – allows under VWAP breakouts if there’s room to VWAP (`minVWAPDistATR`) or a Micro-Breakout
- Micro-Breakout: `useMicro`, `bosLen` (BOS lookback), `minRSIMicro`
- Impulse Bars Target: time-based exit helper (e.g., like 3 or 5 candles)
---
Plots & UI
- Overlay: EMA-9/21/50/200, VWAP, wedge guides, **TRIGGER** marker
- Background color: state shading (IDLE / WATCH / TRIGGER)
- Dashboard (table, top-right): State, VWAP mode, distances to VWAP/EMA-50/EMA-200, EMA-stack (9 vs 21), OBV slope sign, RSI zone, Tightness flag, Impulse counter, Micro status (9>21 / +BOS)
---
Alerts
Consider these status when you see them:
- WATCH (there is wedge ready) – compression + preconditions met (prepare the order)
- TRIGGER-A (price going above VWAP) – Strict breakout confirmation
- TRIGGER-B/Micro – Flexible breakout (price under VWAP with room to go up to VWAP, EMA 200, -OB, resistance line, etc) or Micro-Breakout
---
Recommended Use
Timeframes: 1-minute for execution, 5-minute for context.
Symbols: OPRA SPX options (0-DTE/1-DTE) or SPX/ES for confirmation.
Sessions: Intraday with visible session (VWAP requires intraday data).
Suggested presets (for options):
- `VWAP Mode = Flexible`
- `minVWAPDistATR = 0.7` (room to VWAP)
- `tightK = 1.0–1.2` (compression sensitivity)
- `volBoost = 1.2` (raise to 1.3–1.4 if noisy)
- `obvLen = 14–20` (14 = more reactive)
- `Impulse Bars = 5`
High-probability windows (ET): 11:45–12:45, 13:45–15:15, 15:00–15:45.
---
Notes & Limitations
- Designed to surface setups, not to replace discretion. Combine with your risk plan.
- VWAP “room” is statistical; on news/latency spikes, distances may be crossed in one bar.
- Works on underlyings too, but option % moves are what this study targets.
- It's not guaranteed to work 100% of the times. Trade responsibly.
---
Mã nguồn mở
Theo đúng tinh thần TradingView, người tạo ra tập lệnh này đã biến tập lệnh thành mã nguồn mở để các nhà giao dịch có thể xem xét và xác minh công năng. Xin dành lời khen tặng cho tác giả! Mặc dù bạn có thể sử dụng miễn phí, nhưng lưu ý nếu đăng lại mã, bạn phải tuân theo Quy tắc nội bộ của chúng tôi.
Thông báo miễn trừ trách nhiệm
Thông tin và ấn phẩm không có nghĩa là và không cấu thành, tài chính, đầu tư, kinh doanh, hoặc các loại lời khuyên hoặc khuyến nghị khác được cung cấp hoặc xác nhận bởi TradingView. Đọc thêm trong Điều khoản sử dụng.
Mã nguồn mở
Theo đúng tinh thần TradingView, người tạo ra tập lệnh này đã biến tập lệnh thành mã nguồn mở để các nhà giao dịch có thể xem xét và xác minh công năng. Xin dành lời khen tặng cho tác giả! Mặc dù bạn có thể sử dụng miễn phí, nhưng lưu ý nếu đăng lại mã, bạn phải tuân theo Quy tắc nội bộ của chúng tôi.
Thông báo miễn trừ trách nhiệm
Thông tin và ấn phẩm không có nghĩa là và không cấu thành, tài chính, đầu tư, kinh doanh, hoặc các loại lời khuyên hoặc khuyến nghị khác được cung cấp hoặc xác nhận bởi TradingView. Đọc thêm trong Điều khoản sử dụng.