OPEN-SOURCE SCRIPT
Mis à jour ZigZag MT5

ZigZag MT5 — 1:1 Port
A faithful port of the MetaTrader 5 standard ZigZag indicator to Pine Script v6. Same algorithm, same parameters, same output — just on TradingView.
Parameters (MT5 defaults):
Depth (12) — minimum bars between extrema; the lookback window for the Lowest/Highest scan
Deviation (5) — minimum price deviation in points (uses syminfo.mintick) before a new extremum is accepted
Backstep (3) — minimum bars between adjacent pivots; cleans up clustered extrema
How it works:
Mirrors MT5's two-buffer approach (ExtHighBuffer / ExtLowBuffer). For each bar it runs the Lowest/Highest scan, applies the deviation filter, removes weaker neighboring pivots within the backstep window, and finally alternates highs and lows in a second pass — including outside-bar handling.
Note: Like every ZigZag, the last segment repaints until a new opposing pivot is confirmed. By design.
Useful as a drop-in replacement if you're migrating strategies from MT5 to TradingView and need pivot points that match exactly.
A faithful port of the MetaTrader 5 standard ZigZag indicator to Pine Script v6. Same algorithm, same parameters, same output — just on TradingView.
Parameters (MT5 defaults):
Depth (12) — minimum bars between extrema; the lookback window for the Lowest/Highest scan
Deviation (5) — minimum price deviation in points (uses syminfo.mintick) before a new extremum is accepted
Backstep (3) — minimum bars between adjacent pivots; cleans up clustered extrema
How it works:
Mirrors MT5's two-buffer approach (ExtHighBuffer / ExtLowBuffer). For each bar it runs the Lowest/Highest scan, applies the deviation filter, removes weaker neighboring pivots within the backstep window, and finally alternates highs and lows in a second pass — including outside-bar handling.
Note: Like every ZigZag, the last segment repaints until a new opposing pivot is confirmed. By design.
Useful as a drop-in replacement if you're migrating strategies from MT5 to TradingView and need pivot points that match exactly.
Notes de version
- fine tune to match exact algo in mt5Script open-source
Dans l'esprit TradingView, le créateur de ce script l'a rendu open source afin que les traders puissent examiner et vérifier ses fonctionnalités. Bravo à l'auteur! Bien que vous puissiez l'utiliser gratuitement, n'oubliez pas que la republication du code est soumise à nos Règles.
Clause de non-responsabilité
Les informations et publications ne sont pas destinées à être, et ne constituent pas, des conseils ou recommandations financiers, d'investissement, de trading ou autres fournis ou approuvés par TradingView. Pour en savoir plus, consultez les Conditions d'utilisation.
Script open-source
Dans l'esprit TradingView, le créateur de ce script l'a rendu open source afin que les traders puissent examiner et vérifier ses fonctionnalités. Bravo à l'auteur! Bien que vous puissiez l'utiliser gratuitement, n'oubliez pas que la republication du code est soumise à nos Règles.
Clause de non-responsabilité
Les informations et publications ne sont pas destinées à être, et ne constituent pas, des conseils ou recommandations financiers, d'investissement, de trading ou autres fournis ou approuvés par TradingView. Pour en savoir plus, consultez les Conditions d'utilisation.