Nonparametric Sweep Regime Engine [PhenLabs]

3 523
📊 Nonparametric Sweep Regime Engine [PhenLabs]

Version: PineScript™ v6

📌 Description
The Nonparametric Sweep Regime Engine identifies confirmed raids of buy-side and sell-side liquidity, then asks a more important question: was the event statistically unusual for this market right now?

Instead of relying on fixed volume or wick thresholds, NSRE ranks participation, wick extremity, reclaim quality, and trend expansion against their own rolling distributions. Only sweeps that pass the score, volume, candle, and regime gates produce a signal.

Each confirmed setup includes a compact live dashboard, a buffered invalidation level, and two risk-normalized target projections. This keeps the chart interpretation simple while the underlying thresholds adapt across symbols and timeframes.

🚀 Points of Innovation
  • Nonparametric percentile ranks replace brittle fixed volume and wick thresholds
  • Liquidity sweeps are scored by participation, wick extremity, and closing reclaim
  • A trend-expansion gate avoids fading statistically extreme directional conditions
  • Confirmed pivots create objective buy-side and sell-side liquidity references
  • Targets adapt to setup risk and use opposing liquidity when it offers a valid objective
  • A single 0–100 score compresses multiple confirmation layers into a readable decision aid


🔧 Core Components
  • Liquidity Pivot Engine: confirms swing highs and lows, extends active liquidity levels, and retires them after a raid
  • Percentile Rank Engine: ranks volume, directional wick size, and EMA-spread expansion over a rolling sample
  • Sweep Confirmation Gate: requires a close back through the raided level plus configurable score, volume, candle, and regime conditions
  • Projection Engine: places an ATR-buffered stop and two risk-multiple targets, substituting opposing liquidity for the extended target when appropriate
  • NSRE Dashboard: displays the latest direction, score, volume rank, trend rank, regime, stop, and targets


🔥 Key Features
  • Adaptive thresholds make the same logic portable across futures, crypto, FX, equities, and indices
  • One-use liquidity states prevent repeated signals from the same pivot
  • Confirmed pivots avoid lookahead in live signal logic
  • Dashed liquidity and invalidation levels keep structure distinct from dotted target projections
  • Independent bullish and bearish alert conditions support automation workflows
  • All calculations use robust NA and zero-division guards


🎨 Visualization
  • Teal triangle: confirmed bullish sell-side liquidity sweep
  • Magenta triangle: confirmed bearish buy-side liquidity sweep
  • Dashed horizontal levels: active liquidity, swept reference, and invalidation
  • Dotted horizontal levels: first and second projected objectives
  • Top-right dashboard: latest signal state, percentile context, regime, and exact projected prices


📖 Usage Guidelines
  • Pivot strength — Default: 5 — Range: 2–20 — Lower values react faster and create more liquidity references; higher values isolate more significant structure
  • ATR length — Default: 14 — Range: 5–100 — Controls volatility normalization and the stop buffer baseline
  • Require directional reclaim candle — Default: true — Requires the sweep bar to close in the intended reversal direction
  • Percentile lookback — Default: 100 — Range: 30–500 — Shorter samples adapt faster; longer samples produce more stable ranks
  • Minimum sweep score — Default: 65 — Range: 50–95 — Raise for fewer, more selective signals
  • Minimum volume percentile — Default: 55 — Range: 0–100 — Sets the minimum relative participation required
  • Maximum trend-expansion percentile — Default: 85 — Range: 40–100 — Lower values reject more countertrend sweeps during expansion
  • Fast EMA — Default: 21 — Range: 2–100 — First component of the normalized trend-expansion metric
  • Slow EMA — Default: 55 — Range: 5–250 — Second component of the normalized trend-expansion metric
  • Stop ATR buffer — Default: 0.15 — Range: 0–2 — Adds volatility-adjusted space beyond the sweep extreme
  • Target 1 risk multiple — Default: 1.0 — Range: 0.5–5 — Controls the first objective relative to setup risk
  • Target 2 risk multiple — Default: 2.0 — Range: 1–10 — Controls the fallback extended objective
  • Projection length — Default: 40 — Range: 10–200 — Sets how far the latest stop and targets extend


✅ Best Use Cases
  • Intraday reversal setups around established swing liquidity
  • Filtering ICT and SMC sweep concepts with adaptive statistical context
  • Comparing signal quality across instruments with different volume and volatility scales
  • Locating risk-defined entries after stop runs in futures, indices, crypto, and FX


⚠️ Limitations
  • Pivot levels require right-side confirmation and therefore appear after the structural turning point
  • Percentile ranks need the selected lookback to warm up before signals can qualify
  • Volume quality depends on the data supplied for the selected market
  • Projected targets are analytical references and do not model slippage, commissions, or order execution


💡 What Makes This Unique
  • Distribution-aware confirmation: every sweep is judged relative to recent market behavior rather than universal constants
  • Regime-sensitive rejection: extreme trend expansion can invalidate an otherwise attractive countertrend sweep
  • Liquidity-aware targeting: the extended objective can snap to opposing confirmed liquidity when that level is structurally valid


🔬 How It Works
  1. Confirmed swing highs and lows become active buy-side and sell-side liquidity references
  2. Price must raid an active level and close back through it to form a raw sweep
  3. The engine percentile-ranks volume, directional wick size, and trend expansion over the rolling sample
  4. Volume, wick, and reclaim inputs produce a composite 0–100 sweep score
  5. The score, participation, directional candle, and regime gates must all pass on the sweep bar
  6. A valid signal projects an ATR-buffered invalidation level and two risk-normalized objectives


💡 Note:
Start with the default settings, then adjust the percentile lookback and minimum score to the instrument’s tempo. Higher-timeframe liquidity can improve context when using NSRE on lower execution timeframes. This tool is an analytical aid, not financial advice.

免責事項

これらの情報および投稿は、TradingViewが提供または承認する金融、投資、取引、またはその他の種類の助言もしくは推奨であることを意図したものではなく、またこれらに該当するものでもありません。詳細は利用規約をご覧ください。