OPEN-SOURCE SCRIPT
XAUUSD Smart Money Sweep Strategy

This is a custom-built Smart Money Concept (SMC) strategy for XAUUSD that detects liquidity sweeps at key swing levels and confirms entries using momentum-based reversal candles. It simulates institutional behavior by entering trades only when price grabs liquidity (stop hunts above highs or below lows), then shows strong rejection in the opposite direction.
The strategy uses precise entry logic, fixed stop loss, and a customizable risk-to-reward ratio for dynamic take-profit targeting. All trades are fully backtestable using TradingView’s built-in strategy() functions.
This approach is ideal for Smart Money traders looking to exploit price inefficiencies without relying on BOS or FVG logic.
🔑 Key Features:
Liquidity Sweep Logic: Detects price sweeping above recent highs or below recent lows, simulating stop hunts and liquidity grabs.
Candle Confirmation Filter: Confirms entry only if a strong reversal candle (momentum shift) forms after the sweep, avoiding weak entries.
Full Backtest Engine: Uses TradingView's strategy.entry() and strategy.exit() to simulate trades with real SL/TP tracking.
Custom Risk Management: Adjustable stop loss (in pips) and risk-to-reward (RR) ratio allow you to shape trade outcomes and optimize strategy performance.
Non-Repainting Logic: All entries are based on closed candles, meaning the signals never repaint and are reliable for testing and execution.
⚙️ Settings:
Setting Description
Liquidity Lookback Number of candles to look back for swing highs/lows to determine sweeps
Stop Loss (pips) Distance below/above entry where SL is placed (fixed pip SL)
Risk/Reward Ratio Multiplies SL to calculate TP (e.g., 1:2 = 2x SL as TP)
Entry Logic Requires sweep + a momentum candle (e.g., bullish close after a sweep down)
📊 How It Works:
The strategy scans recent price action using a lookback range to find the highest high and lowest low (liquidity zones).
If price sweeps above the high or below the low, this triggers a potential entry condition.
A momentum candle confirmation must follow immediately:
For long trades: bullish candle (close > open, and close > previous close)
For short trades: bearish candle (close < open, and close < previous close)
If confirmed, the strategy:
Enters the trade
Places a fixed stop loss in pips
Sets a dynamic TP using the RR ratio
All trades are logged and visualized in the Strategy Tester panel for performance review.
📌 Optimized For:
XAUUSD (Gold) on 15m, 30m, and 1H timeframes
Smart Money / ICT / Liquidity-based trading styles
Traders who prefer reversal setups after liquidity raids
Systems focused on precise execution and high-RR setups
📎 Release Notes:
v1.0 – First release featuring liquidity sweep detection, candle confirmation logic, SL/TP execution, and Strategy Tester support. Clean structure designed for real-world backtesting on volatile instruments like gold.
⚠️ Disclaimer:
This script is for educational and research purposes only. It does not constitute financial advice or signal services. Always validate strategy results with manual backtesting and apply proper risk management.
The strategy uses precise entry logic, fixed stop loss, and a customizable risk-to-reward ratio for dynamic take-profit targeting. All trades are fully backtestable using TradingView’s built-in strategy() functions.
This approach is ideal for Smart Money traders looking to exploit price inefficiencies without relying on BOS or FVG logic.
🔑 Key Features:
Liquidity Sweep Logic: Detects price sweeping above recent highs or below recent lows, simulating stop hunts and liquidity grabs.
Candle Confirmation Filter: Confirms entry only if a strong reversal candle (momentum shift) forms after the sweep, avoiding weak entries.
Full Backtest Engine: Uses TradingView's strategy.entry() and strategy.exit() to simulate trades with real SL/TP tracking.
Custom Risk Management: Adjustable stop loss (in pips) and risk-to-reward (RR) ratio allow you to shape trade outcomes and optimize strategy performance.
Non-Repainting Logic: All entries are based on closed candles, meaning the signals never repaint and are reliable for testing and execution.
⚙️ Settings:
Setting Description
Liquidity Lookback Number of candles to look back for swing highs/lows to determine sweeps
Stop Loss (pips) Distance below/above entry where SL is placed (fixed pip SL)
Risk/Reward Ratio Multiplies SL to calculate TP (e.g., 1:2 = 2x SL as TP)
Entry Logic Requires sweep + a momentum candle (e.g., bullish close after a sweep down)
📊 How It Works:
The strategy scans recent price action using a lookback range to find the highest high and lowest low (liquidity zones).
If price sweeps above the high or below the low, this triggers a potential entry condition.
A momentum candle confirmation must follow immediately:
For long trades: bullish candle (close > open, and close > previous close)
For short trades: bearish candle (close < open, and close < previous close)
If confirmed, the strategy:
Enters the trade
Places a fixed stop loss in pips
Sets a dynamic TP using the RR ratio
All trades are logged and visualized in the Strategy Tester panel for performance review.
📌 Optimized For:
XAUUSD (Gold) on 15m, 30m, and 1H timeframes
Smart Money / ICT / Liquidity-based trading styles
Traders who prefer reversal setups after liquidity raids
Systems focused on precise execution and high-RR setups
📎 Release Notes:
v1.0 – First release featuring liquidity sweep detection, candle confirmation logic, SL/TP execution, and Strategy Tester support. Clean structure designed for real-world backtesting on volatile instruments like gold.
⚠️ Disclaimer:
This script is for educational and research purposes only. It does not constitute financial advice or signal services. Always validate strategy results with manual backtesting and apply proper risk management.
Open-source script
In true TradingView spirit, the creator of this script has made it open-source, so that traders can review and verify its functionality. Kudos to the author! While you can use it for free, remember that republishing the code is subject to our House Rules.
✅JOIN FREE SIGNALS t.me/frankfxforextrade
✅ AUTOMATED BOT: bot.frankfxx.com
✅AI CRYPTO SIGNAL:crypto.frankfxx.com
✅STORE:selar.com/m/ukwuezefrankfx
✅AI GOLD INDICES AND FOREX SIGNALS
trade.frankfxx.com
✅ AUTOMATED BOT: bot.frankfxx.com
✅AI CRYPTO SIGNAL:crypto.frankfxx.com
✅STORE:selar.com/m/ukwuezefrankfx
✅AI GOLD INDICES AND FOREX SIGNALS
trade.frankfxx.com
Disclaimer
The information and publications are not meant to be, and do not constitute, financial, investment, trading, or other types of advice or recommendations supplied or endorsed by TradingView. Read more in the Terms of Use.
Open-source script
In true TradingView spirit, the creator of this script has made it open-source, so that traders can review and verify its functionality. Kudos to the author! While you can use it for free, remember that republishing the code is subject to our House Rules.
✅JOIN FREE SIGNALS t.me/frankfxforextrade
✅ AUTOMATED BOT: bot.frankfxx.com
✅AI CRYPTO SIGNAL:crypto.frankfxx.com
✅STORE:selar.com/m/ukwuezefrankfx
✅AI GOLD INDICES AND FOREX SIGNALS
trade.frankfxx.com
✅ AUTOMATED BOT: bot.frankfxx.com
✅AI CRYPTO SIGNAL:crypto.frankfxx.com
✅STORE:selar.com/m/ukwuezefrankfx
✅AI GOLD INDICES AND FOREX SIGNALS
trade.frankfxx.com
Disclaimer
The information and publications are not meant to be, and do not constitute, financial, investment, trading, or other types of advice or recommendations supplied or endorsed by TradingView. Read more in the Terms of Use.