OPEN-SOURCE SCRIPT
Magnet Zones: Trap Detection & Flow Map [@darshakssc]

This script detects potential bull and bear trap candles—price actions that may appear strong but are likely to reverse—based on:
🔺 Wick structure
📊 Volume spike behavior
💡 RSI confirmation logic
⏳ Signal cooldown filter to reduce false positives
The indicator then plots:
🟥 Red “🚨 Trap” labels above candles showing possible bull traps
🟩 Green “🧲 Trap” labels below candles showing possible bear traps
➖ Horizontal zone lines to mark these trap levels as “magnet zones,” which may act as future support or resistance
🧠 How It Works:
1. Volume Spike Detection
2. The script first checks for unusually high volume (1.5× the average volume over the last 20 candles).
3. Trap Candle Structure
4. A trap is suspected when there is a long wick opposite the direction of the candle body, signaling a failed breakout or price manipulation.
5. RSI Confirmation
6. Bull Traps: RSI must be above 60
7. Bear Traps: RSI must be below 40
✅ This helps validate whether the price was overbought or oversold.
✅ Cooldown Mechanism
✅ After a trap is detected, it waits for 10 bars before allowing another signal—this reduces noise and overfitting.
✅ How to Use It:
1. Apply on any timeframe, especially effective for intraday trading (e.g. 5m, 15m, 1h).
2. Use the trap signals as early warnings to avoid fake breakouts.
3. Combine with your own strategy or trend-following system for confirmation.
4. The trap lines (magnet zones) can be used as dynamic support/resistance levels for future pullbacks or reversals.
⚠️ Important Note:
This script is for educational purposes only and is not financial advice.
Always use traps in combination with your personal discretion, risk management, and other confluence tools.
🔺 Wick structure
📊 Volume spike behavior
💡 RSI confirmation logic
⏳ Signal cooldown filter to reduce false positives
The indicator then plots:
🟥 Red “🚨 Trap” labels above candles showing possible bull traps
🟩 Green “🧲 Trap” labels below candles showing possible bear traps
➖ Horizontal zone lines to mark these trap levels as “magnet zones,” which may act as future support or resistance
🧠 How It Works:
1. Volume Spike Detection
2. The script first checks for unusually high volume (1.5× the average volume over the last 20 candles).
3. Trap Candle Structure
4. A trap is suspected when there is a long wick opposite the direction of the candle body, signaling a failed breakout or price manipulation.
5. RSI Confirmation
6. Bull Traps: RSI must be above 60
7. Bear Traps: RSI must be below 40
✅ This helps validate whether the price was overbought or oversold.
✅ Cooldown Mechanism
✅ After a trap is detected, it waits for 10 bars before allowing another signal—this reduces noise and overfitting.
✅ How to Use It:
1. Apply on any timeframe, especially effective for intraday trading (e.g. 5m, 15m, 1h).
2. Use the trap signals as early warnings to avoid fake breakouts.
3. Combine with your own strategy or trend-following system for confirmation.
4. The trap lines (magnet zones) can be used as dynamic support/resistance levels for future pullbacks or reversals.
⚠️ Important Note:
This script is for educational purposes only and is not financial advice.
Always use traps in combination with your personal discretion, risk management, and other confluence tools.
Script open-source
In pieno spirito TradingView, il creatore di questo script lo ha reso open-source, in modo che i trader possano esaminarlo e verificarne la funzionalità. Complimenti all'autore! Sebbene sia possibile utilizzarlo gratuitamente, ricorda che la ripubblicazione del codice è soggetta al nostro Regolamento.
Declinazione di responsabilità
Le informazioni ed i contenuti pubblicati non costituiscono in alcun modo una sollecitazione ad investire o ad operare nei mercati finanziari. Non sono inoltre fornite o supportate da TradingView. Maggiori dettagli nelle Condizioni d'uso.
Script open-source
In pieno spirito TradingView, il creatore di questo script lo ha reso open-source, in modo che i trader possano esaminarlo e verificarne la funzionalità. Complimenti all'autore! Sebbene sia possibile utilizzarlo gratuitamente, ricorda che la ripubblicazione del codice è soggetta al nostro Regolamento.
Declinazione di responsabilità
Le informazioni ed i contenuti pubblicati non costituiscono in alcun modo una sollecitazione ad investire o ad operare nei mercati finanziari. Non sono inoltre fornite o supportate da TradingView. Maggiori dettagli nelle Condizioni d'uso.