OPEN-SOURCE SCRIPT
ATR ZigZag Breakout

ATR ZigZag Breakout
This strategy uses my ATR ZigZag indicator (powered by the ZigZagCore library) to scalp breakouts at volatility-filtered highs and lows.
Everyone knows stops cluster around clear swing highs and lows. Breakout traders often pile in there, too. These levels are predictable areas where aggressive orders hit the tape. The idea here is simple:
→ Let ATR ZigZag define clean, volatility-filtered pivots
→ Arm a stop market order at those pivots
→ Join the breakout when the crowd hits the level
The key to greater success in this simple strategy lies in the ZigZag. Because the pivots are filtered by ATR instead of fixed bar counts or fractals, the levels tend to be more meaningful and less noisy.
This approach is especially suited for intraday trading on volatile instruments (e.g., NQ, GC, liquid crypto pairs).
How It Works
1. Pivot detection
The ATR ZigZag uses an ATR-based threshold to confirm swing highs and lows. Only when price has moved far enough in the opposite direction does a pivot become “official.”
2. Candidate breakout level
When a new swing direction is detected and the most recent high/low has not yet been broken in the current leg, the strategy arms a stop market order at that pivot.
• Long candidate → most recent swing high
• Short candidate → most recent swing low
These “candidate trades” are shown as dotted lines.
3. Entry, SL, and TP
If price breaks through the level, the stop order is filled and a bracket is placed:
• Stop loss = ATR × SL multiplier
• Take profit = SL distance × RR multiplier
Once a level has traded, it is not reused in the same swing leg.
4. Cancel & rotate
If the market reverses and forms a new swing in the opposite direction before the level is hit, the pending order is cancelled and a new candidate is considered in the new direction.
Additional Features
• Optional session filter for backtesting specific trading hours
This strategy uses my ATR ZigZag indicator (powered by the ZigZagCore library) to scalp breakouts at volatility-filtered highs and lows.
Everyone knows stops cluster around clear swing highs and lows. Breakout traders often pile in there, too. These levels are predictable areas where aggressive orders hit the tape. The idea here is simple:
→ Let ATR ZigZag define clean, volatility-filtered pivots
→ Arm a stop market order at those pivots
→ Join the breakout when the crowd hits the level
The key to greater success in this simple strategy lies in the ZigZag. Because the pivots are filtered by ATR instead of fixed bar counts or fractals, the levels tend to be more meaningful and less noisy.
This approach is especially suited for intraday trading on volatile instruments (e.g., NQ, GC, liquid crypto pairs).
How It Works
1. Pivot detection
The ATR ZigZag uses an ATR-based threshold to confirm swing highs and lows. Only when price has moved far enough in the opposite direction does a pivot become “official.”
2. Candidate breakout level
When a new swing direction is detected and the most recent high/low has not yet been broken in the current leg, the strategy arms a stop market order at that pivot.
• Long candidate → most recent swing high
• Short candidate → most recent swing low
These “candidate trades” are shown as dotted lines.
3. Entry, SL, and TP
If price breaks through the level, the stop order is filled and a bracket is placed:
• Stop loss = ATR × SL multiplier
• Take profit = SL distance × RR multiplier
Once a level has traded, it is not reused in the same swing leg.
4. Cancel & rotate
If the market reverses and forms a new swing in the opposite direction before the level is hit, the pending order is cancelled and a new candidate is considered in the new direction.
Additional Features
• Optional session filter for backtesting specific trading hours
Skrip open-source
Dengan semangat TradingView yang sesungguhnya, pembuat skrip ini telah menjadikannya sebagai sumber terbuka, sehingga para trader dapat meninjau dan memverifikasi fungsinya. Salut untuk penulisnya! Meskipun Anda dapat menggunakannya secara gratis, perlu diingat bahwa penerbitan ulang kode ini tunduk pada Tata Tertib kami.
Pernyataan Penyangkalan
Informasi dan publikasi ini tidak dimaksudkan, dan bukan merupakan, saran atau rekomendasi keuangan, investasi, trading, atau jenis lainnya yang diberikan atau didukung oleh TradingView. Baca selengkapnya di Ketentuan Penggunaan.
Skrip open-source
Dengan semangat TradingView yang sesungguhnya, pembuat skrip ini telah menjadikannya sebagai sumber terbuka, sehingga para trader dapat meninjau dan memverifikasi fungsinya. Salut untuk penulisnya! Meskipun Anda dapat menggunakannya secara gratis, perlu diingat bahwa penerbitan ulang kode ini tunduk pada Tata Tertib kami.
Pernyataan Penyangkalan
Informasi dan publikasi ini tidak dimaksudkan, dan bukan merupakan, saran atau rekomendasi keuangan, investasi, trading, atau jenis lainnya yang diberikan atau didukung oleh TradingView. Baca selengkapnya di Ketentuan Penggunaan.