OPEN-SOURCE SCRIPT
Gold Trap Hunter (Auto-Structure & Liquidity Sweeps)

The Concept: Stop Getting Trapped Have you ever bought a breakout, only to watch the price immediately reverse and hit your stop loss? This is called a Liquidity Trap (or "Sweep"). Institutional algorithms often push price slightly above a key High or below a key Low to trigger retail stop losses before moving the market in the real direction.
The Universal Trap Hunter is designed to visualize this market structure automatically. It helps you avoid "Fake Breakouts" and identifies high-probability Reversal points where the "Smart Money" is active.
How It Works (The Logic)
1. The Structure Boxes (The Battlefield) The indicator draws a shaded box representing the Higher Timeframe Structure.
Green Box: The market structure is Bullish (Making Higher Highs). We are looking for longs.
Red Box: The market structure is Bearish (Making Lower Lows). We are looking for shorts.
Feature: This is Universal. If you are on the 15-minute chart, it automatically calculates the 4-Hour structure for you. You are always trading with the bigger trend.
2. The "SWEEP" Signal (The Entry Trigger) A "Sweep" is the most powerful signal in this system.
What is it? Price breaks a previous structure High/Low but fails to close there. It grabs the liquidity and reverses.
⚔️ Green Sweep: Price broke the previous Low (trapping sellers), then closed back UP inside the range. This is a bullish reversal signal.
⚔️ Red Sweep: Price broke the previous High (trapping buyers), then closed back DOWN inside the range. This is a bearish reversal signal.
3. The Noise Filter (Gray Candles) Trading is about knowing when NOT to trade.
Gray Candles: These indicate "Noise." The price action is choppy or conflicting with the trend.
Colored Candles: The candles only turn Green or Red when the Trend, Momentum, and Structure all align. If you see color, the move is valid.
Settings & Customization
Structure Mode (Auto vs Manual):
Auto (Recommended): The script automatically selects the best Higher Timeframe for you.
Scalping 1m? → It looks at 1H Structure.
Trading 15m? → It looks at 4H Structure.
Manual: You can lock it to a specific timeframe (e.g., always show Daily structure).
Colors: Fully customizable to fit your dark/light theme.
How to Trade This Strategy
Identify the Trend: Look at the background Box color (Green = Bullish, Red = Bearish).
Wait for the Trap: Do not chase the price. Wait for price to challenge the edge of the box.
The Signal: Look for the "⚔️ SWEEP" label.
If the box is Green and you see a Green Sweep at the bottom: Strong Buy.
If the box is Red and you see a Red Sweep at the top: Strong Sell.
Disclaimer: This tool is for educational purposes and market analysis only. It helps visualize market structure and liquidity traps but does not guarantee future results. Always manage your risk.
The Universal Trap Hunter is designed to visualize this market structure automatically. It helps you avoid "Fake Breakouts" and identifies high-probability Reversal points where the "Smart Money" is active.
How It Works (The Logic)
1. The Structure Boxes (The Battlefield) The indicator draws a shaded box representing the Higher Timeframe Structure.
Green Box: The market structure is Bullish (Making Higher Highs). We are looking for longs.
Red Box: The market structure is Bearish (Making Lower Lows). We are looking for shorts.
Feature: This is Universal. If you are on the 15-minute chart, it automatically calculates the 4-Hour structure for you. You are always trading with the bigger trend.
2. The "SWEEP" Signal (The Entry Trigger) A "Sweep" is the most powerful signal in this system.
What is it? Price breaks a previous structure High/Low but fails to close there. It grabs the liquidity and reverses.
⚔️ Green Sweep: Price broke the previous Low (trapping sellers), then closed back UP inside the range. This is a bullish reversal signal.
⚔️ Red Sweep: Price broke the previous High (trapping buyers), then closed back DOWN inside the range. This is a bearish reversal signal.
3. The Noise Filter (Gray Candles) Trading is about knowing when NOT to trade.
Gray Candles: These indicate "Noise." The price action is choppy or conflicting with the trend.
Colored Candles: The candles only turn Green or Red when the Trend, Momentum, and Structure all align. If you see color, the move is valid.
Settings & Customization
Structure Mode (Auto vs Manual):
Auto (Recommended): The script automatically selects the best Higher Timeframe for you.
Scalping 1m? → It looks at 1H Structure.
Trading 15m? → It looks at 4H Structure.
Manual: You can lock it to a specific timeframe (e.g., always show Daily structure).
Colors: Fully customizable to fit your dark/light theme.
How to Trade This Strategy
Identify the Trend: Look at the background Box color (Green = Bullish, Red = Bearish).
Wait for the Trap: Do not chase the price. Wait for price to challenge the edge of the box.
The Signal: Look for the "⚔️ SWEEP" label.
If the box is Green and you see a Green Sweep at the bottom: Strong Buy.
If the box is Red and you see a Red Sweep at the top: Strong Sell.
Disclaimer: This tool is for educational purposes and market analysis only. It helps visualize market structure and liquidity traps but does not guarantee future results. Always manage your risk.
Script open-source
Dans l'esprit TradingView, le créateur de ce script l'a rendu open source afin que les traders puissent examiner et vérifier ses fonctionnalités. Bravo à l'auteur! Bien que vous puissiez l'utiliser gratuitement, n'oubliez pas que la republication du code est soumise à nos Règles.
Clause de non-responsabilité
Les informations et publications ne sont pas destinées à être, et ne constituent pas, des conseils ou recommandations financiers, d'investissement, de trading ou autres fournis ou approuvés par TradingView. Pour en savoir plus, consultez les Conditions d'utilisation.
Script open-source
Dans l'esprit TradingView, le créateur de ce script l'a rendu open source afin que les traders puissent examiner et vérifier ses fonctionnalités. Bravo à l'auteur! Bien que vous puissiez l'utiliser gratuitement, n'oubliez pas que la republication du code est soumise à nos Règles.
Clause de non-responsabilité
Les informations et publications ne sont pas destinées à être, et ne constituent pas, des conseils ou recommandations financiers, d'investissement, de trading ou autres fournis ou approuvés par TradingView. Pour en savoir plus, consultez les Conditions d'utilisation.