Masterclass #35: Gap Filling – Mastering the Price Void and Structural Equilibrium

In the algorithmic landscape of 2026, price gaps are not merely inconveniences; they are the market’s way of breathing through the vacuum of time. When the world sleeps, information accumulates, and when the opening bell rings, that information explodes into a gap. This masterclass deciphers the “Vibe” of the price void, shifting from reactive gambling to a systematic exploitation of structural equilibrium.


1. Executive Summary: The Gravity of the Void

A price gap occurs when the opening price of an asset is significantly higher or lower than the previous day’s close, leaving a “void” where no trading occurred. In the US Equities market—traditionally dominated by the 9:30 AM to 4:00 PM EST session—these gaps provide vital clues about institutional positioning and “Fair Value” recalibration.

The Objective: To differentiate between a “Common Gap” (noise) and a “Breakaway Gap” (regime shift), and to execute a mean-reversion trade that harvests the alpha generated as the market returns to its equilibrium point.

Gap Performance Matrix

Gap TypeProbabilistic VibeStrategic DirectionFill Velocity
**Common Gap**High Mean ReversionFade the GapFast (Intraday)
**Breakaway**High MomentumFollow the GapMinimal / Never
**Exhaustion**Trend TerminationViolent ReversalMedium
**Runaway**Mid-Trend AccelerationMomentum AppendPartial

2. Philosophical Foundation: Market Nature Abhors a Vacuum

