indicator · on price · open source

Smart Money Concepts (All)

Deepwick · @deepwickv1Updated 2 Oct 2026▲ 0 users
Running…
Loading chart…

About

Smart Money Concepts (All-in-One) — BOS, CHOCH, bullish / bearish Order Blocks and Fair Value Gaps on a single overlay.

  • One config that combines the four most common SMC primitives.
  • Labels distinguish BOS (BOS), CHOCH (CH), bullish OB (BOB), bearish OB (SOB).
  • Best for traders who want the full SMC picture without stacking four scripts.

Source code

//@version=5
indicator("Smart Money Concepts (All)", overlay=true)
swing = input.int(5, "Swing Length", minval=2, maxval=50)
confirmClose = input.bool(true, "Confirm on Close")
ph = ta.pivothigh(high, swing, swing)
pl = ta.pivotlow(low, swing, swing)
var float lastPh = na
var float prevPh = na
var float lastPl = na
var float prevPl = na
if not na(ph)
    prevPh := lastPh
    lastPh := ph
if not na(pl)
    prevPl := lastPl
    lastPl := pl
bosUp = confirmClose ? close > lastPh : high > lastPh
bosDn = confirmClose ? close < lastPl : low < lastPl
bullChoch = lastPl > prevPl and low < lastPh
bearChoch = lastPh < prevPh and high > lastPl
bullChoch := confirmClose ? (bullChoch and close > lastPh) : bullChoch
bearChoch := confirmClose ? (bearChoch and close < lastPl) : bearChoch
var float obBullTop = na
var float obBullBot = na
var float obBearTop = na
var float obBearBot = na
var int obBullAge = 9999
var int obBearAge = 9999
if not na(lastPh) and not na(prevPh) and lastPh > prevPh
    found = false
    for i = 1 to math.min(20, swing * 4)
        if not found and close[i] < open[i]
            obBullTop := high[i]
            obBullBot := low[i]
            obBullAge := 0
            found := true
            break
if not na(lastPl) and not na(prevPl) and lastPl < prevPl
    found = false
    for i = 1 to math.min(20, swing * 4)
        if not found and close[i] > open[i]
            obBearTop := high[i]
            obBearBot := low[i]
            obBearAge := 0
            found := true
            break
obBullAge += 1
obBearAge += 1
if obBullAge > 30
    obBullTop := na
    obBullBot := na
if obBearAge > 30
    obBearTop := na
    obBearBot := na
gapBull = low[0] > high[2]
gapBear = high[0] < low[2]
var float fvgBullTop = na
var float fvgBullBot = na
var float fvgBearTop = na
var float fvgBearBot = na
var int fvgBullAge = 9999
var int fvgBearAge = 9999
if gapBull
    fvgBullTop := low[0]
    fvgBullBot := high[2]
    fvgBullAge := 0
if gapBear
    fvgBearTop := low[2]
    fvgBearBot := high[0]
    fvgBearAge := 0
fvgBullAge += 1
fvgBearAge += 1
if fvgBullAge > 30
    fvgBullTop := na
    fvgBullBot := na
if fvgBearAge > 30
    fvgBearTop := na
    fvgBearBot := na
p_OB_Bull_Top = plot(obBullTop, "OB Bull Top", color=color.green, style=plot.style_linebr)
p_OB_Bull_Bot = plot(obBullBot, "OB Bull Bot", color=color.green, style=plot.style_linebr)
p_OB_Bear_Top = plot(obBearTop, "OB Bear Top", color=color.red, style=plot.style_linebr)
p_OB_Bear_Bot = plot(obBearBot, "OB Bear Bot", color=color.red, style=plot.style_linebr)
p_FVG_Bull_Top = plot(fvgBullTop, "FVG Bull Top", color=color.lime, style=plot.style_linebr)
p_FVG_Bull_Bot = plot(fvgBullBot, "FVG Bull Bot", color=color.lime, style=plot.style_linebr)
p_FVG_Bear_Top = plot(fvgBearTop, "FVG Bear Top", color=color.maroon, style=plot.style_linebr)
p_FVG_Bear_Bot = plot(fvgBearBot, "FVG Bear Bot", color=color.maroon, style=plot.style_linebr)
fill(p_OB_Bull_Top, p_OB_Bull_Bot, color=color.new(color.green, 88))
fill(p_OB_Bear_Top, p_OB_Bear_Bot, color=color.new(color.red, 88))
fill(p_FVG_Bull_Top, p_FVG_Bull_Bot, color=color.new(color.lime, 90))
fill(p_FVG_Bear_Top, p_FVG_Bear_Bot, color=color.new(color.maroon, 90))
plotshape(bosUp and not bosUp[1], "BOS Up", style=shape.triangleup, location=location.belowbar, color=color.green, text="BOS")
plotshape(bosDn and not bosDn[1], "BOS Dn", style=shape.triangledown, location=location.abovebar, color=color.red, text="BOS")
plotshape(bullChoch and not bullChoch[1], "Bull Choch", style=shape.triangleup, location=location.belowbar, color=color.lime, text="CH")
plotshape(bearChoch and not bearChoch[1], "Bear Choch", style=shape.triangledown, location=location.abovebar, color=color.maroon, text="CH")

Comments

No comments yet.

Sign in to comment.