OPEN-SOURCE SCRIPT
Options ConfluenceBacktest Strategy

. EMA (13-period) — Trend Direction Filter
The Exponential Moving Average weights recent price more heavily than older price, so it reacts faster to changes than a simple moving average. Here it's used as a basic trend filter: price above EMA = bullish bias, price below = bearish bias. It's the "which side of the market am I even allowed to trade" gate.
2. VWAP — Institutional Fair Value Reference
Volume-Weighted Average Price is the average price weighted by volume traded at each price level, resetting each session. It's widely used by institutional/algo desks as a benchmark for "fair value" for the day — price above VWAP suggests buyers are in control and paying a premium to average; below suggests sellers are dominant. Combining EMA + VWAP means you're requiring both a short-term trend signal and an institutional positioning signal to agree before considering a trade.
3. Chandelier Exit — Volatility-Adjusted Trend/Stop Indicator
Originally built by Chuck LeBeau, this uses ATR (Average True Range) to set a trailing stop: highest high (over N bars) − ATR × multiplier for longs, lowest low + ATR × multiplier for shorts. The idea is the stop distance scales with how volatile the market currently is — tighter stops in calm markets, wider stops in choppy ones — rather than using a fixed point/percentage stop. Here it's repurposed as a directional filter (ceDir): once price closes beyond its own ratcheted stop line, the market is considered to have flipped regime. This is the piece that was buggy before — a proper Chandelier Exit locks in its stop level as the trend extends (never loosens it), so it acts like a ratchet defining trend persistence, not just a moving band.
4. BOS (Break of Structure) — Price Action / Smart Money Concepts
This comes from ICT/Smart Money Concepts trading theory. A "break of structure" happens when price closes beyond a recent swing high (bullish BOS) or swing low (bearish BOS), signaling that the prevailing short-term structure has been broken and a new directional leg may be underway. Here it's simplified to "close beyond the highest high/lowest low of the last N bars" — a lightweight proxy for genuine swing-point BOS.
How they combine — Confluence Trading
The core theory tying this together is confluence: no single indicator is trusted alone; a trade only triggers when multiple independent signal types agree simultaneously:
Trend (EMA)
Institutional reference level (VWAP)
Volatility-adjusted regime/momentum (Chandelier direction)
Structural price action break (BOS)
The logic is that each indicator alone throws false signals regularly, but the intersection of unrelated methodologies (a moving average, a volume-weighted price, a volatility band, and a structural break) filters out a lot of that noise, at the cost of trading much less frequently — you're trading only the highest-conviction setups where trend, order flow proxy, volatility regime, and structure all point the same way at once.
The tradeoff worth knowing: confluence models like this tend to have fewer trades and (in theory) higher win rates per trade, but they also lag — by the time all four conditions align, you're often entering after a meaningful chunk of the move has already happened, which matters a lot for options where theta is working against you while you wait for the setup to form.
The Exponential Moving Average weights recent price more heavily than older price, so it reacts faster to changes than a simple moving average. Here it's used as a basic trend filter: price above EMA = bullish bias, price below = bearish bias. It's the "which side of the market am I even allowed to trade" gate.
2. VWAP — Institutional Fair Value Reference
Volume-Weighted Average Price is the average price weighted by volume traded at each price level, resetting each session. It's widely used by institutional/algo desks as a benchmark for "fair value" for the day — price above VWAP suggests buyers are in control and paying a premium to average; below suggests sellers are dominant. Combining EMA + VWAP means you're requiring both a short-term trend signal and an institutional positioning signal to agree before considering a trade.
3. Chandelier Exit — Volatility-Adjusted Trend/Stop Indicator
Originally built by Chuck LeBeau, this uses ATR (Average True Range) to set a trailing stop: highest high (over N bars) − ATR × multiplier for longs, lowest low + ATR × multiplier for shorts. The idea is the stop distance scales with how volatile the market currently is — tighter stops in calm markets, wider stops in choppy ones — rather than using a fixed point/percentage stop. Here it's repurposed as a directional filter (ceDir): once price closes beyond its own ratcheted stop line, the market is considered to have flipped regime. This is the piece that was buggy before — a proper Chandelier Exit locks in its stop level as the trend extends (never loosens it), so it acts like a ratchet defining trend persistence, not just a moving band.
4. BOS (Break of Structure) — Price Action / Smart Money Concepts
This comes from ICT/Smart Money Concepts trading theory. A "break of structure" happens when price closes beyond a recent swing high (bullish BOS) or swing low (bearish BOS), signaling that the prevailing short-term structure has been broken and a new directional leg may be underway. Here it's simplified to "close beyond the highest high/lowest low of the last N bars" — a lightweight proxy for genuine swing-point BOS.
How they combine — Confluence Trading
The core theory tying this together is confluence: no single indicator is trusted alone; a trade only triggers when multiple independent signal types agree simultaneously:
Trend (EMA)
Institutional reference level (VWAP)
Volatility-adjusted regime/momentum (Chandelier direction)
Structural price action break (BOS)
The logic is that each indicator alone throws false signals regularly, but the intersection of unrelated methodologies (a moving average, a volume-weighted price, a volatility band, and a structural break) filters out a lot of that noise, at the cost of trading much less frequently — you're trading only the highest-conviction setups where trend, order flow proxy, volatility regime, and structure all point the same way at once.
The tradeoff worth knowing: confluence models like this tend to have fewer trades and (in theory) higher win rates per trade, but they also lag — by the time all four conditions align, you're often entering after a meaningful chunk of the move has already happened, which matters a lot for options where theta is working against you while you wait for the setup to form.
Script de código aberto
Em verdadeiro espírito do TradingView, o criador deste script o tornou de código aberto, para que os traders possam revisar e verificar sua funcionalidade. Parabéns ao autor! Embora você possa usá-lo gratuitamente, lembre-se de que a republicação do código está sujeita às nossas Regras da Casa.
Aviso legal
As informações e publicações não se destinam a ser, e não constituem, conselhos ou recomendações financeiras, de investimento, comerciais ou de outro tipo fornecidos ou endossados pela TradingView. Leia mais nos Termos de Uso.
Script de código aberto
Em verdadeiro espírito do TradingView, o criador deste script o tornou de código aberto, para que os traders possam revisar e verificar sua funcionalidade. Parabéns ao autor! Embora você possa usá-lo gratuitamente, lembre-se de que a republicação do código está sujeita às nossas Regras da Casa.
Aviso legal
As informações e publicações não se destinam a ser, e não constituem, conselhos ou recomendações financeiras, de investimento, comerciais ou de outro tipo fornecidos ou endossados pela TradingView. Leia mais nos Termos de Uso.