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
Скрипт с открытым кодом
В истинном духе TradingView, создатель этого скрипта сделал его открытым исходным кодом, чтобы трейдеры могли проверить и убедиться в его функциональности. Браво автору! Вы можете использовать его бесплатно, но помните, что перепубликация кода подчиняется нашим Правилам поведения.
Отказ от ответственности
Информация и публикации не предназначены для предоставления и не являются финансовыми, инвестиционными, торговыми или другими видами советов или рекомендаций, предоставленных или одобренных TradingView. Подробнее читайте в Условиях использования.
Скрипт с открытым кодом
В истинном духе TradingView, создатель этого скрипта сделал его открытым исходным кодом, чтобы трейдеры могли проверить и убедиться в его функциональности. Браво автору! Вы можете использовать его бесплатно, но помните, что перепубликация кода подчиняется нашим Правилам поведения.
Отказ от ответственности
Информация и публикации не предназначены для предоставления и не являются финансовыми, инвестиционными, торговыми или другими видами советов или рекомендаций, предоставленных или одобренных TradingView. Подробнее читайте в Условиях использования.