ZigAndZagScalpel — Dual ZigZag Swing Detection Indicator for MT4 (with Source Code)

The ZigAndZagScalpel.mq4 is an advanced version of the classic ZigZag concept, combining deep price structure analysis with multi-stage filtering to highlight turning points, retracements, and potential buy/sell moments.

🔍 What the ZigAndZagScalpel Indicator Does

The ZigAndZagScalpel identifies important highs and lows (“Zigs” and “Zags”) using two separate sensitivity settings:

  • Slalom – short-term swing detection for micro-waves.
  • KeelOver – higher-level trend anchor for major turns.

⚙️ How It Works

The script goes through three “Crusades” — or processing passes — to clean, analyze, and construct the final trading signals:

  1. First Crusade:
    Scans historical bars to detect possible Slalom and KeelOver turning points. Each wave is validated to remove false or duplicate highs/lows within a small Backstep window.
  2. Second Crusade:
    Cleans redundant signals by comparing consecutive swing points. Only the most relevant highs/lows remain, ensuring a clean, reliable ZigZag path.
  3. Third Crusade:
    Builds the final trend line and places order signals:
    • Buy (Aqua/White arrows) appear when price aligns with a confirmed upward structure.
    • Sell (Red arrows) appear when downward structure is validated.
    • Limit orders (Black arrows) are used to mark retracement levels or consolidation entries.

Download the Indicator for MT4

You can download both the ready-to-use EX4 file and the editable MQ4 source code for free below.

🧠 Internal Logic Summary

  • Calculates average candle center (called Navel) using 5×Close + 2×Open + High + Low / 9 for balanced price estimation.
  • Keeps track of the last Zig/Zag and overall trend direction (TrendUp boolean).
  • Dynamically adapts to volatility by comparing LimitPoints (Ask–Bid spread).
  • Prevents signal duplication by resetting earlier buffers within the same region.
  • Uses multiple buffers for clarity:
    • KeelOverZigAndZagSECTION — primary trend line.
    • SlalomZigBuffer / SlalomZagBuffer — short-term pivot points.
    • BuyOrdersBuffer / SellOrdersBuffer — trade signal arrows.
    • LimitOrdersBuffer — consolidation markers.

📈 Key Features

  • Dual-scale ZigZag analysis for precision swing detection.
  • Built-in buy/sell/limit arrows for actionable insight.
  • Adjustable KeelOver and Slalom parameters for any timeframe.
  • Multi-pass filtering algorithm to reduce false highs/lows.
  • Works across all MT4 symbols — forex, metals, indices, synthetics.
  • Clean visual output suitable for scalping, wave mapping, or strategy development.

⚙️ Recommended Settings

The ZigAndZagScalpel indicator comes with four key input parameters that you can tune depending on your timeframe and market type.

  • KeelOver — This controls the main ZigZag depth, detecting large-scale or macro wave reversals. A good starting point is 55 on the M15 chart.
  • Slalom — Defines the secondary ZigZag sensitivity used for micro-waves and intraday swings. The default value 17 works well for M15, but you can lower it for scalping or raise it for longer trends.
  • Backstep — Sets the minimum distance between two peaks or troughs. Keeping this around 3 prevents small retracements from being treated as new swing points.
  • LimitPoints — Automatically calculated from the current Ask–Bid spread. It helps the indicator adapt to real-time volatility and avoid false signal clusters.

🧭 How to Install the Indicator

  1. Open MetaTrader 4.
  2. Navigate to File → Open Data Folder.
  3. Open MQL4 → Indicators.
  4. Paste ZigAndZagScalpel.mq4 inside.
  5. Restart MT4 or right-click Navigator → Refresh.
  6. Attach the indicator to any chart.
  7. Adjust KeelOver and Slalom values for your timeframe.
ZigAndZagScalpel

🧪 How to Use

  • Observe the dual ZigZag structure: smaller “Slalom” swings nested inside the larger “KeelOver” waves.
  • Trade with trend direction confirmed by the KeelOver line.
  • Use Buy/Sell arrows as entry hints, confirming with candle formations or support/resistance.
  • The Limit arrows highlight potential pullback levels—use them for scaling in or managing existing trades.
  • Combine with an ATR or volume filter to confirm momentum strength.

✅ Advantages

  • Identifies both micro and macro turning points automatically.
  • Excellent for backtesting or wave-based EA development.
  • Visually clean—no repainting of finalized ZigZag points.
  • Helps anticipate trend reversals and pullbacks.
  • Completely free and open-source.

⚠️ Limitations

  • Extremely short timeframes (M1, M5) can show frequent recalculations.
  • It does not generate automated trade orders—it’s a manual or EA-assist tool.
  • High volatility events may temporarily distort the ZigZag structure.
JustMarkets

🧩 Developer Notes

The author humorously titled its core functions “Crusades” to describe its multi-pass logic—First (build), Second (clean), Third (signal).
Despite the playful code comments, the algorithm performs serious structure detection.
Developers can easily integrate its swing logic into Expert Advisors or automated systems.

Download the Indicator for MT4

You can download both the ready-to-use EX4 file and the editable MQ4 source code for free below.

FAQ — ZigAndZagScalpel Indicator for MT4

Does it repaint?

Once a bar closes, the confirmed ZigZag points remain fixed. However, the latest forming swing may adjust until finalized.

Can it be used for EA development?

Yes. Each buffer can be accessed by an Expert Advisor using `iCustom()` to build automated wave or pullback logic.

Which timeframes are best?

M15–H4 are optimal. For very low timeframes, reduce the `KeelOver`/`Slalom` values; for higher, increase them.

Is this indicator free?

Yes, both EX4 and MQ4 versions are free to download and modify. Attribution to the original author is appreciated.

Disclaimer: This indicator is for educational and analytical purposes only. It does not constitute financial advice or a signal service. Test thoroughly on a demo account before live trading. The authors and publishers are not responsible for financial losses resulting from its use or modification.
Share your love
0 0 votes
Article Rating
Subscribe
Notify of
guest
0 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments