OPEN-SOURCE SCRIPT
Real Time Swing Trap Detector

The Real Time Swing Trap Detector is a minimalist, pro-grade tool for instantly spotting classic “bull traps” and “bear traps” on any chart.
This indicator identifies swing traps in real time by tracking significant swing highs and lows, then watching for fast, false breakouts (bull traps) and breakdowns (bear traps) within a user-defined window.
How it works:
Detects when price breaks a major swing high/low (using configurable lookback).
If price quickly reclaims the broken level within X bars (trap window), a trap is confirmed and a subtle icon (🐂 for bull, 🐻 for bear) is displayed on the chart—no labels, no clutter.
You can enable/disable alerts for bull/bear traps individually or together, and receive notifications the moment a trap is detected.
Use cases:
Spot and avoid classic market “fakeouts” that trap breakout traders.
Confirm SMC/ICT “Judas swing” setups, or filter for high-probability reversals.
Works on all timeframes and assets: stocks, crypto, forex, indices.
Inputs:
Swing Lookback Bars: How far back to define swing points (default: 50)
Major Swing Filter: Additional filter for only the most significant highs/lows (default: 200)
Trap Bars (Look Ahead): Window in which a trap must be confirmed (default: 10)
Enable Bull/Bear Trap Alerts: Toggle real-time alerts for each trap type.
Visuals:
🐻 icon below bar for bear trap (short squeeze/reversal)
🐂 icon above bar for bull trap (long squeeze/reversal)
How to set up alerts:
Add the indicator to your chart, open TradingView’s Alerts panel, and choose “Bear Trap Alert,” “Bull Trap Alert,” or “Any Trap Alert” for instant notifications.
This indicator identifies swing traps in real time by tracking significant swing highs and lows, then watching for fast, false breakouts (bull traps) and breakdowns (bear traps) within a user-defined window.
How it works:
Detects when price breaks a major swing high/low (using configurable lookback).
If price quickly reclaims the broken level within X bars (trap window), a trap is confirmed and a subtle icon (🐂 for bull, 🐻 for bear) is displayed on the chart—no labels, no clutter.
You can enable/disable alerts for bull/bear traps individually or together, and receive notifications the moment a trap is detected.
Use cases:
Spot and avoid classic market “fakeouts” that trap breakout traders.
Confirm SMC/ICT “Judas swing” setups, or filter for high-probability reversals.
Works on all timeframes and assets: stocks, crypto, forex, indices.
Inputs:
Swing Lookback Bars: How far back to define swing points (default: 50)
Major Swing Filter: Additional filter for only the most significant highs/lows (default: 200)
Trap Bars (Look Ahead): Window in which a trap must be confirmed (default: 10)
Enable Bull/Bear Trap Alerts: Toggle real-time alerts for each trap type.
Visuals:
🐻 icon below bar for bear trap (short squeeze/reversal)
🐂 icon above bar for bull trap (long squeeze/reversal)
How to set up alerts:
Add the indicator to your chart, open TradingView’s Alerts panel, and choose “Bear Trap Alert,” “Bull Trap Alert,” or “Any Trap Alert” for instant notifications.
Açık kaynak kodlu komut dosyası
Gerçek TradingView ruhuna uygun olarak, bu komut dosyasının oluşturucusu bunu açık kaynaklı hale getirmiştir, böylece yatırımcılar betiğin işlevselliğini inceleyip doğrulayabilir. Yazara saygı! Ücretsiz olarak kullanabilirsiniz, ancak kodu yeniden yayınlamanın Site Kurallarımıza tabi olduğunu unutmayın.
Feragatname
Bilgiler ve yayınlar, TradingView tarafından sağlanan veya onaylanan finansal, yatırım, işlem veya diğer türden tavsiye veya tavsiyeler anlamına gelmez ve teşkil etmez. Kullanım Şartları'nda daha fazlasını okuyun.
Açık kaynak kodlu komut dosyası
Gerçek TradingView ruhuna uygun olarak, bu komut dosyasının oluşturucusu bunu açık kaynaklı hale getirmiştir, böylece yatırımcılar betiğin işlevselliğini inceleyip doğrulayabilir. Yazara saygı! Ücretsiz olarak kullanabilirsiniz, ancak kodu yeniden yayınlamanın Site Kurallarımıza tabi olduğunu unutmayın.
Feragatname
Bilgiler ve yayınlar, TradingView tarafından sağlanan veya onaylanan finansal, yatırım, işlem veya diğer türden tavsiye veya tavsiyeler anlamına gelmez ve teşkil etmez. Kullanım Şartları'nda daha fazlasını okuyun.