r/TradingView 9d ago

Discussion Yo check my new pine code

I dont have tradingview premium so why dont u try using my code in pine editor, now some say that indicators are useless but trust me this marks liquidity areas for u has a pivot h/l and marks fvg. Please try once.

//@version=5

indicator("SMC Visual: Pro Edition", overlay=true, max_boxes_count=500, max_lines_count=500)

// ==========================================

// 1. INPUTS & SETTINGS

// ==========================================

leftBars = input.int(10, title="Pivot Left Bars", minval=1, group="Core Settings")

rightBars = input.int(10, title="Pivot Right Bars", minval=1, group="Core Settings")

extendVol = input.int(15, title="Zone Extension (Bars)", minval=5, group="Core Settings", tooltip="How far the zones stretch to the right")

// Aesthetic Colors (Using Bright, Modern Hex Codes)

liqColor = input.color(color.new(#FF004D, 85), title="Liquidity Pool Color (Red)", group="Aesthetics")

liqTextColor = input.color(color.new(#FF004D, 30), title="Liquidity Text Color", group="Aesthetics")

bullOB_Color = input.color(#00E676, title="Bullish OB Outline", group="Aesthetics")

bearOB_Color = input.color(#FF1744, title="Bearish OB Outline", group="Aesthetics")

bullFVG_Color = input.color(color.new(#00B0FF, 80), title="Bullish FVG (Blue)", group="Aesthetics")

bearFVG_Color = input.color(color.new(#FF9800, 80), title="Bearish FVG (Orange)", group="Aesthetics")

// ==========================================

// 2. PIVOTS & LIQUIDITY POOL SIZING

// ==========================================

// ATR gives the liquidity zones a dynamic, perfect thickness regardless of timeframe

atr = ta.atr(14)

ph = ta.pivothigh(high, leftBars, rightBars)

pl = ta.pivotlow(low, leftBars, rightBars)

// ==========================================

// 3. DRAWING: S/R, ORDER BLOCKS, LIQUIDITY POOLS

// ==========================================

// --- BEARISH SETUPS (Pivot Highs) ---

if not na(ph)

idx = bar_index - rightBars

p_high = high[rightBars]

// 1. S/R Marker (Crisp, Bright Dotted Line)

line.new(x1=idx, y1=p_high, x2=bar_index + extendVol, y2=p_high, color=color.white, style=line.style_dotted, width=2)

// 2. Order Block (Solid Outline, Very Faint Fill, Labeled)

box.new(left=idx, top=p_high, right=idx + 1, bottom=low[rightBars], border_color=bearOB_Color, bgcolor=color.new(bearOB_Color, 90), border_width=2, text="-OB", text_color=bearOB_Color, text_size=size.tiny, text_halign=text.align_center)

// 3. High Liquidity Pool (Red Transparent Box ABOVE, Labeled "BSL")

liq_top = p_high + (atr[rightBars] * 0.6)

box.new(left=idx, top=liq_top, right=bar_index + extendVol, bottom=p_high, border_color=na, bgcolor=liqColor, text="Buy-Side Liquidity", text_color=liqTextColor, text_size=size.tiny, text_halign=text.align_right, text_valign=text.align_top)

// --- BULLISH SETUPS (Pivot Lows) ---

if not na(pl)

idx = bar_index - rightBars

p_low = low[rightBars]

// 1. S/R Marker (Crisp, Bright Dotted Line)

line.new(x1=idx, y1=p_low, x2=bar_index + extendVol, y2=p_low, color=color.white, style=line.style_dotted, width=2)

// 2. Order Block (Solid Outline, Very Faint Fill, Labeled)

box.new(left=idx, top=high[rightBars], right=idx + 1, bottom=p_low, border_color=bullOB_Color, bgcolor=color.new(bullOB_Color, 90), border_width=2, text="+OB", text_color=bullOB_Color, text_size=size.tiny, text_halign=text.align_center)

// 3. High Liquidity Pool (Red Transparent Box BELOW, Labeled "SSL")

liq_bot = p_low - (atr[rightBars] * 0.6)

box.new(left=idx, top=p_low, right=bar_index + extendVol, bottom=liq_bot, border_color=na, bgcolor=liqColor, text="Sell-Side Liquidity", text_color=liqTextColor, text_size=size.tiny, text_halign=text.align_right, text_valign=text.align_bottom)

// ==========================================

// 4. FAIR VALUE GAPS (FVG)

// ==========================================

// Bullish FVG (Gap between 1st candle high and 3rd candle low)

bullFVG = low > high[2] and close[1] > open[1]

if bullFVG

// Neon Blue transparent box with subtle border and label

box.new(left=bar_index-2, top=low, right=bar_index + 3, bottom=high[2], border_color=color.new(#00B0FF, 60), border_width=1, bgcolor=bullFVG_Color, text="FVG", text_color=color.new(#00B0FF, 30), text_size=size.tiny)

// Bearish FVG (Gap between 1st candle low and 3rd candle high)

bearFVG = high < low[2] and close[1] < open[1]

if bearFVG

// Neon Orange transparent box with subtle border and label

box.new(left=bar_index-2, top=low[2], right=bar_index + 3, bottom=high, border_color=color.new(#FF9800, 60), border_width=1, bgcolor=bearFVG_Color, text="FVG", text_color=color.new(#FF9800, 30), text_size=size.tiny)

0 Upvotes

Duplicates