indicator · on price · open source

Order Blocks (Bullish) indicator

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

Deepwick · @deepwickv1Updated 3 Nov 2026▲ 0 users
Running…
Loading chart…

What Order Blocks (Bullish) does

Bullish Order Blocks mark the last bearish candle before a bullish break of structure — institutions typically entered long there, and price tends to retest the zone.

  • Green zone = OB top/bottom; shaded fill shows the mitigation range.
  • Zones extend for extendBars bars, then expire if price never returned.
  • Combine with a discount filter (below 50% of recent range) for highest-probability longs.
  • An OB that has never been revisited is called a virgin OB and is the most valuable.
  • After the BOS re-prices, wait for a pullback to the OB rather than chasing the break.
  • Default swing = 5, lookback = 30 — captures the most recent bearish candle before BOS.
  • Combine with an FVG detector for confluence — the OB + FVG stack is the institutional demand zone.
  • After the zone is mitigated (price closes below the OB bottom), treat the OB as invalid.

Source code

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

//@version=6
indicator("Order Blocks (Bullish)", 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.green", "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)
ph = ta.pivothigh(high, swing, swing)
var float lastPh = na
var float prevPh = na
var float obBullTop = na
var float obBullBot = na
var int obBullAge = 9999
if not na(ph)
    prevPh := lastPh
    lastPh := ph
if not na(lastPh) and not na(prevPh) and lastPh > prevPh
    found = false
    for i = 1 to math.min(lookback, swing * 4)
        if not found and close[i] < open[i]
            obBullTop := high[i]
            obBullBot := low[i]
            obBullAge := 0
            found := true
            break
obBullAge += 1
if obBullAge > extendBars
    obBullTop := na
    obBullBot := na
p_Bull_OB_Top = plot(obBullTop, "Bull OB Top", color=obColor, style=plot.style_linebr)
p_Bull_OB_Bot = plot(obBullBot, "Bull OB Bot", color=obColor, style=plot.style_linebr)
fill(p_Bull_OB_Top, p_Bull_OB_Bot, color=color.new(obColor, transparency))
alertcondition(not na(obBullTop) and na(obBullTop[1]), "New bullish OB", "Bullish order block formed")
alertcondition(not na(obBullTop) and low <= obBullBot and low[1] > obBullBot, "Bull OB retested", "Price revisited bullish OB — possible entry")
alertcondition(not na(obBullTop) and close > obBullTop, "Bull OB broken", "Bullish OB has been broken — invalidation")
alertcondition(not na(obBullTop) and close < obBullBot, "Bull OB mitigated", "Bullish OB mitigated by close below")

Comments

No comments yet.

Sign in to comment.