Engulfing Confirmation Signals [algotim]Overview
Engulfing Confirmation Signals is a two-stage price action indicator designed to distinguish basic engulfing candle formations from engulfing setups that receive additional confirmation from market context.
The script does not treat every bullish or bearish engulfing candle as a signal. First, an engulfing candle must satisfy structural requirements and pass a rule-based quality score using trend alignment, relative volume, and ATR expansion. A qualifying engulfing candle then creates a temporary confirmation zone based on its full high-low range.
The second stage waits for price to close beyond that range within a configurable number of bars. This separates the initial pattern from the subsequent breakout confirmation.
Problem Statement
A traditional engulfing detector can produce a large number of signals because the candlestick pattern itself only describes the relationship between the current candle and the previous candle.
This script adds a filtering and confirmation process around that pattern.
Instead of treating the engulfing candle as the final event, the indicator asks two separate questions:
1. Does the engulfing candle have sufficient structural and market-context quality?
2. After qualification, does price subsequently break the engulfing candle's range before the setup expires?
This creates a distinction between a qualified engulfing setup and a confirmed breakout.
Methodology
Stage 1: Engulfing Structure
A bullish engulfing candle must close above its open while the previous candle is bearish.
A bearish engulfing candle must close below its open while the previous candle is bullish.
When full-body engulfing is enabled, the current candle must also open and close beyond the previous candle's corresponding open and close.
The current candle body must be at least the configured multiple of the previous candle's body. The default minimum is 1.05 times the previous candle body.
The pattern is evaluated on the confirmed bar close.
### Stage 2: Quality Score
A qualifying engulfing candle receives a score from three rule-based components.
**Trend alignment - 40 points**
For bullish setups, the close is compared with the configured EMA. A close above the EMA receives the full 40 points. A close within the defined 0.2% proximity band receives 20 points.
For bearish setups, the corresponding relationship is reversed.
**Relative volume - 30 points**
Volume is compared with its simple moving average:
Volume ratio = Current volume / Average volume
The resulting value is converted into a score and capped at 30 points.
This allows the scoring engine to distinguish an engulfing candle occurring with relatively high participation from one occurring on comparatively weak volume.
**ATR expansion - 30 points**
Current ATR is compared with an average of ATR values.
ATR expansion contributes additional points when current volatility is above its ATR baseline, with the contribution capped at 30 points.
The three components are added together. An engulfing candle is accepted only when its total score reaches the user-defined minimum score.
The score is a rule-based filter and should not be interpreted as a probability or expected win rate.
Signal Workflow
Bullish workflow
1. Detect a bullish engulfing candle.
2. Verify the required body relationship with the previous candle.
3. Calculate trend, volume, and ATR components.
4. Add the components into the 0-100 quality score.
5. Ignore the setup if the score is below the minimum threshold.
6. If qualified, create a bullish confirmation zone using the engulfing candle's high and low.
7. Monitor subsequent bars for a close above the engulfing candle high.
8. Generate the confirmed bullish signal when that breakout occurs.
9. Expire the zone if the breakout does not occur within the configured waiting period.
Bearish workflow
1. Detect a bearish engulfing candle.
2. Verify the required body relationship with the previous candle.
3. Calculate trend, volume, and ATR components.
4. Add the components into the 0-100 quality score.
5. Ignore the setup if the score is below the minimum threshold.
6. If qualified, create a bearish confirmation zone using the engulfing candle's high and low.
7. Monitor subsequent bars for a close below the engulfing candle low.
8. Generate the confirmed bearish signal when that breakout occurs.
9. Expire the zone if the breakout does not occur within the configured waiting period.
Why This Indicator Is Different
A conventional engulfing indicator normally stops at identifying the candlestick pattern.
This script uses the engulfing candle as the beginning of a two-stage process.
The first stage evaluates whether the pattern has sufficient contextual support using three measurable conditions: its position relative to an EMA, current volume relative to average volume, and current ATR relative to its ATR baseline.
The second stage does not immediately convert a qualified engulfing candle into a confirmed breakout signal. Instead, the engulfing candle's range becomes a temporary state that is monitored for a subsequent closing breakout.
This distinction is the main purpose of the indicator: the initial engulfing event and the later range break are treated as separate analytical events.
Inputs
Engulfing Detection
**Min Body Size vs Prior Candle**
Controls how large the engulfing candle's body must be relative to the previous candle.
**Require Full Body Engulf**
When enabled, the current candle's open and close must fully engulf the previous candle's body.
Confirmation Engine
**Trend EMA Length**
Sets the EMA used for the trend-alignment component of the score.
**Volume Average Length**
Controls the moving-average baseline used to evaluate relative volume.
**ATR Length**
Controls the ATR calculation used by the volatility component.
**Minimum Quality Score**
Sets the minimum combined score required for an engulfing candle to create a confirmation zone.
Confirmation Zone
**Max Bars to Wait for Confirmation**
Defines how long an active engulfing zone remains valid while waiting for a breakout.
**Extend Zone Box While Active**
Controls whether the active zone visually extends as subsequent bars are processed.
Visual Style
The visual inputs control bullish and bearish colors, zone transparency, Stage 1 markers, and whether the numerical quality score is displayed.
Alerts
The script provides alerts for:
* Qualified bullish engulfing
* Qualified bearish engulfing
* Confirmed bullish breakout
* Confirmed bearish breakout
Qualified alerts identify the first stage of the process. Confirmed breakout alerts identify the second stage.
Practical Usage
The Stage 1 marker can be used to locate engulfing candles that have passed the configured contextual filters.
The Stage 2 confirmation marker can then be used to identify cases where price subsequently closes beyond the qualified engulfing candle's range.
Users can adjust the minimum score to control selectivity. Higher thresholds require stronger combined trend, volume, and volatility conditions and will generally produce fewer qualifying setups.
The confirmation window can also be adjusted depending on how long the user wants an engulfing setup to remain valid.
The indicator is intended for chart analysis and can be evaluated across different instruments and timeframes. Settings should be tested against the characteristics of the market being analyzed.
Limitations
The quality score is a rule-based classification and is not a statistical probability, accuracy percentage, or guarantee of future performance.
Engulfing patterns can fail, and a confirmed range breakout does not guarantee continued price movement.
Volume behavior varies between instruments, particularly where volume data is limited or represents different types of market activity.
EMA, volume, and ATR parameters can produce different results across instruments and timeframes.
Signals are generated from completed bar conditions, but the confirmation process can still produce false breakouts during volatile or ranging conditions.
The indicator does not provide trade management, position sizing, stop-loss, or take-profit recommendations.
Notes
The script is designed as a structured confirmation framework around engulfing price action.
Its output should be interpreted as analytical information rather than a standalone trading decision. Users should evaluate the indicator with their own market context, risk management, and trading methodology.
Chỉ báo






















