OPEN-SOURCE SCRIPT

SMC Liquidity Sweep + OB [Fixed]

183
This is a Smart Money Concept (SMC) backtest-ready strategy built to identify high-probability reversal points using two key institutional principles: liquidity sweep and order block confirmation. Designed specifically for pairs like XAUUSD, this system detects where the market sweeps resting liquidity (e.g., stop hunts above recent highs or below recent lows) and looks for a clean reversal candle (order block) to confirm the trap and trigger precise entries.

Unlike BOS or FVG-based models, this version focuses purely on stop-hunt logic and clean price action to simulate institutional behavior—ideal for Smart Money and ICT-style traders who want clear, non-repainting, high-RR setups.

🔍 How the Strategy Works
Liquidity Sweep Detection
The strategy monitors the chart for price breaking above recent swing highs or below recent swing lows (based on a customizable lookback window). This acts as a trigger for a potential trap or liquidity raid.

Order Block Confirmation
After a sweep is detected, the system waits for a confirming candle — a reversal (engulfing-type) candle that acts as an order block:

For longs: a bullish candle that closes higher than the previous bearish candle’s high

For shorts: a bearish candle that closes lower than the previous bullish candle’s low

Entry & Risk Management
Once confirmation is valid, a market entry is placed:

Stop Loss (SL): A fixed pip distance below/above the entry candle

Take Profit (TP): Calculated based on a user-defined Risk-Reward Ratio (e.g., 1:2, 1:3)

Trades are managed automatically and logged into the Strategy Tester with full visibility

🔧 Strategy Parameters
Setting Description
Stop Loss (Pips) Fixed SL distance from entry to protect capital
Risk/Reward Ratio Dynamically calculates TP relative to SL (e.g., RR 2.0 = TP 2x SL)
Liquidity Lookback How many candles back to evaluate swing highs/lows for potential sweeps
Order Block Filter Validates entry only after candle confirmation post-sweep
Direction Filter Supports both long and short signals or one-sided entry filters

📈 Use Case & Optimization
This strategy works best when applied to:

XAUUSD, NAS100, BTCUSD, US30, and high-volatility pairs

Timeframes like 5m, 15m, 1H, where sweeps and reversals are more visible

Traders who follow ICT, SMC, or price action frameworks

Reversal or continuation traders looking for clean execution after liquidity grabs

Because it uses pure price action and logical candle structures, it avoids lag and repainting found in indicator-based systems.

💡 Smart Money Concept Logic Used
Liquidity Grab: Detects stop hunts above recent highs/below lows

Order Block Entry: Entry confirmed only after strong reversal candle at sweep zone

High RR Control: SL and TP customizable to reflect real trading plans

Non-Repainting Structure: All entries are based on confirmed candle closes

📊 Built-in Backtesting Features
Plots trades visually with entry arrows and signal labels

Uses strategy.entry() and strategy.exit() for full testing accuracy

Outputs full performance metrics: win rate, profit factor, drawdown, etc.

All parameters tunable from the settings panel

📎 Release Notes
v1.0

Core SMC strategy with liquidity sweep + OB entry logic

Fully backtestable with fixed SL & dynamic TP

Plots buy/sell signals visually

Optimized for metals, indices, and crypto

⚠️ Disclaimer
This TradingView script is intended for educational and research purposes only. It is not financial advice or a live signal system. Always backtest on your own charts, confirm entries with your personal analysis, and apply strict risk management.

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.