In the VibeAlgo philosophy, a gap represents an imbalance between the “Accumulated Sentiment” of the off-hours and the “Immediate Liquidity” of the open.

  • The Rubber Band Effect: Think of a gap as stretching the market’s price away from its short-term moving average. The further it stretches without new, fundamental data to support it, the more likely it is to snap back—filling the void.
  • Institutional Stealth: Whales often use the high liquidity of the open to disguise their exits or entries. By fading the gap, we are often trading against the retail panic and with the institutional stabilization.
  • The Vibe Context: A gap is only meaningful when compared to the Regime State (MC #31). In a “Quiet Growth” regime, gaps are almost always filled. In a “Crisis” regime, gaps are often the start of a vertical liquidation.

3. The Technical Engine: The Gap-Equilibrium Script

To trade gaps successfully, we must measure the Relative Gap Size (RGS) and the Pre-Market Impulse (PMI).

The Algorithm

1. RGS Calculation: Comparing the gap size to the 20-day ATR (Average True Range). If Gap > 0.5 ATR, it is “Significant.” 2. Volume Confirmation: If the gap occurs on less than 50% of the average opening volume, the conviction is low. This is a prime candidate for a “Fill” trade. 3. The 30-Minute Rule: We wait for the first 30 minutes of the NYSE session. If the price fails to make a new high/low beyond the gap level, the probability of a fill increases to over 70%.


4. Python Implementation: The Gap-Fade Logic

This script identifies a gap and sets up a mean-reversion trade target based on the previous close.

# [vibealgolab.com] 2026-02-24 | VibeCoding with Gemini & Antigravity
import numpy as np

class GapEquilibriumAgent:
    def __init__(self, prev_close, open_price, atr_20d):
        self.prev_close = prev_close
        self.open_price = open_price
        self.gap_size = open_price - prev_close
        self.gap_pct = self.gap_size / prev_close
        self.atr = atr_20d
        self.trade_active = False

    def analyze_vibe(self, opening_vol):
        """
        Determines if the gap is a candidate for fading.
        """
        # Significant gap but low institutional 'conviction' (volume)
        if abs(self.gap_size) > (0.4 * self.atr) and opening_vol < 1.2:
            return "FADE_CANDIDATE"
        elif abs(self.gap_size) > (1.5 * self.atr):
            return "BREAKAWAY_WARNING" # Too large to fade
        return "NOISE"

    def execute_fade(self, current_price):
        target = self.prev_close
        stop_loss = self.open_price + (self.gap_size * 0.5) # Protect against extension
        
        if self.gap_size > 0: # Gap Up -> Short
            if current_price < self.open_price:
                return f"SELL_OPEN | Target: {target} | Stop: {stop_loss}"
        elif self.gap_size < 0: # Gap Down -> Buy
            if current_price > self.open_price:
                return f"BUY_OPEN | Target: {target} | Stop: {stop_loss}"
        return "WAITING_FOR_REVERSAL"

# Scenario: NVDA Gaps up 3% on no news.
agent = GapEquilibriumAgent(prev_close=130.0, open_price=133.9, atr_20d=4.5)
vibe = agent.analyze_vibe(opening_vol=0.8)

print(f"VibeAlgo Gap Analysis: {vibe}")
if vibe == "FADE_CANDIDATE":
    print(f"Signal: {agent.execute_fade(133.5)}")

5. Google AI Integration: Sentiment Gap Auditor

We use Gemini 1.5 Pro to distinguish between a “Technical Gap” and a “Fundamental Gap.” If a gap occurs due to an earnings surprise or a Fed announcement, we never fade it.

The Gap-Audit Prompt

“Analyze the 5% Gap-Up in [Ticker] at 9:30 AM EST. Scan US financial news feeds (WSJ, Bloomberg, CNBC) from 4:00 PM yesterday to now. Is this gap driven by a core fundamental shift (Earnings, CEO change, SEC filing) or is it a systemic liquidity lift? If sentiment is neutral-to-noisy, confirm the ‘Fade-to-Equilibrium’ protocol.”


6. Advanced Risk Management: The Antigravity Shield

Gaps can be “open-ended” traps. To survive:

1. The 3:1 Reward-to-Risk: We only enter if the distance to the “Fill” (Previous Close) is 3x larger than our “Extension Stop.” 2. Time-Stop: If the gap isn’t filled by 11:30 AM EST (the start of the ‘Lunch Doldrums’), we exit. Most profitable fills happen in the first 90 minutes. 3. Volume Spike Guard: If a massive volume spike occurs against our fade direction mid-morning, the “Vibe” has shifted from mean-reversion to momentum. Exit immediately.


7. Actionable Checklist: Execution Protocol

Premarket Scan: Identify US stocks with gaps > 0.5% relative to previous close.

News Filter: Eliminate any stock with specific catalyst news in the last 12 hours.

Opening Range: Wait 15-30 minutes to see if the high/low of the candle holds.

Target Setting: Set the take-profit exactly at the Previous Day’s Close (the “Fill Line”).

Portfolio Check: Ensure total gap-exposure across the portfolio doesn’t exceed 20% of BP.


8. Scenario Analysis: The Response Matrix

Market ContextGap DirectionActionVibe Sentiment
**SPY Neutral**Gap Up 2%Fade (Short)Noise / Overextension
**SPY Bullish**Gap Up 1%**DO NOT FADE**Trend Continuation
**Earnings Beat**Gap Up 8%Buy PullbackRegime Shift (Follow)
**Macro Panic**Gap Down 3%Fade (Long)Irrational Liquidation

9. Conclusion: Closing the Loop

Mastering Gap Filling is about discipline and the recognition of market geometry. Gaps are the market’s way of shouting; our job is to listen for the echo. By applying the “Antigravity Shield” and professional volume analysis, you can turn these morning “Voids” into a consistent source of algorithmic edge.


Recommended Resources

1. “Overnight Drift and Opening Liquidity” – VibeAlgo Research (2025) 2. “Quantifying the Mean-Reversion of NYSE Gaps” – Institutional Trader Monthly 3. [VibeAlgo SDK: GapEngine](file:///d:/z_AI_Project/VibeAlgoLab/wordpress_bot/wp_client.py)


⚠️ **Important Disclaimer**

1. Educational Purpose: All content, including code and strategies, is for educational and research purposes only. 2. No Financial Advice: This is not financial advice. I am not a financial advisor. 3. Risk Warning: Investing involves the risk of total loss. Past performance does not guarantee future results. 4. Software Liability: The code provided is “as-is” without warranty of any kind. Use at your own risk.


Link to [Masterclass #36: Support & Resistance Box Trading](file:///d:/z_AI_Project/VibeAlgoLab/wordpress_bot/pillar_masterclass_36_draft_en.md)


Related Pillar Content

Leave a Comment