Dobrusky Price Action Engine

Highlights bars and zones only after liquidity and volatility gates pass, then applies structure rules (swing-aware reversals, wick/body caps) and draws objective multi-timeframe levels and a daily gap state. Built for liquid indices, ETFs, and futures (ES, NQ, SPY, QQQ).
Why this is an Engine (not a mashup)
Components are coupled through a short-circuited flow: upstream gates decide whether downstream logic can produce tags, and reversal logic adds location/structure requirements. This coupling changes outputs versus plotting each piece independently.
Signal Flow (ordering and vetoes)
- 1) Volatility Gate — Pass when bar range is at least ATR times the acceptable volatility threshold (defaults: ATR length 14, threshold 0.33). ATR is computed from RTH bars (09:30–16:00 ET) and persisted across non-RTH bars.
- 2) Volume Gate — Pass when volume is at least SMA(volume, 50) times the acceptable volume threshold (defaults: length 50, threshold 0.33).
- 3) Structure — If gates pass, evaluate patterns and swing-aware reversals. Reversal tags require proximity to a recent swing (0–2 bars back) using a tolerance tied to the relevant bar’s range.
- 4) Context — Draw D/W/M/Y levels, pivot bands, and daily gaps (original vs remaining imbalance). Signals do not require these anchors to print, but they provide where-it-matters context.
Computation Overview (definitions & defaults)
- Sessions / ATR — RTH is 09:30–16:00 ET on trading days. ATR length 14 on RTH bars; non-RTH inherits the last RTH ATR value. Default acceptable volatility threshold: 0.33.
- Volume Gate — Volume must be at least SMA(volume, 50) multiplied by acceptable volume threshold (default 0.33).
- Patterns
- Doji: body ≤ range × dojiBodyToTotalRatio (default 0.10).
- Inside bar: high ≤ prior high and low ≥ prior low.
- Hammer: lower-wick ≥ body × hammerBodyToTotalRatio (default 2.0) and upper-wick ≤ range × shortWickToTotalRatio (default 0.15).
- Shooter: symmetrical to hammer.
- Reversal (bull) — green body; close ≥ prior bar midpoint or body ≥ one-half of prior range; upper-wick ≤ range × reversalBarShortWick (default 0.33); swing proximity test required. Bearish symmetrical.
- Swing proximity for reversals — Use the most recent swing low/high up to 2 bars back. Require the open to be within a tolerance of either the swing’s open or price; tolerance equals one-quarter of that bar’s range.
- Volume anomalies — Flags high/low-volume anomalies using current vs prior bar and the volume SMA; shown as “A” overlays for context.
- Chop filter (overlap model) — Marks consolidation when the current high–low range overlaps each of the last M bars by at least the enter threshold (defaults: M=3, enter 0.45). Exit when overlap drops below the exit threshold (default 0.35) with K confirmations (default 2). Optional compression check: average range of the last M+1 bars less than ATR × multiplier (default 0.9). On confirmed exit, the zone trims the last K bars for a crisp terminal edge. The chop zone is visual context only; it does not mute signals.
- Gaps (Daily) — Lookback 200 sessions. Track both original and partial (remaining) bounds; optional partial-fill shrinking. Filter out gaps smaller than 0.1 × ATR(14).
- Levels & pivots — Previous Day/Week/Month High/Low/Close; current opens; D/W/M/Y pivots (PP, R1–R3, S1–S3 using 0.382/0.618/1.0 swing widths). Auto-hide by timeframe via inputs.
What prints (labels)
- H, HI, HA — Hammer, Hammer+Inside, Hammer with volume-anomaly.
- S, SI, SA — Shooter, Shooter+Inside, Shooter with volume-anomaly.
- D, DI, DA — Doji, Doji+Inside, Doji with higher volume.
- I — Inside bar (when not also tagged as reversal/hammer/shooter).
- R, RI — Bullish below bar / Bearish above bar; base and Inside variants.
- A — Contextual volume anomaly (triangle location shows orientation).
How the parts work together (practical effects)
- Volatility and volume gates block low-energy bars before any tag can print.
- Reversal tags require body/midpoint strength, wick balance, and swing proximity, filtering out generic color-change “reversals.”
- Chop boxes quantify consolidation with overlap, compression, and debounced exit; the K-bar trim makes zones cleaner to trade around.
- Daily gaps render remaining imbalance distinct from the original gap, offering clearer context for reading reactions near those bounds.
Repainting & timing
- Pattern decisions use confirmed bar data; no look-ahead.
- RTH ATR updates on RTH bars; non-RTH uses the last RTH value.
- Daily gaps and higher-TF levels update after their respective TF closes; drawing uses a single pass on the last bar with managed IDs for performance.
- Auto-hide settings remove clutter on higher timeframes.
Inputs you control (defaults)
- Volatility gate: atrLength 14; acceptableVolatilityThreshold 0.33
- Volume gate: volumeMetricLength 50; acceptableVolumeThreshold 0.33
- Patterns: hammerBodyToTotalRatio 2.0; shortWickToTotalRatio 0.15; dojiBodyToTotalRatio 0.10; reversalBarShortWick 0.33
- Chop: M 3; enter 0.45; exit 0.35; K 2; useChopCompression true; chopATRMult 0.9
- Gaps: gapLookback 200; usePartialFill false; min size 0.1 × ATR(14)
- Levels: toggle D/W/M/Y sets, pivot bands, and auto-hide thresholds by timeframe
Worked example (ES, 5-minute)
Bar range 5.4; ATR(14, RTH) 6.2 → volatility gate passes (0.33 × ATR ≈ 2.05). Volume 1.1 × SMA(50) → volume gate passes. Prior swing low printed 1 bar ago; distance from open within tolerance (prior bar range ÷ 4). Close ≥ prior midpoint and upper wick ≈ 0.22 × range ≤ 0.33 → Bullish Reversal (R) prints. Nearby context: yesterday’s low and a remaining gap bound.
Originality & closed-source rationale
- RTH-faithful ATR gating conditions all tags, preventing overnight/pre-market dilution of volatility and materially changing when prints can appear.
- Clause-based, swing-aware reversal model demands body/midpoint strength, wick balance, and location within a dynamic tolerance to a true swing.
- Gap state machine distinguishes original vs remaining imbalance with optional partial shrinking and ATR-scaled filtering.
- Chop with overlap, compression, and debounced exit trimming produces measurable consolidation zones rather than ad-hoc ranges.
How to use
- Apply to liquid symbols; keep default gates initially.
- Prioritize R and RI near meaningful context (levels, pivots, remaining gap bounds). H and S gain weight when gates and structure align.
- Stops: bar extremes or opposite gap/level. Targets: next level or other side of a remaining gap.
- Use as context/confirmation, not an auto-trader.
Limitations & notes
- Thin symbols and half-days may distort gates; loosen thresholds or disable RTH dependence if needed.
- Crypto/24×7 markets: consider disabling RTH dependence or raising the volatility threshold.
- Signals can print away from levels; levels and gaps provide context, not a requirement.
Script que requiere invitación
Solo los usuarios autorizados por el autor pueden acceder a este script. Tendrá que solicitar y obtener permiso para utilizarlo. Normalmente se concede previo pago. Para obtener más información, siga las instrucciones del autor o póngase en contacto directamente con adobtrades.
TradingView NO recomienda pagar o utilizar un script a menos que confíe plenamente en su autor y entienda cómo funciona. También puede encontrar alternativas gratuitas de código abierto en nuestros scripts de la comunidad.
Instrucciones del autor
Exención de responsabilidad
Script que requiere invitación
Solo los usuarios autorizados por el autor pueden acceder a este script. Tendrá que solicitar y obtener permiso para utilizarlo. Normalmente se concede previo pago. Para obtener más información, siga las instrucciones del autor o póngase en contacto directamente con adobtrades.
TradingView NO recomienda pagar o utilizar un script a menos que confíe plenamente en su autor y entienda cómo funciona. También puede encontrar alternativas gratuitas de código abierto en nuestros scripts de la comunidad.