Tool
Order Block (SMC)
market.order_block
Inputs
The swing pivots (from a zigzag or structure tool) that mark the highs and lows. The detector uses them to find the structure break that an order block sits in front of.
Outputs
A bundle of order-block zones, each with its top price, bottom price, direction (demand or supply), and whether price has mitigated it yet. Feed it into interpretor.smc_zone to react when price returns to a block.
An order block is the last opposing candle right before an impulsive move — the footprint of where big players loaded up. A bullish order block is the last down-candle before a strong rally (a demand zone); a bearish one is the last up-candle before a sharp drop (a supply zone). This tool finds those zones and tracks when price returns to them.
How it works
Working from the swing pivots you feed in, it locates the candle that broke structure, then steps back to the last candle of the opposite colour before that break and measures the displacement of the move that followed. If the move clears min_displacement, the origin candle becomes a zone whose height is set by zone_span (full wick range or just the body); mitigation_method then governs how price must re-enter the zone to count it as tapped.
Modes
Direction options
Keeps the last down-candle before an impulsive rally and treats it as a demand zone price may revisit to find buyers.
When to use: Long entries that want to buy a retrace into fresh demand.
Keeps the last up-candle before an impulsive drop and treats it as a supply zone price may rally back into to find sellers.
When to use: Short entries that want to sell a retrace into fresh supply.
Tracks bullish demand and bearish supply order blocks together, mapping both buy- and sell-side zones.
When to use: Two-sided playbooks, or when you chart all order blocks before picking a bias.
Zone span options
Draws the zone from the origin candle's high to its low, so the whole wick range is treated as the order block.
When to use: When you want the most generous zone and don't want price to slip past a body edge unnoticed.
Draws the zone from the origin candle's open to its close, a tighter block that ignores the wicks.
When to use: When you prefer a precise zone and tighter risk, accepting that a wick may overshoot it.
Mitigation method options
Counts the order block as tapped the instant any wick reaches into it, the most sensitive rule.
When to use: When the first light touch of the zone should already mark it mitigated.
Waits for a bar to close inside the zone before counting it as tapped, ignoring wicks that pierce and reject.
When to use: When you want a committed re-entry into the block, not a fleeting spike.
Counts the block as tapped once price reaches its halfway line, a balanced rule between a wick touch and a full close.
When to use: Popular for partial entries that engage the block at its 50% level.
Configuration
Which order blocks to keep: bullish (demand, last down-candle before a rally), bearish (supply, last up-candle before a drop), or both.
How far, in price, the impulsive move after the origin candle must travel for the block to qualify. Larger demands a stronger break and yields fewer, higher-quality blocks.
How tall the order-block zone is drawn: wick uses the origin candle's full high-to-low range, body uses just its open-to-close range.
How price must re-enter an order block before it is marked tapped: wick (any touch), close (a bar closes inside), or average (price reaches the 50% midpoint).
How many bars back from the structure break to search for the last opposing candle. Larger tolerates a slower run-up before the impulse; smaller keeps the origin tight to the break.
Caps how many of the most recent unmitigated order blocks are kept and emitted. Smaller keeps only the freshest zones; larger retains a deeper stack.
Connects to
Examples
- In bullish direction with zone_span 'body' and mitigation_method 'close', mark a demand block and arm a long when a bar closes back inside it.
- Wire the swing output of market.zigzag into the pivots input, then feed the blocks to interpretor.smc_zone for entry signals.
Common mistakes
- Leaving min_displacement at 0, which tags weak candles as order blocks and produces zones that never hold.
- Forgetting to supply real swing pivots — without a structure break to anchor on, no order block can be located.