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
54 lines of Pine Script v5 from pro-smc-fvg-indicator.pine, published under GPL-3.0. Keep the author's credit and licence lines when you reuse it.
pro-smc-fvg-indicator.pine
//@version=5
indicator("🔥 Pro SMC Fair Value Gap (FVG) Indicator", overlay=true)
// === INPUTS === //
showBullishFVG = input.bool(true, "Show Bullish FVG")
showBearishFVG = input.bool(true, "Show Bearish FVG")
bullColor = input.color(color.new(color.green, 60), "Bullish FVG Fill")
bearColor = input.color(color.new(color.red, 60), "Bearish FVG Fill")
bullBorder = input.color(color.green, "Bullish FVG Border")
bearBorder = input.color(color.red, "Bearish FVG Border")
labelSize = input.string("small", "Label Size", options=["tiny", "small", "normal", "large", "huge"])
maxBoxes = input.int(100, "Max Boxes on Chart")
useStrongDisplacement = input.bool(true, "Use Displacement Filter (ATR-based)")
displacementMultiplier = input.float(1.5, "Displacement Strength", step=0.1)
// === CONDITIONS === //
body = math.abs(close - open)
displacement = body > ta.atr(14) * displacementMultiplier
isBullishFVG = low > high[2]
isBearishFVG = high < low[2]
validBullFVG = isBullishFVG and (not useStrongDisplacement or displacement)
validBearFVG = isBearishFVG and (not useStrongDisplacement or displacement)
// === STORAGE === //
var box[] fvgBoxes = array.new_box()
var label[] fvgLabels = array.new_label()
// === DRAWING === //
if showBullishFVG and validBullFVG
b = box.new(left=bar_index[2], right=bar_index, top=low, bottom=high[2], bgcolor=bullColor, border_color=bullBorder)
l = label.new(x=bar_index, y=low, text="Bullish FVG", style=label.style_label_up, textcolor=color.white, size=labelSize, color=color.green)
array.push(fvgBoxes, b)
array.push(fvgLabels, l)
if showBearishFVG and validBearFVG
b = box.new(left=bar_index[2], right=bar_index, top=high[2], bottom=low, bgcolor=bearColor, border_color=bearBorder)
l = label.new(x=bar_index, y=high, text="Bearish FVG", style=label.style_label_down, textcolor=color.white, size=labelSize, color=color.red)
array.push(fvgBoxes, b)
array.push(fvgLabels, l)
// === AUTO DELETE OLD OBJECTS === //
if array.size(fvgBoxes) > maxBoxes
oldBox = array.shift(fvgBoxes)
box.delete(oldBox)
if array.size(fvgLabels) > maxBoxes
oldLabel = array.shift(fvgLabels)
label.delete(oldLabel)
// === ALERTS === //
alertcondition(validBullFVG, title="Bullish FVG Detected", message="Bullish Fair Value Gap formed!")
alertcondition(validBearFVG, title="Bearish FVG Detected", message="Bearish Fair Value Gap formed!")
Overview
Pro SMC Fair Value Gap (FVG) Indicator features an optional ATR-based displacement filter to isolate gaps formed during strong market momentum. Detected gaps are displayed directly on the price chart as customizable colored fill boxes and text labels. Users can adjust display parameters, such as box colors, border colors, label sizes, displacement thresholds, and set a maximum limit on active chart boxes to maintain visual clarity.
The inputs you can change from the gear icon on the chart. Defaults are the author's.
Setting
Type
Default
Variable
Show Bullish FVG
bool
true
showBullishFVG
Show Bearish FVG
bool
true
showBearishFVG
Bullish FVG Fill
color
color.new(color.green, 60)
bullColor
Bearish FVG Fill
color
color.new(color.red, 60)
bearColor
Bullish FVG Border
color
color.green
bullBorder
Bearish FVG Border
color
color.red
bearBorder
Label Size
string
small
labelSize
Max Boxes on Chart
int
100
maxBoxes
Use Displacement Filter (ATR-based)
bool
true
useStrongDisplacement
Displacement Strength
float
1.5
displacementMultiplier
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.
This overlay indicator marks ICT liquidity void fills on the price chart and can show long and short signals. It places a Fibonacci level inside a displacement candle, defaulting to the midpoint, and draws lines in a chosen style. Optional filters limit the fi
This indicator maps market structure and supply and demand zones on the price chart. It marks validated and optional unvalidated swing highs and lows using a pivot length and extra confirmation bars. Consolidation and impulse moves are measured against ATR to
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 Pine Script indicator overlays institutional liquidity levels on the price chart. It identifies order block levels using pivot highs and lows, then draws mean reversion lines from the 20 and 50 period simple moving averages, a volatility range midpoint pr
This indicator combines six trading tools into a single chart overlay to optimize indicator limits. It calculates Bollinger Bands, projects weekend price boundaries, plots market structure elements like order blocks, breaker blocks, and MSB lines, marks New Yo
This indicator combines Centered Triangular Moving Average (TMA) bands offset by Average True Range (ATR) with Smart Money Concepts (SMC) market structure analysis on the price chart. It calculates upper, center, and lower bands alongside swing and internal ma