OPEN-SOURCE SCRIPT
SadashiTrading Gap Analyzer

📊 Overview:
Gaps are among the most misunderstood price action phenomena. Most retail traders treat every gap as a "gap fill" opportunity regardless of market structure.
The SadashiTrading Gap Analyzer evaluates historical gaps by contextualizing them through Trend Alignment (SMA) and Volume Expansion (RVOL). Instead of guessing, it calculates historical sample sizes, win rates, average returns, and Profit Factor Asymmetry on the fly.
⚙️ Key Features & Filters:
- Gap Size Threshold (minGapPct): Filters out minor noise and focuses solely on significant overnight imbalances.
- Trend Context (useSmaFilter): Categorizes gaps into With-Trend (continuation) or Against-Trend (mean-reversion) setups using a configurable SMA baseline.
- Volume Context (useRvolFilter): Confirms activity by requiring Relative Volume expansion on the gap day.
- Flexible Horizon Evaluation (evalDays): Analyzes statistical outcomes from same-day close (0) up to 10 trading days post-gap (10).
📈 On-Chart Dynamic Dashboard:
The indicator plots an interactive summary table breaking down 4 distinct market scenarios:
Bull Gap — With Trend (Trend Continuation)
Bull Gap — Against Trend (Counter-trend / Mean Reversion)
Bear Gap — With Trend (Trend Continuation)
Bear Gap — Against Trend (Counter-trend / Mean Reversion)
Tracked Metrics per Scenario:
Samples: Total historical occurrences matching the exact criteria.
Win Rate: Percentage of observations yielding positive return over the evaluation window.
Avg Return: Mean performance per trade.
Profit Factor: Gross profit relative to gross loss
⚠️ Important Methodology & Model Limitations
- Context Model vs. Execution Backtest: This indicator measures directional context bias, not live execution PnL. Performance is evaluated simplistically from Open to Close.
- No Intra-Session Risk Management: It does not account for intraday drawdowns, stop-losses, or take-profit targets. Intraday price path metrics (MAE/MFE) are excluded.
- Friction & Slippage: Does not include broker fees or market-open slippage around the 09:30 EST bell.
Gaps are among the most misunderstood price action phenomena. Most retail traders treat every gap as a "gap fill" opportunity regardless of market structure.
The SadashiTrading Gap Analyzer evaluates historical gaps by contextualizing them through Trend Alignment (SMA) and Volume Expansion (RVOL). Instead of guessing, it calculates historical sample sizes, win rates, average returns, and Profit Factor Asymmetry on the fly.
⚙️ Key Features & Filters:
- Gap Size Threshold (minGapPct): Filters out minor noise and focuses solely on significant overnight imbalances.
- Trend Context (useSmaFilter): Categorizes gaps into With-Trend (continuation) or Against-Trend (mean-reversion) setups using a configurable SMA baseline.
- Volume Context (useRvolFilter): Confirms activity by requiring Relative Volume expansion on the gap day.
- Flexible Horizon Evaluation (evalDays): Analyzes statistical outcomes from same-day close (0) up to 10 trading days post-gap (10).
📈 On-Chart Dynamic Dashboard:
The indicator plots an interactive summary table breaking down 4 distinct market scenarios:
Bull Gap — With Trend (Trend Continuation)
Bull Gap — Against Trend (Counter-trend / Mean Reversion)
Bear Gap — With Trend (Trend Continuation)
Bear Gap — Against Trend (Counter-trend / Mean Reversion)
Tracked Metrics per Scenario:
Samples: Total historical occurrences matching the exact criteria.
Win Rate: Percentage of observations yielding positive return over the evaluation window.
Avg Return: Mean performance per trade.
Profit Factor: Gross profit relative to gross loss
⚠️ Important Methodology & Model Limitations
- Context Model vs. Execution Backtest: This indicator measures directional context bias, not live execution PnL. Performance is evaluated simplistically from Open to Close.
- No Intra-Session Risk Management: It does not account for intraday drawdowns, stop-losses, or take-profit targets. Intraday price path metrics (MAE/MFE) are excluded.
- Friction & Slippage: Does not include broker fees or market-open slippage around the 09:30 EST bell.
Açık kaynak kodlu komut dosyası
Gerçek TradingView ruhuyla, bu komut dosyasının mimarı, yatırımcıların işlevselliğini inceleyip doğrulayabilmesi için onu açık kaynaklı hale getirdi. Yazarı tebrik ederiz! Ücretsiz olarak kullanabilseniz de, kodu yeniden yayınlamanın Topluluk Kurallarımıza tabi olduğunu unutmayın.
Feragatname
Bilgiler ve yayınlar, TradingView tarafından sağlanan veya onaylanan finansal, yatırım, alım satım veya diğer türden tavsiye veya öneriler anlamına gelmez ve teşkil etmez. Kullanım Koşulları bölümünde daha fazlasını okuyun.
Açık kaynak kodlu komut dosyası
Gerçek TradingView ruhuyla, bu komut dosyasının mimarı, yatırımcıların işlevselliğini inceleyip doğrulayabilmesi için onu açık kaynaklı hale getirdi. Yazarı tebrik ederiz! Ücretsiz olarak kullanabilseniz de, kodu yeniden yayınlamanın Topluluk Kurallarımıza tabi olduğunu unutmayın.
Feragatname
Bilgiler ve yayınlar, TradingView tarafından sağlanan veya onaylanan finansal, yatırım, alım satım veya diğer türden tavsiye veya öneriler anlamına gelmez ve teşkil etmez. Kullanım Koşulları bölümünde daha fazlasını okuyun.