Smart Money Concepts is one of the most analytically demanding styles of trading. Identifying change of character, break of structure, unmitigated order blocks, fair value gaps, liquidity sweeps, and Optimal Trade Entry zones at the 0.618 to 0.79 fib retracement requires watching charts constantly, drawing the structure correctly, and waiting for a confluent setup that might appear once a day. Most discretionary SMC traders miss setups because they aren't at the screen at the right moment, or take the wrong setup because they confuse a BoS with a CHoCH in the heat of the moment. An AI-built SMC bot solves both problems: it watches every candle, applies the rules consistently, and never confuses one structure pattern for another.
This guide walks through how an AI-built Smart Money Concepts trading bot actually works under the hood — the structure detection, the OTE entry logic, the fib retracement math, the unmitigated order block scanning — and shows how you build one in plain English on fomoed. We'll cover each of the seven SMC primitives the AI has access to, walk through a complete CHoCH-and-fib strategy from prompt to running bot, and explain why automated execution tends to outperform discretionary SMC trading even for skilled chartists.
Why SMC Plus AI Is a Force Multiplier
The hard part of Smart Money Concepts trading isn't the theory. The theory is well-documented and most experienced traders can identify a CHoCH or an unmitigated bullish order block on a clean chart. The hard part is the execution: doing it consistently, on the timeframe you said you would, on every pair you said you would, without skipping setups because you weren't watching at the right moment or because the setup formed at 3 a.m. local time.
Two things kill discretionary SMC trading. The first is selection bias — you remember the setups that worked and forget the ones that didn't, which corrupts your view of whether the strategy is actually profitable. The second is execution drift — you start the week intending to trade only A-grade setups, and by Thursday you're entering on B-grade setups because you've been waiting and need to "do something." Automation fixes both. The bot doesn't have an emotional state to drift into, and every trade — winning or losing — gets recorded in the same database, available to review without rose-colored bias.
What changed recently is that you no longer have to write the bot yourself. Detecting a CHoCH algorithmically requires identifying swing highs and swing lows correctly, tracking the structure as HH-HL-LH-LL sequences, and detecting when a close breaks above the most recent lower high (in a bearish trend, signaling a bullish CHoCH). That's a few hundred lines of careful Python. Most retail SMC traders never wrote it; they kept trading discretionarily and hoping they could spot it visually. An AI now writes that detection layer for you — or rather, it composes against a battle-tested SMC library that fomoed’s custom-strategy engine exposes inside the sandbox, so the AI doesn't have to reinvent pivot detection on every generation.
The Seven SMC Primitives the AI Can Use
When you describe an SMC strategy in plain English, the AI generates a Python script that runs inside the sandboxed runtime. The script doesn't write its own pivot detection; it composes against a curated helper library called fomoed.smc that exposes seven primitives. Each maps onto a concept SMC traders recognize:
1. Swings. fomoed.smc.swings(highs, lows, lookback) returns the swing highs and swing lows in the recent price history. A swing high at index i is the highest high in a window from i - lookback to i + lookback. The lookback defaults to 20 candles, which works for most timeframes. Returns a dict with highs and lows arrays, each containing the index and price of every pivot detected.
2. Structure. fomoed.smc.structure(highs, lows, lookback) takes the swings and labels them as HH (higher high), HL (higher low), LH (lower high), or LL (lower low). Returns the current trend (bullish, bearish, or neutral) plus the structure sequence. A bot can use this to check "am I in an uptrend?" before deciding to take a long setup.
3. Break of Structure (BoS). fomoed.smc.bos(opens, highs, lows, closes, lookback) detects trend-continuation breaks. A bullish BoS is a strong close above the most recent swing high in a bullish trend; a bearish BoS is a strong close below the most recent swing low in a bearish trend. The "strong" qualifier matters — the helper requires the break candle's body to be at least 1.5x the rolling 20-bar average body, filtering out grinding breaks that fail to displace.
4. Change of Character (CHoCH). fomoed.smc.choch(highs, lows, closes, lookback) detects trend-reversal pivots. A bullish CHoCH is a close above the most recent lower high while the trend was bearish, signaling a reversal. A bearish CHoCH is a close below the most recent higher low while the trend was bullish. This is the SMC primitive most discretionary traders confuse with BoS. The helper makes the distinction algorithmically.
5. Order Blocks. fomoed.smc.order_blocks(opens, highs, lows, closes) returns active (unmitigated) bullish and bearish order block zones. A bullish OB is the last bearish candle before a displacement move that broke a swing high; a bearish OB is the mirror. Zones use candle BODY (open to close), not the full range with wicks, per the ICT methodology. Only zones that haven't been tagged since formation are returned — once price has revisited an OB, it's considered mitigated and dropped from the list.
6. Fair Value Gaps (FVG). fomoed.smc.fvg(opens, highs, lows, closes, min_gap_pct) finds unfilled three-candle imbalance patterns. A bullish FVG is the gap between candle i-1's high and candle i+1's low, where candle i was the displacement candle in between. The min_gap_pct parameter filters small gaps (default 0.2 percent of price). Each returned FVG includes a fill_pct showing how much of the gap has been filled by subsequent wicks.
7. Liquidity Sweeps. fomoed.smc.liquidity_sweeps(highs, lows, closes, sweep_depth_pct, reclaim_candles) detects stop-hunt patterns: a wick below a swing low followed by a reclaim above the level within the specified number of candles (bullish sweep), or the bearish mirror. The sweep_depth_pct parameter is the minimum penetration past the level that counts as a sweep, filtering out grazes.
In addition to the seven SMC primitives, the AI can use fomoed.fib for Fibonacci retracement math: fib.retracement(swing_high, swing_low, level) returns the price at a given fib level (0.5, 0.618, 0.705, 0.79, 0.886), fib.zones returns a dict of all standard levels, and fib.in_zone returns a boolean for "is price near this fib level within X percent of the swing size."
A Plain-English CHoCH and Fib Strategy, End to End
Let's walk through a real strategy from prompt to running bot. The strategy: trade reversals by waiting for a bullish CHoCH, then entering on a pullback to the 0.705 fib retracement of the impulse swing. Take profit at the next swing high above entry; stop loss at the swept low below the CHoCH.
You'd write this prompt on the AI Trading Agent step:
"Enter long on a bullish CHoCH followed by a pullback to the 0.705 fib level of the breakout swing. Take profit at the next swing high above entry. Stop loss at the most recent swing low below the CHoCH. Long-only — no short side."
Within a few seconds, the wizard's review screen shows the AI's interpretation:
AI summary: SMC trend-reversal play. Waits for a bullish CHoCH — price closing above the most recent lower-high while the trend was bearish, signaling a reversal. Then watches for price to pull back into the 0.705 fib retracement of the impulse swing (low to CHoCH high), which sits in the OTE zone. Opens long for your configured position size when price tags the zone. Take profit at the next swing high above entry; stop loss at the lowest swing low below the CHoCH (where stops would be swept on a failed reversal). Long-only — no short setups taken.
How it works:
1. Watch for a bullish CHoCH — price closing above the most recent lower high while the trend was bearish (signals a reversal).
2. After the CHoCH, measure the impulse swing (low → CHoCH high) and compute the 0.705 fib retracement level.
3. Wait for price to pull back into the 0.705 fib zone (within 0.5 percent of the swing size).
4. Open a long for your configured position size when price tags the zone.
5. Take profit at the next swing high above entry, or stop out at the lowest swing low (swept liquidity).
You can see immediately whether the AI understood the strategy. If anything looks wrong, you edit the prompt and re-generate. Once it matches your intent, you save and the bot starts running on the next candle close.
What the AI Actually Writes (Behind the Scenes)
For the CHoCH-and-fib strategy above, the AI generates a Python script of about 30 to 40 lines that runs inside the sandbox on every candle close. It looks roughly like this (abbreviated for readability):
def on_candle(ctx):
if len(ctx.closes) < 100:
return None
# Exit logic if already in a position
if ctx.position is not None:
sw = fomoed.smc.swings(ctx.highs, ctx.lows, lookback=20)
entry = ctx.position.entry_price
price = ctx.closes[-1]
# TP at next swing high above entry
tp = next((s['price'] for s in reversed(sw['highs'])
if s['price'] > entry), None)
# SL at most recent swing low below entry
sl = next((s['price'] for s in reversed(sw['lows'])
if s['price'] < entry), None)
if tp and price >= tp:
return {'action': 'close', 'reason': f'TP swing-high {tp:.2f}'}
if sl and price <= sl:
return {'action': 'close', 'reason': f'SL swing-low {sl:.2f}'}
return None
# Entry logic: bullish CHoCH + fib pullback
choch = fomoed.smc.choch(ctx.highs, ctx.lows, ctx.closes, lookback=20)
bull = [c for c in choch if c['type'] == 'bullish_choch']
if not bull:
return None
last = bull[-1]
idx = last['index']
if idx < 10:
return None
swing_low = float(ctx.lows[max(0, idx - 30):idx].min())
swing_high = float(ctx.highs[idx:].max())
if swing_high <= swing_low:
return None
price = ctx.closes[-1]
if fomoed.fib.in_zone(price, swing_high, swing_low, 0.705,
tolerance_pct=0.5):
return {
'action': 'buy',
'size_usd': ctx.user.position_size_usd,
'reason': f"CHoCH @ {last['broken_level']:.2f}, fib 0.705 pullback",
}
return NoneEnd users never see this code — they see the AI summary and the "How It Works" steps. The Python is stored server-side for audit and runs inside the sandboxed runtime. The point of showing it here is to demystify what the AI actually produces: short, focused logic that delegates the hard parts (pivot detection, fib math, structure tracking) to the helper library. The AI is not reinventing SMC algorithms each time you generate a bot — it's composing against the same battle-tested implementations the SMC preset uses.
Why Automated SMC Tends to Outperform Discretionary
A skilled human SMC trader and a well-built SMC bot, looking at the same chart, will often draw the same structure. So why does the bot tend to outperform the human over a multi-month window?
Consistency of execution. The bot takes every A-grade setup. The human takes most of them. Even one missed setup per week, compounded over a quarter, materially changes returns. The discretionary trader is also more likely to skip a setup that "feels off" without articulating why — sometimes that's good instinct, but on average it costs money.
No look-elsewhere bias. Humans subconsciously trade based on broader market context — a setup looks worse if BTC just dumped, a setup looks better if their other positions are green. The bot doesn't care. If the rules match, it takes the trade.
Patience under boredom. SMC traders who hand-trade often start widening their criteria during slow weeks ("I'll take this B-grade setup, I haven't traded in 4 days"). The bot doesn't get bored. If no A-grade setup forms for a week, it sits flat for a week. That patience is what makes the strategy actually profitable over time.
24/7 watch. Setups don't form during your trading hours. The 4-hour chart's best CHoCH this month might fire at 3 a.m. local. The bot is awake. You aren't.
The trade-off is that automated SMC misses the context judgment a skilled human brings. If the broader market is in a clear bull regime, a human discretionary trader might raise their threshold for bearish setups. The bot follows the rules regardless. The way to handle this in an automated system is to bake regime detection into the prompt itself — for example, "only take long CHoCH setups when BTC is above its 200-day EMA on the daily chart." If you can articulate the regime filter, the AI can implement it.
Risk Management Is Built In
One concern people raise about AI-generated trading bots is "what if the AI tries to size up unreasonably or place a bunch of orders?" Fomoed handles this by separating capital decisions from strategy decisions. You set your position size, leverage, and trading mode (live or paper) in the wizard's Money step BEFORE writing your prompt. The AI is told these values as constraints, not as variables it can modify.
When the AI-generated script returns an action like {'action': 'buy', 'size_usd': 100, ...}, the sandbox supervisor clamps the requested size to your wizard-chosen value. If you set $50 in the Money step but the AI tries to request $200, the platform sizes the order at $50 and logs the clamp. The actual execute_entry call uses your configured position size, not the script's requested value. The AI cannot override your capital limit even if it wanted to.
The same protection extends to take profit and stop loss. The wizard's TP and SL settings drive the platform's standard exit pipeline; the AI's "close" action is supplementary. If you set a 2 percent stop loss in the wizard, that stop fires on a 2 percent drop regardless of what the AI's script says. The AI's role is to add entry intelligence, not to override your risk rules.
This separation is what makes AI Trading Agent safe to run with real money. The strategy logic is AI-generated; the risk management is wizard-configured and platform-enforced. The two are explicitly decoupled.
Frequently Asked Questions
Can AI detect CHoCH and BoS automatically?
Yes. The fomoed.smc.choch and fomoed.smc.bos helpers detect these algorithmically using the same structure-tracking logic the dedicated SMC preset uses. The AI doesn't reinvent the detection — it composes against the existing implementation. This means the detection quality is consistent across AI-generated bots and platform-built SMC bots.
Is AI better than human SMC traders?
On rule execution: yes. On context judgment: not yet. The bot is more consistent on the mechanical parts of SMC trading — drawing structure correctly, identifying unmitigated order blocks, computing fib retracement levels, taking every qualifying setup. The bot is worse at integrating broader regime context unless that context is explicitly built into the prompt. The hybrid approach (let the AI handle the setup detection, you decide whether to let it trade aggressively this week) tends to perform better than either pure automation or pure discretion.
How does AI handle fib retracement entries?
The fomoed.fib module provides retracement math: given a swing high and swing low, it computes the price at any fib level (0.5, 0.618, 0.705, 0.79, 0.886). The in_zone helper takes a tolerance percent and returns whether the current price is within that tolerance of a fib level. AI-generated bots typically wait for price to tag a specific fib level (commonly the 0.705 or 0.79 — the OTE zone) before entering. Multiple fib levels can be checked simultaneously; the AI emits the right logic from your description.
Can I backtest an AI SMC strategy?
Yes. Paper trading runs the same AI-generated script against live market data with simulated execution — no capital at risk. This is the recommended way to validate a new SMC strategy before going live, especially since SMC setups can be timeframe-sensitive (a strategy that works on the 1-hour chart may not work on the 5-minute). The fomoed backtest sandbox additionally runs strategies against historical data for faster iteration.
What about Order Blocks and Fair Value Gaps?
Both are exposed via fomoed.smc.order_blocks and fomoed.smc.fvg. Order blocks return unmitigated zones with body-based boundaries; the helper automatically drops zones once price has tagged them. FVGs return unfilled three-candle gaps with a fill_pct attribute so the AI-generated script can decide whether a partially-filled gap still counts. Both helpers use the same detection logic as the SMC preset, so behavior is consistent across the platform.
Can I combine SMC with other strategies?
Yes — that's where AI Trading Agent shines compared to fixed presets. A typical confluence strategy might combine "bullish CHoCH plus RSI not overbought plus price in an unmitigated bullish order block plus no recent bearish FVG above current price." The AI translates that confluence into the right calls (fomoed.smc.choch, ctx.indicators.rsi, fomoed.smc.order_blocks, fomoed.smc.fvg) and composes them in the entry condition. The SMC preset by itself can't do this kind of cross-domain confluence easily; AI Trading Agent is purpose-built for it.
How does the bot handle a CHoCH that gets invalidated before the fib pullback?
The AI-generated script re-evaluates the entry conditions on every candle close. If a bullish CHoCH fires but price never pulls back to the 0.705 fib level — instead racing higher — the bot doesn't enter. If the CHoCH gets invalidated (price closes back below the broken level), the next call to fomoed.smc.choch will reflect that and the bot won't act on a stale signal. The state is recomputed each tick from the current market data, not held statefully across ticks.
Build Your First SMC Bot
The fastest way to understand how AI Trading Agent handles SMC is to sign up, pick AI Trading Agent as your strategy in the wizard, and paste a prompt like the one in this guide. Use paper trading mode for your first bot — the strategy runs against live market data without spending real capital, so you can watch how often the setups actually fire on your chosen pair and timeframe.
For broader context on what AI Trading Agent can do beyond SMC, see our pillar guide on AI-built trading bots. For a comparison of which strategy preset to pick for which market conditions, the strategy comparison guide covers the full lineup.
Build your SMC bot in plain English
CHoCH, BoS, order blocks, fair value gaps, liquidity sweeps, and fib retracements — described in English, executed by AI, sandbox-safe. Free to run in paper mode while you validate.
Start Free →

