PROTECTED SOURCE SCRIPT
Diupdate

RTH Gap & Stdev [Sword & Shield]

31
Dynamic RTH Gap & Stdev [Sword & Shield] - Technical Description
Description
This script implements a specialized methodology for analyzing the Regular Trading Hours (RTH) Opening Gap, focusing on the "void" created between the previous session's RTH Close and the current session's RTH Open. Unlike standard gap indicators that may reference the Settlement or pre-market range, this tool isolates the specific liquidity gap formed by the primary session auction.

The script is designed to help traders identify:

The Gap Zone: The precise price range where no RTH trading occurred.
Internal Quartiles: Key harmonic subdivisions (25%, 50%, 75%) within the gap, often serving as intraday support/resistance.
Expansion Targets: Projected volatility levels (Standard Deviations) above and below the gap.
Mitigation State: Real-time tracking of how much of the gap has been "filled" by price action.
Underlying Concepts & Calculations
1. RTH Session Detection
The indicator strictly follows asset-specific timetables (e.g., Indices 09:30-16:00 ET). It detects the RTH Close of the previous day (closing print of the last RTH bar) and the RTH Open of the current day.

Gap High: Max(PrevClose, CurOpen)
Gap Low: Min(PrevClose, CurOpen)
2. Quartile & Harmonic Levels
We divide the gap range (GapHigh - GapLow) into quartiles. The 50% level (Consequent Encroachment) is a widely recognized equilibrium point in gap trading.

Formula: Level(x) = GapLow + (GapRange * x) where x is 0.25, 0.50, 0.75.
3. Volatility Projections (Standard Deviations)
The script offers two distinct volatility models for projecting targets:

Gap Range Basis: A harmonic expansion model where 1.0σ (Standard Deviation) is rigidly defined as 100% of the Gap Range. This assumes the market often expands in multiples of the initial opening impulse.
Calculation: +1.0σ Level = GapHigh + GapRange
VWAP Bands Basis: A statistical model estimating daily volatility using the deviation of price from the VWAP (Volume Weighted Average Price) from the previous session. This allows the bands to adapt to the broader market volatility rather than just the gap size.
4. Dynamic Extension & Clamping
Uniquely, this script uses a forward-projection bar-loop. Lines and labels are instantiated at the Open and extended incrementally with each new bar.

Clamping: The script calculates the precise timestamp of the RTH Close and clamps all drawing objects to this time. This prevents lines from extending into the post-market or next day, ensuring a clean chart layout.
5. Mitigation Tracking
The dashboard calculates the Unmitigated Percentage of the gap:

Logic: It tracks the session's Highest High and Lowest Low.
Calculation: FilledRange = PriceExtreme - GapBoundary.
Status: displayed as "Unmitigated, 100% rem" or "Mitigated XX%", providing a precise metric for gap-fill strategies.
Usage
Traders can use this tool to:

Target the 50% fill described as "Consequent Encroachment".
Fade extremes at +1.0σ gap expansions.
Monitor the "Mitigation %" to gauge trend strength (e.g., a gap that remains <20% filled often indicates a strong trend day).
Catatan Rilis
Fixed some calculation bugs

Pernyataan Penyangkalan

Informasi dan publikasi ini tidak dimaksudkan, dan bukan merupakan, saran atau rekomendasi keuangan, investasi, trading, atau jenis lainnya yang diberikan atau didukung oleh TradingView. Baca selengkapnya di Ketentuan Penggunaan.