indicator · on price · open source

Order Blocks (Bearish) indicator

Order Blocks (Bearish) is a free open-source indicator. Bearish Order Blocks mark the last bullish candle before a bearish break of structure — the… Deepwick Script runs a subset of Pine Script.

v1Updated 3 Oct 2026▲ 0 users
Running…
Loading chart…

What Order Blocks (Bearish) does

Bearish Order Blocks mark the last bullish candle before a bearish break of structure — the mirror of bullish OBs.

  • Red zone = OB top/bottom; shaded fill shows the mitigation range.
  • Zones extend for extendBars bars; perfect for shorting into premium on a retracement.
  • Use in confluence with a CHOCH signal for highest probability.
  • A bearish OB that has never been revisited is a virgin OB and signals strong institutional supply.
  • After a bearish BOS, wait for a rally into the OB rather than chasing the breakdown.
  • Bearish OBs often align with the top of an FVG — confluence of both is the highest-conviction short entry.
  • Default lookback = 30 — searches the most recent 30 bars after the BOS for the trigger candle.
  • Mitigated bearish OBs (price closes above OB top) become supply turned support on the other side.

Source code

Deepwick Script, a subset of Pine Script · read-only

//@version=6
indicator("Order Blocks (Bearish)", overlay=true)
swing = input.int(5, "Swing Length", minval=2, maxval=50)
lookback = input.int(30, "OB Lookback", minval=5, maxval=100)
extendBars = input.int(30, "Extend Bars", minval=5, maxval=200)
obColor = input.string("color.red", "OB Border Color")
transparency = input.int(85, "Fill Transparency", minval=50, maxval=99)
alertNew = input.bool(true, "Alert on New OB")
alertRetest = input.bool(false, "Alert on OB Retest")
alertBroken = input.bool(false, "Alert on OB Broken (invalidation)")
atrPeriod = input.int(14, "ATR Period", minval=5, maxval=50)
pl = ta.pivotlow(low, swing, swing)
var float lastPl = na
var float prevPl = na
var float obBearTop = na
var float obBearBot = na
var int obBearAge = 9999
if not na(pl)
    prevPl := lastPl
    lastPl := pl
if not na(lastPl) and not na(prevPl) and lastPl < prevPl
    found = false
    for i = 1 to math.min(lookback, swing * 4)
        if not found and close[i] > open[i]
            obBearTop := high[i]
            obBearBot := low[i]
            obBearAge := 0
            found := true
            break
obBearAge += 1
if obBearAge > extendBars
    obBearTop := na
    obBearBot := na
p_Bear_OB_Top = plot(obBearTop, "Bear OB Top", color=obColor, style=plot.style_linebr)
p_Bear_OB_Bot = plot(obBearBot, "Bear OB Bot", color=obColor, style=plot.style_linebr)
fill(p_Bear_OB_Top, p_Bear_OB_Bot, color=color.new(obColor, transparency))
alertcondition(not na(obBearTop) and na(obBearTop[1]), "New bearish OB", "Bearish order block formed")
alertcondition(not na(obBearTop) and high >= obBearTop and high[1] < obBearTop, "Bear OB retested", "Price revisited bearish OB — possible short entry")
alertcondition(not na(obBearTop) and close < obBearBot, "Bear OB broken", "Bearish OB has been broken — invalidation")
alertcondition(not na(obBearTop) and close > obBearTop, "Bear OB mitigated", "Bearish OB mitigated by close above")

Comments

No comments yet.

Sign in to comment.