All indicators

eBacktesting - Learning: Order Blocks

Jan 11, 2026

Static chart image
Support and ResistancePatternsPivot Based (Retrospective)

The eBacktesting - Learning: Order Blocks indicator provides a clean and automated way to identify and visualize institutional order blocks on price charts.

Usage

The script automatically identifies Order Blocks (OB) when a Break of Structure (BOS) occurs. It highlights the last opposite-colored candle before the impulsive move that broke the structure. These zones are extended to the right to mark potential areas of interest for future price reactions.

  • Bullish Order Block: Identified when the price closes above a previous swing high. The indicator marks the last down-candle before the move.
  • Bearish Order Block: Identified when the price closes below a previous swing low. The indicator marks the last up-candle before the move.
  • Mitigation: To keep charts clean, the indicator removes the highlighted zone once the price returns to the area (mitigates it). You can choose whether mitigation occurs on a wick touch or a candle close.

Details

The script uses pivot-based swing highs and lows to determine structure breaks. When a break occurs, it searches back within a defined candle range to find the most relevant "opposite" candle. To ensure quality, the script includes a displacement filter, requiring the breaking move to have a minimum body size relative to the Average True Range (ATR).

Key implementation details:

  • Active Tracking: The script manages a limited number of active OBs to maintain performance and chart clarity.
  • Zone Definition: Users can choose to define the zone using the candle body or the full wick range.
  • Proximity Filter: A minimum bar distance can be set between consecutive OBs of the same direction to avoid clustering.

Settings

Main

  • Swing length: Determines the sensitivity of the pivot points used for structural analysis.
  • Search back (candles): The maximum number of candles the script looks back to find the opposite-colored OB candle.
  • Zone = candle body (else full wick): Toggles between using only the candle body or the entire high/low range for the OB zone.
  • Mitigation by: Selects whether a zone is cleared when a wick touches it or only when a candle closes inside it.

Filters

  • Max active OBs: Limits the number of unmitigated zones displayed on the chart.
  • Min bars between OBs (same direction): Prevents the creation of new OBs if another was recently formed.
  • Min displacement (body x ATR): Sets a volatility-adjusted threshold for the breaking move to ensure it represents strong momentum.

Visuals

  • Show labels: Toggles the "Bullish/Bearish Order Block" text labels.
  • Label size: Adjusts the size of the on-chart labels.

FAQ

How do I access the eBacktesting - Learning: Order Blocks?

You can get access on the LuxAlgo Library for charting platforms like TradingView, MetaTrader (MT4/MT5), and NinjaTrader for free.

When does an Order Block disappear?

An Order Block is removed from the chart as soon as it is "mitigated," meaning price has returned to the zone based on your selected Mitigation settings (Wick or Close).

Why isn't a specific candle being marked as an Order Block?

The script requires a confirmed Break of Structure (BOS) and a minimum displacement (momentum). If the price move is too weak or doesn't break a swing point, a zone will not be created.

Free indicator

Get free access to this indicator on the platforms below.

TradingView
NinjaTrader
MetaTrader 4/5

Unlock the entire LuxAlgo Library

Every indicator, every strategy, full charts, and complete access to Quant — our AI agent.