Emerging Pattern Detection

An emerging pattern has confirmed X, A, B, C swing points but the D reversal point has not yet formed. The ohlc-service surfaces these early so traders can prepare before the entry zone is reached.

Supported Pattern Types

Emerging detection is supported for 7 patterns:

PatternType
GartleyHarmonic
BatHarmonic
ButterflyHarmonic
CrabHarmonic
SharkHarmonic
CypherHarmonic
ABCDStructure

Three Drives, Double Top/Bottom, and Head & Shoulders are not supported for emerging detection.

Detection Conditions

An emerging signal is emitted when all of the following hold:

  1. X, A, B, C swing points are confirmed and pass the pattern’s ratio rules
  2. No 5th swing point exists after C — D has not formed yet
  3. None of the invalidation conditions below are triggered

Invalidation Conditions

Any of the following kills an emerging signal:

ConditionDescription
Swing point after CD has already confirmed — pattern is complete, not emerging
C level breachedBullish: any post-C candle high > C price; Bearish: any post-C candle low < C price
PRZ blowthroughPrice entered the PRZ, then ≥ PRZ_SETTLEMENT_CANDLES (5) candles passed without a reversal — price blew through

PRZ Projection

Each pattern projects where D should land using its standard Fibonacci target. The projected PRZ is a ±0.3% band around the projected D price.

For ABCD patterns, the Strategy’s abcdPrzEntry field controls which edge of the PRZ is used as the limit-order price when entryStrategy = 'emerging_prz': '1.272' targets the near edge (default, aligns with backtest), '1.618' targets the far edge. All other patterns use the PRZ midpoint. See ABCD Pattern — Emerging PRZ Entry.

The current price must still be moving toward the PRZ:

  • Bullish: current price < C price
  • Bearish: current price > C price

Pre-calculated Levels

Even before D forms, the emerging signal includes projected SL and TP1 levels via calculateSlTp() called with the projected D as dPrice. This allows the UI to display the trade setup in advance.

D+0 Validation

An emerging pattern becomes a validated D+0 pattern — rendered as a complete pattern on the chart — when either of these events fires:

EventTrigger
ohlc:pattern:prz_touchA candle’s wick enters the PRZ band
ohlc:pattern:candle_close_przA candle closes inside the PRZ band

On the backend (detectAndBroadcastEmergingImpl), both event types:

  • run przTouchWatcher.check() before the emerging broadcast, so a validated pattern is never re-emitted as still-emerging on that tick
  • add the pattern key to completedKeys, which filters it from the ohlc:pattern:emerging broadcast
  • call saveEmergingAsDone to persist the D+0 pattern to the database (deduplicated by key; onConflictDoNothing guards the DB)

On the frontend (useOhlcAlerts.ts), both events share the same handlePrzValidation handler, which dispatches addD0Pattern to promote the pattern from the emerging overlay to the complete-pattern layer (d0Patterns in Redux).

Why wick touch is enough: Patterns with a narrow PRZ (e.g. Cypher at ~5 pips) may never produce a full candle close inside the zone. A wick touch confirms price reached the reversal zone — which is the entry signal.