Order Blocks and Liquidity Zones — How Institutional Footprints Really Work (With Pine Script Examples)
By HorizonAI Team
Order blocks and liquidity zones are some of the most popular Smart Money Concepts (SMC) ideas right now.
But between different ICT interpretations, screenshots, and YouTube explanations, it’s easy to end up confused—and even harder to automate and backtest them.
This guide walks you through order blocks and liquidity in a clear, practical way:
- What order blocks really are (beyond the buzzwords)
- How institutions use liquidity and why price “hunts” certain levels
- How to map liquidity zones, premium/discount, and OBs together
- How to start visualizing OB logic in Pine Script on EURUSD
- How HorizonAI can generate and refine OB‑based strategies for you
You’ll come away with an SMC‑aligned understanding, plus a path to actually test your ideas, not just screenshot them.
What Is an Order Block in SMC?
In ICT‑style SMC, an order block (OB) is typically defined as:
The last opposite‑colored candle (or small cluster) before a strong displacement move that breaks structure.
In practice:
- Bullish OB:
- Last down candle before a strong move up
- That move causes a bullish BOS (breaks a significant swing high)
- Bearish OB:
- Last up candle before a strong move down
- That move causes a bearish BOS (breaks a significant swing low)
The idea is that large institutions:
- Accumulate or distribute positions in that opposite‑colored candle
- Then push price aggressively away, leaving a “footprint”
- Later may return to that zone to fill leftover orders (mitigation)
We don’t need a hyper‑strict OB rule here—just a consistent definition you can test.
Liquidity Zones: Where the Orders Live
Order blocks don’t exist in a vacuum. They interact with liquidity:
- Liquidity pools sit around:
- Equal highs / equal lows
- Previous day high/low
- Major session highs/lows (London, New York)
- Big round numbers (1.1000 on EURUSD, 4000 on ES)
- Price often:
- Trades into a liquidity pool (e.g., takes out equal highs)
- Then reverses from a nearby order block
Liquidity Above and Below Structure
Think in layers:
- Above recent highs:
- Buy stop orders (breakout traders)
- Short stops (retail shorts getting squeezed)
- Below recent lows:
- Sell stop orders (breakout shorts)
- Long stops (retail longs getting stopped)
Order blocks often sit:
- Just beyond where liquidity was taken
- Or beneath/above clusters of equal highs/lows
That’s why SMC traders care so much about:
- “Sweep liquidity” → then mitigate an OB
Premium, Discount, and OB Location
Premium/discount is simply where price is trading relative to a swing:
- Draw a Fibonacci (0–100%) from swing low to swing high
- The 50% line is the “mean” or equilibrium
- Below 50% = discount zone (cheaper)
- Above 50% = premium zone (more expensive)
General SMC logic:
- In a bullish context, you want to buy in discount (below 50%) from a bullish OB
- In a bearish context, you want to sell in premium (above 50%) from a bearish OB
This adds a mean reversion component to OB trading:
- Instead of chasing after displacement moves at extremes, you wait for price to return to fair value where institutions may add/defend positions.
Simple OB + Liquidity Narrative (EURUSD Example)
On a 15m EURUSD chart:
- 4H structure is bullish (HH/HL, recent bullish BOS)
- Price consolidates, forming equal highs in London session
- New York session:
- Price pushes above the equal highs (liquidity grab)
- Leaves a long wick, closes back below the highs
- The strong up candle that caused the breakout:
- Has a clear last down candle before it → potential bullish OB
- Price retraces back into that down‑candle range
- Zone is in discount relative to a smaller bullish swing
- SMC trader:
- Looks for confirmation inside that OB (e.g., lower‑TF CHOCH/BOS)
- Enters long with stop under the OB low
You can trade that story manually—or you can start turning it into rules your code can understand.
Visualizing Order Block Zones in Pine Script (Conceptually)
Full, perfect OB detection can get complicated, but you can start with a simple helper:
- Mark candles that precede a large move (displacement)
- Highlight their ranges as potential OB zones
//@version=5
indicator("Simple Displacement-Based OB Zones", overlay = true)
// Displacement threshold: how big does the move need to be?
multiplier = input.float(2.0, "Body Size Multiplier")
lookahead = input.int(3, "Bars After", minval = 1, maxval = 5)
bodySize = math.abs(close - open)
avgBody = ta.sma(bodySize, 20)
// Strong candle if its body is X times the average
isStrongBull = close > open and bodySize > avgBody * multiplier
isStrongBear = close < open and bodySize > avgBody * multiplier
// Potential bullish OB: last down candle before strong bull candle
bullOB = isStrongBull and open[1] > close[1] // previous candle was down
bearOB = isStrongBear and open[1] < close[1] // previous candle was up
// Draw simple OB zones from previous candle's high/low
var float bullOBHigh = na
var float bullOBLow = na
var float bearOBHigh = na
var float bearOBLow = na
if bullOB
bullOBHigh := high[1]
bullOBLow := low[1]
if bearOB
bearOBHigh := high[1]
bearOBLow := low[1]
// Plot zones as filled rectangles (conceptual visualization)
plot(bullOBHigh, "Bull OB High", color = color.new(color.green, 60), style = plot.style_linebr)
plot(bullOBLow, "Bull OB Low", color = color.new(color.green, 80), style = plot.style_linebr)
plot(bearOBHigh, "Bear OB High", color = color.new(color.red, 60), style = plot.style_linebr)
plot(bearOBLow, "Bear OB Low", color = color.new(color.red, 80), style = plot.style_linebr)
This is not a full ICT order block indicator, but it gets you:
- A basic visual idea of zones before strong moves
- A foundation you can tweak:
- Require actual BOS after the displacement
- Filter by higher‑timeframe bias
- Combine with premium/discount and session filters
HorizonAI can generate richer versions of this logic for you.
Combining OBs with Liquidity and Premium/Discount
Order blocks become much more interesting when you combine them with:
- Liquidity grabs
- Premium/discount context
- Session timing (kill zones)
Example Rule Set (Conceptual)
For a bullish SMC idea:
- 4H structure is bullish (HH/HL, bullish BOS)
- On 15m:
- Previous day high acts as liquidity
- New York session sweeps above that high and closes back below
- The strong up candle that created the sweep:
- Has a last down candle just before it → bullish OB
- Price retraces:
- Into that OB
- While still trading in discount (below 50% of the recent bullish swing)
- Entry:
- Long from OB zone
- Stop below OB low
- Target opposing liquidity (e.g., prior high or 2R)
You can then ask:
- Over 100+ trades, does this pattern show:
- Acceptable win rate?
- Profit factor > 1.5?
- Reasonable drawdown?
Those are questions you can answer with Pine Script backtests, not just screenshots.
Common Order Block Mistakes
❌ Mistake #1: Marking Every Candle as an OB
If every small pause candle on your chart is an “order block,” the concept becomes useless.
Guidelines:
- Look for clear displacement after the OB
- Prefer OBs that cause an obvious BOS on your timeframe
- Use higher‑timeframe OBs for context, lower‑timeframe OBs for entries
❌ Mistake #2: Ignoring Liquidity and Context
An OB floating in the middle of nowhere—with no liquidity grab, no premium/discount confluence, and no structural story—is just a random box.
Better:
- Tie OBs to liquidity events (sweeps of highs/lows)
- Only trade OBs aligned with higher‑timeframe structure
- Avoid OB trades in messy, choppy ranges with no clear trend
❌ Mistake #3: Never Testing OB Rules
Many traders:
- Draw OBs manually after the fact
- Remember only the trades that worked
- Ignore the ones that didn’t
Without backtesting, you won’t know:
- How often price actually returns to an OB
- How often it respects vs violates it
- Whether OB entries outperform simple entries (e.g., moving averages)
How to Start Testing OB Ideas (Without Coding Everything)
You don’t need a perfect OB detector from day one. Start simple:
Ideas to test:
- “On EURUSD 15m, how often does price react from the last strong bullish candle’s down‑candle zone after a London or New York liquidity sweep?”
- “Do OB entries in discount (below 50% of swing) perform better than OB entries in premium?”
- “What’s the difference in performance between OB entries aligned with 4H trend vs counter‑trend?”
You can:
- Use simple Pine indicators to mark:
- Strong displacement candles
- Previous day high/low
- Premium/discount
- Then use HorizonAI to turn those into:
- Systematic entry rules
- Backtests with win rate, RR, and drawdown statistics
Use HorizonAI to Automate OB and Liquidity Testing
Manually coding full ICT‑style OB logic—including:
- Swing structure (HH/HL, LH/LL)
- BOS/CHOCH
- OBs and FVGs
- Session filters
- Premium/discount
…is a lot of work.
Instead, you can:
- Describe your rules in plain English
- Let HorizonAI generate Pine Script v6 strategies and indicators
- Access prebuilt SMC helpers for structure, liquidity, and OB logic
Example prompts:
"Create a Pine Script v6 strategy for EURUSD 15m that goes long from bullish order blocks formed after liquidity sweeps above the previous day’s high, only when price is in discount relative to the last 50 bars. Use 1% risk and 2:1 RR."
"Build an indicator that highlights potential bullish and bearish order blocks based on strong displacement candles that cause a BOS, and colors them differently when they sit in premium or discount."
Test your order block ideas with HorizonAI →"Generate a backtest that compares performance of OB entries vs simple moving average pullback entries over the same EURUSD 15m data."
Final Thoughts
Order blocks and liquidity zones are powerful if you use them with:
- Clear, testable definitions (not just boxes everywhere)
- Proper context: structure, liquidity, premium/discount, and sessions
- Simple, consistent rules you can describe in code
- Backtesting to separate what looks good from what actually works
- Automation to explore variations quickly instead of guessing
Once you understand order blocks as institutional footprints inside a bigger liquidity story, you can use HorizonAI to turn your ideas into Pine Script, test them on EURUSD and beyond, and refine the parts that truly add edge.
Have questions about OB definitions, liquidity confluence, or testing frameworks? Join our Discord community to share charts and compare notes with other traders.
