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.
オープンソーススクリプト
TradingViewの精神に則り、このスクリプトの作者はコードをオープンソースとして公開してくれました。トレーダーが内容を確認・検証できるようにという配慮です。作者に拍手を送りましょう!無料で利用できますが、コードの再公開はハウスルールに従う必要があります。
免責事項
これらの情報および投稿は、TradingViewが提供または承認する金融、投資、取引、またはその他の種類の助言もしくは推奨であることを意図したものではなく、またこれらに該当するものでもありません。詳細は利用規約をご覧ください。
オープンソーススクリプト
TradingViewの精神に則り、このスクリプトの作者はコードをオープンソースとして公開してくれました。トレーダーが内容を確認・検証できるようにという配慮です。作者に拍手を送りましょう!無料で利用できますが、コードの再公開はハウスルールに従う必要があります。
免責事項
これらの情報および投稿は、TradingViewが提供または承認する金融、投資、取引、またはその他の種類の助言もしくは推奨であることを意図したものではなく、またこれらに該当するものでもありません。詳細は利用規約をご覧ください。