OPEN-SOURCE SCRIPT
Macro Gann Swing with BOS (P, T & BOS)

Macro Gann Swing & Break of Structure (BOS) [v6]
The Macro Gann Swing & Break of Structure (BOS) indicator maps out true institutional market structure by removing market chop and intraday noise.
Instead of cluttering your screen with dozens of minor pivot points, this script uses a depth-based macro filter to identify significant market turning points (Peaks & Troughs), connect them with clean swing lines, and automatically print Break of Structure (BOS) levels when key structure breaks.
Key Features:
Macro Peak (𝗣) & Trough (𝗧) Detection: Filters out lower highs and higher lows during choppy ranges. You only see major structural highs and lows.
Dynamic ZigZag Swing Lines: Connects confirmed macro peaks and troughs to give you an accurate visual map of market flow.
Automatic Break of Structure (BOS): Triggers a BOS ▲ or BOS ▼ label with a dashed level line the exact moment a candle closes beyond a prior macro Peak or Trough.
Auto-Updating Legs: Swing points and lines dynamically stretch as moves extend, keeping your chart clean and eliminating ghost lines.
Fully Customizable: Easily adjust lookback sensitivity, toggle swing lines on/off, or change colors to fit your dark or light chart themes.
How to Read the Indicator :
Uptrend Structure: Characterized by a sequence of Higher Peaks (𝗣) and Higher Troughs (𝗧).
Downtrend Structure: Characterized by a sequence of Lower Peaks (𝗣) and Lower Troughs (𝗧).
Bullish BOS : Triggered when price closes above the active macro Peak (𝗣), signaling trend continuation or a bullish shift.
Bearish BOS : Triggered when price closes below the active macro Trough (𝗧), signaling trend continuation or a bearish shift.
How to Tune the Settings
Macro Swing Depth (Bar Lookback)
Higher Values (20–30): Best for zoomed-out views and higher timeframes. Completely wipes out market noise and leaves only macro structure.
Lower Values (10–15): Best for scalping or lower timeframes (1m–5m) where you want to catch smaller intraday swing legs.
ideal for :
Smart Money Concepts (SMC) & ICT Traders looking for clean market structure mapping.
Price Action & Trend Traders who want to trade breaks of structure without chart clutter.
Breakout Traders looking for clear confirmation of structural continuation.
The Macro Gann Swing & Break of Structure (BOS) indicator maps out true institutional market structure by removing market chop and intraday noise.
Instead of cluttering your screen with dozens of minor pivot points, this script uses a depth-based macro filter to identify significant market turning points (Peaks & Troughs), connect them with clean swing lines, and automatically print Break of Structure (BOS) levels when key structure breaks.
Key Features:
Macro Peak (𝗣) & Trough (𝗧) Detection: Filters out lower highs and higher lows during choppy ranges. You only see major structural highs and lows.
Dynamic ZigZag Swing Lines: Connects confirmed macro peaks and troughs to give you an accurate visual map of market flow.
Automatic Break of Structure (BOS): Triggers a BOS ▲ or BOS ▼ label with a dashed level line the exact moment a candle closes beyond a prior macro Peak or Trough.
Auto-Updating Legs: Swing points and lines dynamically stretch as moves extend, keeping your chart clean and eliminating ghost lines.
Fully Customizable: Easily adjust lookback sensitivity, toggle swing lines on/off, or change colors to fit your dark or light chart themes.
How to Read the Indicator :
Uptrend Structure: Characterized by a sequence of Higher Peaks (𝗣) and Higher Troughs (𝗧).
Downtrend Structure: Characterized by a sequence of Lower Peaks (𝗣) and Lower Troughs (𝗧).
Bullish BOS : Triggered when price closes above the active macro Peak (𝗣), signaling trend continuation or a bullish shift.
Bearish BOS : Triggered when price closes below the active macro Trough (𝗧), signaling trend continuation or a bearish shift.
How to Tune the Settings
Macro Swing Depth (Bar Lookback)
Higher Values (20–30): Best for zoomed-out views and higher timeframes. Completely wipes out market noise and leaves only macro structure.
Lower Values (10–15): Best for scalping or lower timeframes (1m–5m) where you want to catch smaller intraday swing legs.
ideal for :
Smart Money Concepts (SMC) & ICT Traders looking for clean market structure mapping.
Price Action & Trend Traders who want to trade breaks of structure without chart clutter.
Breakout Traders looking for clear confirmation of structural continuation.
オープンソーススクリプト
TradingViewの精神に則り、このスクリプトの作者はコードをオープンソースとして公開してくれました。トレーダーが内容を確認・検証できるようにという配慮です。作者に拍手を送りましょう!無料で利用できますが、コードの再公開はハウスルールに従う必要があります。
免責事項
これらの情報および投稿は、TradingViewが提供または承認する金融、投資、取引、またはその他の種類の助言もしくは推奨であることを意図したものではなく、またこれらに該当するものでもありません。詳細は利用規約をご覧ください。
オープンソーススクリプト
TradingViewの精神に則り、このスクリプトの作者はコードをオープンソースとして公開してくれました。トレーダーが内容を確認・検証できるようにという配慮です。作者に拍手を送りましょう!無料で利用できますが、コードの再公開はハウスルールに従う必要があります。
免責事項
これらの情報および投稿は、TradingViewが提供または承認する金融、投資、取引、またはその他の種類の助言もしくは推奨であることを意図したものではなく、またこれらに該当するものでもありません。詳細は利用規約をご覧ください。