This overlay indicator tracks confirmed swing highs and lows as liquidity levels and marks a break of structure when the close moves beyond the last swing.
1Copy the scriptPress Copy script above, or the copy button on the code below.
2Open the Pine EditorOpen a TradingView chart and choose Pine Editor at the bottom of the screen.
3Paste over the templateCreate a new indicator, select all of the template text and paste. Press Save and give it a name.
4Add it to the chartPress Add to chart, then adjust the settings with the gear icon next to its name.
Source Code
57 lines of Pine Script v5 from pine/smc_entry_filter.pine, published under MIT. Keep the author's credit and licence lines when you reuse it.
smc_entry_filter.pine
//@version=5
indicator("SMC Entry Filter", overlay=true, max_boxes_count=50, max_lines_count=50)
// ICT / SMC research overlay: swings, BOS, FVG, hug-zone filter near key liquidity.
// Not a signal service. Use on liquid futures (ES / NQ 5m typical).
swingLen = input.int(5, "Swing lookback", minval=2, maxval=20)
atrLen = input.int(14, "ATR length")
fvgAtrFrac = input.float(0.15, "Min FVG size (ATR)", minval=0.01, step=0.05)
hugAtrFrac = input.float(0.25, "Hug zone (ATR) — skip entries this close to the broken level", minval=0.05, step=0.05)
dispAtrFrac = input.float(0.35, "Displacement body (ATR)", minval=0.05, step=0.05)
nySessionOnly = input.bool(true, "NY session only (09:30-16:00 ET)")
showFvg = input.bool(true, "Draw FVG boxes")
atr = ta.atr(atrLen)
ph = ta.pivothigh(high, swingLen, swingLen)
pl = ta.pivotlow(low, swingLen, swingLen)
var float lastSwingHigh = na
var float lastSwingLow = na
if not na(ph)
lastSwingHigh := ph
if not na(pl)
lastSwingLow := pl
inNy = not nySessionOnly or not na(time(timeframe.period, "0930-1600", "America/New_York"))
bullFvg = low > high[2] and (low - high[2]) >= atr * fvgAtrFrac
bearFvg = high < low[2] and (low[2] - high) >= atr * fvgAtrFrac
plotshape(showFvg and bullFvg, title="Bull FVG", style=shape.triangleup, location=location.belowbar, size=size.tiny, color=color.new(color.teal, 0))
plotshape(showFvg and bearFvg, title="Bear FVG", style=shape.triangledown, location=location.abovebar, size=size.tiny, color=color.new(color.maroon, 0))
bosUp = not na(lastSwingHigh) and close > lastSwingHigh and close[1] <= lastSwingHigh
bosDn = not na(lastSwingLow) and close < lastSwingLow and close[1] >= lastSwingLow
body = math.abs(close - open)
displaced = body >= atr * dispAtrFrac
hugHigh = not na(lastSwingHigh) and math.abs(close - lastSwingHigh) <= atr * hugAtrFrac
hugLow = not na(lastSwingLow) and math.abs(close - lastSwingLow) <= atr * hugAtrFrac
longOk = inNy and bosUp and close > open and displaced and not hugHigh
shortOk = inNy and bosDn and close < open and displaced and not hugLow
plot(lastSwingHigh, "Liquidity high", color=color.new(color.red, 40), style=plot.style_linebr)
plot(lastSwingLow, "Liquidity low", color=color.new(color.green, 40), style=plot.style_linebr)
plotshape(bosUp, "Raw BOS up", style=shape.circle, location=location.belowbar, size=size.tiny, color=color.new(color.gray, 30))
plotshape(bosDn, "Raw BOS down", style=shape.circle, location=location.abovebar, size=size.tiny, color=color.new(color.gray, 30))
plotshape(longOk, "Filtered long", style=shape.labelup, location=location.belowbar, text="L", size=size.small, color=color.new(color.teal, 0), textcolor=color.white)
plotshape(shortOk, "Filtered short", style=shape.labeldown, location=location.abovebar, text="S", size=size.small, color=color.new(color.maroon, 0), textcolor=color.white)
alertcondition(longOk, "SMC filtered long", "Filtered long: BOS up, displacement, not hugging liquidity high")
alertcondition(shortOk, "SMC filtered short", "Filtered short: BOS down, displacement, not hugging liquidity low")
Overview
SMC Entry Filter detects bullish and bearish fair value gaps that meet a minimum ATR size, then plots filtered long and short labels only when the close is directional, the candle body meets a displacement threshold, price is not still hugging the broken level, and the optional New York session window is active. Raw breaks remain visible as circles, and alerts fire on the filtered signals. It is not a strategy and has no stop, target, or position size.
The inputs you can change from the gear icon on the chart. Defaults are the author's.
Setting
Type
Default
Variable
Swing lookback
int
5
swingLen
ATR length
int
14
atrLen
Min FVG size (ATR)
float
0.15
fvgAtrFrac
Hug zone (ATR) — skip entries this close to the broken level
float
0.25
hugAtrFrac
Displacement body (ATR)
float
0.35
dispAtrFrac
NY session only (09:30-16:00 ET)
bool
true
nySessionOnly
Draw FVG boxes
bool
true
showFvg
Third-party code. ForexR did not write, test or endorse this script, and the summary above was generated automatically from its code and README. Indicators describe the past, and a strategy's backtest can look better than live trading, especially when a script repaints. Check it in the Strategy Tester and on a demo account before you rely on it.
Apex Protocol - The SMC Engine is a comprehensive Smart Money Concepts indicator that overlays key market structure levels directly on the main price chart. It calculates internal and external market structures (BOS and MSS), Order Blocks, Fair Value Gaps (FVG
This indicator plots session boxes for Asian, London and New York sessions on the price chart along with an opening range breakout (ORB) box and midpoint. It displays an interactive dashboard and labels for confirmed-bar ORB states including forming, closed, b
The Golden Bullet Strategy is an overlay signal indicator based on Smart Money Concepts and time-based liquidity models. It identifies liquidity sweeps of a designated reference session range during a specified hunt window. It then confirms Market Structure Sh
Indicatorv6SMC / ICT / price actionSessions & time
This indicator overlays options gamma-exposure levels, session VWAP bands, and intraday market structure tools directly on the price chart. It provides three modular components: strike walls with standard deviation bands and opening ranges, a gamma regime engi
This indicator tracks smart money market structure directly on the price chart. It calculates dual-period swing highs and swing lows to detect Changes of Character (CHoCH), Breaks of Structure (BOS), inducements, and liquidity sweeps. When structural levels ar
The CISD with Fib/Range Extensions and Stats indicator tracks Change in State of Delivery (CISD) level breakouts on the price chart. It detects pullback structures filtered by ATR and volume conditions, then projects future target levels using customizable Fib