OPEN-SOURCE SCRIPT

SadashiTrading Gap Analyzer

366
📊 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.

Haftungsausschluss

Die Informationen und Veröffentlichungen sind nicht als Finanz-, Anlage-, Handels- oder andere Arten von Ratschlägen oder Empfehlungen gedacht, die von TradingView bereitgestellt oder gebilligt werden, und stellen diese nicht dar. Lesen Sie mehr in den Nutzungsbedingungen.