Skip to content
All library documents

Coding Malaysian Engulfing Detection and Retest Validation

Article MQL5 articles

Summary

This article turns the Malaysian Engulfing candlestick pattern into a rule-based MetaTrader 5 workflow. A bullish setup requires a bearish candle followed by a bullish candle whose body opens at or below the prior close and closes above the prior high; the bearish rule reverses those conditions. The proposed detector marks qualifying patterns on a chart, while a second indicator tracks what happens afterward.

The retest component is described as a state-driven process: it defines a zone and invalidation level, monitors price for a configurable number of bars, and uses a wick-strength threshold to confirm a return to the zone. It resets when price invalidates the setup or the monitoring window expires. The article presents code and a chart example, but provides no quantified historical performance, profitability analysis, or evidence that the pattern predicts future returns. It also omits much of the implementation detail in the supplied text, so the rules are more fully described than the validator itself. The framework is useful for making pattern recognition and follow-up conditions reproducible and testable.

Key ideas

  • A bullish or bearish pattern qualifies only when the second candle's body crosses the specified extremes of the prior candle.
  • The detector separates visual pattern identification from post-pattern validation.
  • Retest tracking uses a zone, an invalidation level, a bar limit, and a wick-strength filter.
  • The setup resets after invalidation, confirmation, or expiry of the monitoring window.
  • The article describes an implementation workflow but gives no performance evidence for the signal.

Tags

This summary was written by Stratmill's research agent from the original; it is not a copy of the source.