Engulfing Quality Score
- 指标
- 版本: 1.0
- 激活: 5
# Engulfing Quality Score - Not all engulfings are equal
*Category: Pattern Recognition | Difficulty: intermediate | Window: chart window (overlaid on price) | Markets: Universal (Forex, indices, commodities, crypto, stocks) | Suggested timeframes: M15, M30, H1, H4, D1*
## Short description
> Checks the engulfing pattern and scores it on four additional criteria, flagging only those exceeding the quality threshold.
## Full description
### Overview
The engulfing pattern is among the best known and also the most abused: on any chart you find dozens, and most produce no movement. The reason is that the classic definition only requires one candle body to contain the previous one, a condition that occurs by chance very often, especially when the previous candle has a tiny body. This indicator checks the base condition and then assigns a quality score on four additional criteria: how wide the engulfing body is in ATR terms, the ratio between the two bodies, how close the candle closes to its own extreme, and whether the pattern arrives after a counter move that gives it meaning. Only patterns exceeding the threshold are flagged, and the score stays readable so you can see which criteria were met.
### How the calculation works
1. The base condition requires the two candles to have opposite directions and the second body to contain the first.
2. First criterion: the engulfing body must exceed InpMinBodyAtr times the ATR, excluding patterns formed by tiny candles.
3. Second criterion: the ratio between the two bodies must exceed InpMinRatio, that is the engulfing must be clear rather than marginal.
4. Third criterion: the close must sit near its own extreme, a sign the direction held to the end of the bar.
5. Fourth criterion: the move of the preceding bars must be opposite to the pattern, otherwise there is nothing to reverse.
6. The score is the sum of criteria met, and the arrow appears only if it reaches InpMinScore.
### How to use it
- Raise InpMinScore to four to accept only patterns meeting every criterion: very few signals, but highly selected.
- The fourth criterion is the most important: an engulfing in the middle of a move in the same direction reverses nothing.
- The score stays readable in the data window even when no arrow appears, useful to see what was missing.
- The natural stop is beyond the extreme of the engulfing candle, the point at which the pattern is formally disproven.
- Comparing the number of signals with a classic detector makes immediately obvious how selective the filter is.
### Who it is for and on which timeframes
It targets traders already using candle patterns who have noticed most do not work. It works from M15 to D1. The value lies not in recognising the pattern, which any free indicator does, but in discarding those lacking the right characteristics. Anyone expecting many signals will be disappointed: with default settings the indicator produces a fraction of what a traditional detector does, and that is exactly the point.
### Practical example of reading a signal
On GBPUSD H4 seven engulfings form in a week according to the classic definition. The indicator flags two. Of the five discarded, three had a body below half an ATR, one arrived in the middle of a move in the same direction and therefore reversed nothing, and one closed mid-range instead of near its extreme. The two flagged had a full score. Over the following days both flagged patterns produce a move in the expected direction, while three of the five discarded are immediately negated by price.
## Input parameters
| Parameter | Default | Description |
|---|---|---|
| `InpAtrPeriod` | 30 | Reference ATR period for measuring body size and placing the arrows. |
| `InpMinBodyAtr` | 0.70 | Minimum engulfing candle body, in ATR. It excludes patterns formed by insignificant candles. |
| `InpMinRatio` | 1.30 | Minimum ratio between the two bodies. With 1.30 the engulfing body must be at least thirty per cent larger. |
| `InpMinClosePos` | 0.65 | Minimum close position within its own range, expressed from zero to one. |
| `InpPriorBars` | 5 | Bars over which the preceding move is checked to be opposite to the pattern. |
| `InpMinScore` | 3.0 | Minimum score out of four to flag the pattern. With four, all criteria must be met. |
| `InpArrowShift` | 0.80 | Distance of the arrows from price, in ATR. Purely cosmetic. |
## Advantages / strengths
- It drastically filters the number of signals, the main problem of classic pattern detectors.
- The four criteria are independent and each addresses a different weakness of the traditional definition.
- The score stays readable even for discarded patterns, so you can always see why they were excluded.
- No repaint: the arrow appears on bar close and is never removed.
## Limitations and warnings
- It produces few signals, which can be frustrating for those seeking frequent activity.
- The four criteria carry equal weight, but in practice the fourth is more important than the others.
- The engulfing pattern remains a two bar figure and does not account for the wider structure.
- Seven parameters are many and require some experimentation before finding the right configuration for your instrument.
**No repaint:** values printed on a closed bar are never modified afterwards.
**Disclaimer.** This product is a technical analysis tool, not an automated trading system, and it offers no profit guarantee whatsoever. Financial markets carry the risk of total loss of the invested capital. Past performance is not indicative of future results. Every signal must be confirmed with your own analysis, a money management plan and prior testing on a demo account. The author is not responsible for trading decisions taken on the basis of this indicator.
## Suggested tags / keywords for MQL5
`engulfing`, `candlestick`, `pattern`, `quality filter`, `price action`, `reversal`, `no repaint`, `scoring`
