Institutional SMC indicator that automatically plots Break of Structure (BOS), Change of Character (CHoCH), Internal Swings, and Order Flow Zones in real-time.
Copy and paste this code directly into your TradingView Pine Editor
//@version=5
indicator("FxSnip - Smart Money Concepts (SMC) Suite [v5]", "FxSnip SMC Suite", overlay=true, max_boxes_count=500, max_lines_count=500)
// Inputs
swingLength = input.int(5, "Swing Length (Left/Right Bars)", minval=1)
showBOS = input.bool(true, "Show Break of Structure (BOS)")
showCHoCH = input.bool(true, "Show Change of Character (CHoCH)")
bullColor = input.color(color.green, "Bullish Color")
bearColor = input.color(color.red, "Bearish Color")
// Swing Highs & Lows
var float upperSwing = na
var float lowerSwing = na
var int lastTrend = 0 // 1: Bullish, -1: Bearish
pH = ta.pivothigh(high, swingLength, swingLength)
pL = ta.pivotlow(low, swingLength, swingLength)
if not na(pH)
upperSwing := pH
if not na(pL)
lowerSwing := pL
// Detect Structure Breaks
if not na(upperSwing) and ta.crossover(close, upperSwing)
if lastTrend == -1 and showCHoCH
line.new(bar_index - swingLength, upperSwing, bar_index, upperSwing, color=bullColor, width=2, style=line.style_dashed)
label.new(bar_index, upperSwing, "CHoCH", color=bullColor, textcolor=color.white, style=label.style_label_down, size=size.small)
lastTrend := 1
else if showBOS
line.new(bar_index - swingLength, upperSwing, bar_index, upperSwing, color=bullColor, width=1)
label.new(bar_index, upperSwing, "BOS", color=bullColor, textcolor=color.white, style=label.style_label_down, size=size.tiny)
lastTrend := 1
upperSwing := na
if not na(lowerSwing) and ta.crossunder(close, lowerSwing)
if lastTrend == 1 and showCHoCH
line.new(bar_index - swingLength, lowerSwing, bar_index, lowerSwing, color=bearColor, width=2, style=line.style_dashed)
label.new(bar_index, lowerSwing, "CHoCH", color=bearColor, textcolor=color.white, style=label.style_label_up, size=size.small)
lastTrend := -1
else if showBOS
line.new(bar_index - swingLength, lowerSwing, bar_index, lowerSwing, color=bearColor, width=1)
label.new(bar_index, lowerSwing, "BOS", color=bearColor, textcolor=color.white, style=label.style_label_up, size=size.tiny)
lastTrend := -1
lowerSwing := na
// Alert conditions
alertcondition(ta.crossover(close, upperSwing), "Bullish Structure Break", "Bullish BOS/CHoCH Detected")
alertcondition(ta.crossunder(close, lowerSwing), "Bearish Structure Break", "Bearish BOS/CHoCH Detected")
.ex5 / .mq5 file.The Smart Money Concepts (SMC) Suite gives retail traders access to institutional order flow mapping. It automatically identifies structural highs/lows, marks confirmed Break of Structure (BOS) levels, and highlights Change of Character (CHoCH) shifts without lag.
Need this indicator converted into an automated MT5 Expert Advisor or customized for your specific trading rules?
Order Custom Coding →Loading activity...
Just now