
🎯 “Hunting Ambush” — Catch the Trap Before It Springs! 🎯
Predictive Pattern Detection for High-Probability Reversals in MT4
🔍 Overview
"Hunting Ambush" is a MetaTrader 4 (MT4) custom indicator developed by R.KH that identifies potential reversal patterns using a multi-level ZigZag algorithm. This tool draws triangles based on nested ZigZag levels and visually marks ambush zones for buy or sell setups—places where smart money may trigger price reversals.
This indicator is best suited for traders seeking:
High-probability entry signals
Geometric patterns formed by market structure
Confirmation tools for support/resistance zones
🛠️ How It Works
At its core, Hunting Ambush relies on two ZigZag levels (Level 1 and Level 3), with each detecting different structural points based on different depths (Period1, Period3).
Steps:
Detects ZigZag highs/lows:
Level 1 = Short-term swings
Level 3 = Longer-term structure
Scans for nested patterns: When a Level 3 high/low is confirmed, the algorithm looks backward for two more Level 1 confirmations to form a triangle (price pattern).
Draws triangle shapes connecting these 3 points.
Plots arrows (Buy/Sell markers) at the third point for possible entry zones.
Optional alerts can be triggered when patterns form.
⚙️ Input Parameters
Input NameTypeDescription
ShowSemaforsboolShow ZigZag semafor dots/arrows
ShowTrianglesboolShow triangle pattern structures
FillUpboolFill triangles with background color
ShowMarksboolShow directional arrows at signal points
ShowAlertboolAlert when Level 3 high/low forms
ShowAlertTrboolAlert when full triangle pattern forms
Period1doubleZigZag depth for Level 1
Period3doubleZigZag depth for Level 3
Width1, Width3intLine width for ZigZag Level 1 / Level 3
BarsCountintNumber of historical bars to check
BuyTrianglecolorTriangle color for Buy setup
SellTrianglecolorTriangle color for Sell setup
BuyMarkcolorArrow color for Buy signal
SellMarkcolorArrow color for Sell signal
DATA1intMax pip distance allowed between pattern legs (filters noise)
Dev, StpintDeviation and backstep for ZigZag filtering
SYM1, SYM3intArrow symbol codes for ZigZag 1 & 3
🖼️ Visual Elements on Chart
ZigZag Lines (optional): If ShowSemafors = true
Triangles: Drawn when pattern is found (up to 3 historical bars)
Buy/Sell Arrows: Drawn after triangle formation
Alerts: Popup when enabled
🧠 Logic Behind the Pattern
Buy Setup:
Level 3 Low (point A)
Previous Level 1 High (point B)
Previous Level 1 Low (point C)
Pattern drawn A → B → C
Arrow plotted at C
Sell Setup:
Level 3 High (point A)
Previous Level 1 Low (point B)
Previous Level 1 High (point C)
Pattern drawn A → B → C
Arrow plotted at C
Triangle must stay within the range defined by DATA1 (converted to points). If conditions are met, alert is optionally triggered.
🧽 Cleanup Functionality
Whenever new data comes in, the chart is cleaned:
All previously drawn triangles and arrows are deleted
Ensures chart remains up-to-date and not cluttered
✅ Benefits
Predictive setup rather than reactive signal
Visually clean, even with complex logic
Highly customizable
Works well as a confirmation tool with trend indicators or support/resistance
📢 Pro Tip:
Use this indicator on H1 or H4 timeframes for swing trading. Combine with a trend filter (like EMA or RSI) to reduce false signals.
👨💻 Developer & Credits
Developer: R.KH
Version: 1.00
Website: www.robomql.com
Year: 2025