OPEN-SOURCE SCRIPT
MarketMaulers Order Blocks (Open Source)

MarketMaulers Order Blocks automatically marks institutional Order Blocks: the last opposing candle before a displacement leg that BREAKS MARKET STRUCTURE (BOS). That candle is where the move was loaded, and price returns to it to fill unfinished business, which is why order blocks act as high-probability support and resistance.
WHY THE BOS REQUIREMENT
An order block is only meaningful if it sits at the origin of a real structure break. The engine ignores random candles and only marks the opposing candle at the origin of a leg that breaks a swing point, so what you see is a genuine order block and not any pullback candle.
WHAT IT MARKS
• Bullish OB · a down candle before an up-move that breaks a swing high, which becomes a demand / support zone
• Bearish OB · an up candle before a down-move that breaks a swing low, which becomes a supply / resistance zone
HOW THE ZONE IS DRAWN
Zones use the full range of the origin candle (wick low to body high for bullish, wick high to body low for bearish), not only the body, because that whole span is the range price defends on the return. When a single displacement candle takes out a run of opposing candles in one shot, the zone spans the WHOLE cluster it engulfed, so the order block reflects all of the supply or demand the move absorbed.
REAL-TIME LIFECYCLE
Every block is tracked live: Fresh (untouched), then Mitigated (tapped once), then Broken (a close through it, the zone is spent). You always know what is still valid.
REFINEMENTS
• OB Origin · choose the Cluster, the Nearest or the Extreme opposing candle
• Optional FVG-confluence filter · require an imbalance after the block
• Kill-zone and displacement filters to cut noise
• Automatic higher-timeframe order blocks · up to 2 HTF slots, each with its own colors, never evicted by lower-timeframe crowding. A higher-timeframe block is judged on its own timeframe's close, so it holds on a lower-timeframe chart exactly as long as it holds on its own
ALERTS
New Bullish OB · New Bearish OB · OB Mitigated · OB Broken
Works on any market and any timeframe.
Display only. This marks zones, it does not fire buy/sell signals. Educational tool, not financial advice.
Published open-source. This is the same indicator as MarketMaulers Order Blocks, published here with the source readable. The swing and break of structure engine, the cluster origin rule, the higher-timeframe slots and the mitigation and break tracking are all in the code. Everything above explains what it marks and how it decides what to mark; the code is there so you can check that the description is accurate rather than take it on faith. Read it, fork it, argue with the constants.
WHY THE BOS REQUIREMENT
An order block is only meaningful if it sits at the origin of a real structure break. The engine ignores random candles and only marks the opposing candle at the origin of a leg that breaks a swing point, so what you see is a genuine order block and not any pullback candle.
WHAT IT MARKS
• Bullish OB · a down candle before an up-move that breaks a swing high, which becomes a demand / support zone
• Bearish OB · an up candle before a down-move that breaks a swing low, which becomes a supply / resistance zone
HOW THE ZONE IS DRAWN
Zones use the full range of the origin candle (wick low to body high for bullish, wick high to body low for bearish), not only the body, because that whole span is the range price defends on the return. When a single displacement candle takes out a run of opposing candles in one shot, the zone spans the WHOLE cluster it engulfed, so the order block reflects all of the supply or demand the move absorbed.
REAL-TIME LIFECYCLE
Every block is tracked live: Fresh (untouched), then Mitigated (tapped once), then Broken (a close through it, the zone is spent). You always know what is still valid.
REFINEMENTS
• OB Origin · choose the Cluster, the Nearest or the Extreme opposing candle
• Optional FVG-confluence filter · require an imbalance after the block
• Kill-zone and displacement filters to cut noise
• Automatic higher-timeframe order blocks · up to 2 HTF slots, each with its own colors, never evicted by lower-timeframe crowding. A higher-timeframe block is judged on its own timeframe's close, so it holds on a lower-timeframe chart exactly as long as it holds on its own
ALERTS
New Bullish OB · New Bearish OB · OB Mitigated · OB Broken
Works on any market and any timeframe.
Display only. This marks zones, it does not fire buy/sell signals. Educational tool, not financial advice.
Published open-source. This is the same indicator as MarketMaulers Order Blocks, published here with the source readable. The swing and break of structure engine, the cluster origin rule, the higher-timeframe slots and the mitigation and break tracking are all in the code. Everything above explains what it marks and how it decides what to mark; the code is there so you can check that the description is accurate rather than take it on faith. Read it, fork it, argue with the constants.
Mã nguồn mở
Theo đúng tinh thần TradingView, tác giả của tập lệnh này đã công bố nó dưới dạng mã nguồn mở, để các nhà giao dịch có thể xem xét và xác minh chức năng. Chúc mừng tác giả! Mặc dù bạn có thể sử dụng miễn phí, hãy nhớ rằng việc công bố lại mã phải tuân theo Nội quy.
Thông báo miễn trừ trách nhiệm
Thông tin và các ấn phẩm này không nhằm mục đích, và không cấu thành, lời khuyên hoặc khuyến nghị về tài chính, đầu tư, giao dịch hay các loại khác do TradingView cung cấp hoặc xác nhận. Đọc thêm tại Điều khoản Sử dụng.
Mã nguồn mở
Theo đúng tinh thần TradingView, tác giả của tập lệnh này đã công bố nó dưới dạng mã nguồn mở, để các nhà giao dịch có thể xem xét và xác minh chức năng. Chúc mừng tác giả! Mặc dù bạn có thể sử dụng miễn phí, hãy nhớ rằng việc công bố lại mã phải tuân theo Nội quy.
Thông báo miễn trừ trách nhiệm
Thông tin và các ấn phẩm này không nhằm mục đích, và không cấu thành, lời khuyên hoặc khuyến nghị về tài chính, đầu tư, giao dịch hay các loại khác do TradingView cung cấp hoặc xác nhận. Đọc thêm tại Điều khoản Sử dụng.