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:
| Pattern | Type |
|---|---|
| Gartley | Harmonic |
| Bat | Harmonic |
| Butterfly | Harmonic |
| Crab | Harmonic |
| Shark | Harmonic |
| Cypher | Harmonic |
| ABCD | Structure |
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:
- X, A, B, C swing points are confirmed and pass the pattern’s ratio rules
- No 5th swing point exists after C — D has not formed yet
- None of the invalidation conditions below are triggered
Invalidation Conditions
Any of the following kills an emerging signal:
| Condition | Description |
|---|---|
| Swing point after C | D has already confirmed — pattern is complete, not emerging |
| C level breached | Bullish: any post-C candle high > C price; Bearish: any post-C candle low < C price |
| PRZ blowthrough | Price 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:
| Event | Trigger |
|---|---|
ohlc:pattern:prz_touch | A candle’s wick enters the PRZ band |
ohlc:pattern:candle_close_prz | A 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 theohlc:pattern:emergingbroadcast - call
saveEmergingAsDoneto persist the D+0 pattern to the database (deduplicated by key;onConflictDoNothingguards 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.