OPEN-SOURCE SCRIPT

SMC BOS Strategy for XAUUSD

1 394
This is a custom-built TradingView strategy that uses Smart Money Concept (SMC) logic to identify high-probability trend continuation and reversal entries based on Break of Structure (BOS) on XAUUSD. It is designed for traders looking to test institutional-style structure breaks with dynamic entry and risk-managed exits.

The strategy detects BOS using swing highs and lows, then enters trades based on price momentum (bullish or bearish candle confirmation). Each trade is automatically managed using a fixed stop loss in pips and a customizable risk-to-reward (RR) ratio. The goal is to backtest how BOS alone can drive clean directional entries, simulating Smart Money precision without repainting or false signals.

🔑 Key Features:
BOS-Based Entry Logic: Enters trades only after a valid break of structure (new higher high or lower low), signaling continuation from a Smart Money shift.

Momentum Filtered Entry: Requires candle confirmation to validate direction (e.g., bullish close after bullish BOS).

Full Backtest Engine: Built using strategy() functions, allowing you to test SL/TP performance and adjust position sizing.

Custom Risk Control: Adjust Stop Loss (in pips) and Target Profit using a flexible RR ratio (e.g. 1:2 or 1:3 setups).

Works Across Timeframes: Optimized for 15m, 1H, and 4H on XAUUSD, but works on any asset that respects structure.

⚙️ Settings:
Swing Sensitivity – Controls how strict pivot highs/lows are

Minimum Bar Spacing – Prevents overtrading after recent BOS

Stop Loss (in pips) – Fixed distance from entry

Risk/Reward Ratio – Multiplies SL for dynamic take-profit

Trade Direction – Supports both long and short with momentum

📊 How It Works:
Detects new structure break (BOS)

Confirms momentum with candle direction (close > open for long, close < open for short)

Triggers entry and sets TP/SL automatically

Logs results in the Strategy Tester for full backtest evaluation

📌 Optimized For:
XAUUSD (Gold)

Smart Money / SMC / ICT traders

Trend continuation + reversal structures

Backtest-focused strategy building

Institutional-level analysis

📎 Release Notes:
v1.0 – Initial release of BOS-only SMC strategy with full entry/exit simulation and strategy tester support.

⚠️ Disclaimer:
This strategy is built for educational and research purposes only. It is not a signal provider or financial advice. Always combine with your personal confirmation, confluence tools, and 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.