PROTECTED SOURCE SCRIPT

ZONE ZERO

26
📊 Overview:
The "ZONE ZERO" indicator is a multi-functional trading overlay built to enhance price action analysis. It overlays:

- OHLC lines from a user-defined higher timeframe
- EMAs and SMAs for trend direction
- Two anchored VWAPs with customizable periods
- Custom candle coloring based on body structure ("stacking")
- This is ideal for traders who analyze confluence zones, trend strength, and want contextual
guidance from higher timeframes.

🛠️ User Inputs and Configuration

Primary Inputs:
- Lookback (lb): Determines which historical bar from the higher timeframe (HTF) is referenced (e.g., 0 = current HTF bar, 1 = previous).
- Timeframe (tf): Selects the higher timeframe used to extract OHLC data.

🎨 Line Customization Inputs:
- Each HTF price level (open, high, low, close, midpoint) can be customized via:
- Line style (Solid, Dashed, Dotted)

📈 EMA Inputs:
- EMA 1: Fast EMA (default: 8)
- EMA 2: Medium EMA (default: 15)
- EMA 3: Long EMA (default: 200)

🧮 SMA Inputs:
- 4 daily SMAs (20, 50, 100, 200) calculated from the close price by default.

⚖️ VWAP Anchoring Options:
- Two anchored VWAPs, each with independent anchor options:
Session
Week
Month
Quarter
Year

📏 Technical Logic and Features

🔹 HTF OHLC + Midpoint Lines:
- Fetches open, high, low, close from the higher timeframe using request.security().
- Calculates the midpoint as (high + low)/2.
- Plots persistent horizontal lines for each level starting from the HTF bar timestamp.
- Each line is drawn dynamically from the HTF bar's origin to its end using line.set_xy1() and line.set_xy2().

🔸 EMA Plotting:
- EMAs are plotted on the current chart using ta.ema().
- Provides a real-time view of market momentum and directional bias.

🔸 Daily SMAs on Intraday Charts:
- Daily timeframe SMAs are fetched and plotted even on intraday charts using request.security().
- Allows higher timeframe trend overlays during intraday trading.

🔸 Anchored VWAPs (Volume-Weighted Average Price):
- VWAPs are calculated using (high + low)/2 instead of the default hlc3, providing a price-action centric view.
- Reset logic is based on the selected anchor (e.g., session reset, weekly, etc.).
- VWAP line color dynamically changes:
- Colors 1/2 when price is above VWAP
- Colors 3/4 when price is below
- This gives instant visual feedback on whether price is trading with or against volume-weighted trend direction.

🔸 Custom Candle Coloring (Stacked Candle Logic):
- Bullish Stacked Candle:
Current open is above midpoint of previous body
Current close is above open
- Bearish Stacked Candle:
Current open is below midpoint of previous body
Current close is below open
These conditions highlight strong continuation candles, and are colored:

- Green for bullish stacking
- Red for bearish stacking
- All other candles are not affected.

⚠️ Warning System

A smart warning label appears if the user selects a lower timeframe than the chart's resolution (e.g., selecting 1H on a daily chart), which can cause errors in data visibility.

Best Use Cases:
- Intraday traders seeking HTF context
- Swing traders wanting EMA + VWAP confluence
- Price action traders spotting structure-based momentum
- Scalpers using stacked candle setups in combination with VWAP/EMA

Declinazione di responsabilità

Le informazioni ed i contenuti pubblicati non costituiscono in alcun modo una sollecitazione ad investire o ad operare nei mercati finanziari. Non sono inoltre fornite o supportate da TradingView. Maggiori dettagli nelle Condizioni d'uso.