OPEN-SOURCE SCRIPT
SMC Volatility Liquidity Pro

this one’s a confluence signaler. it fires “BUY CALL” / “BUY PUT” labels only when four things line up at once: trend, volatility squeeze, a liquidity sweep, and MACD momentum. quick breakdown:
what each block does
Trend filter (context)
ema50 > ema200 ⇒ trendUp
ema50 < ema200 ⇒ trendDn
Plots both EMAs for visual context.
Volatility compression (setup)
20-period Bollinger Bands (stdev 2).
bb_squeeze is true when current band width < its 20-SMA ⇒ price is compressed (potential energy building).
Liquidity sweep (trigger)
Tracks 20-bar swing high/low.
Long sweep: high > swingHigh[1] ⇒ price just poked above the prior 20-bar high (took buy-side liquidity).
Short sweep: low < swingLow[1] ⇒ price just poked below the prior 20-bar low (took sell-side liquidity).
MACD momentum (confirmation)
Standard MACD(12,26,9) histogram.
Bullish: hist > 0 and rising versus previous bar.
Bearish: hist < 0 and falling.
the actual entry signals
LongEntry = trendUp AND bb_squeeze AND liquiditySweepLong AND macdBullish
→ prints a green “BUY CALL” label below the bar.
ShortEntry = trendDn AND bb_squeeze AND liquiditySweepShort AND macdBearish
→ prints a red “BUY PUT” label above the bar.
alerts & dashboard
Alerts: fires when those long/short conditions hit so you can set TradingView alerts on them.
On-chart dashboard (bottom-right):
Trend (Bullish/Bearish/Neutral)
Squeeze (Yes/No)
Liquidity (Long/Short/None)
Momentum (Bullish/Bearish/Neutral)
Current Signal (BUY CALL / BUY PUT / WAIT)
(btw the comment says “2 columns × 5 rows” but the table is actually 5 columns × 2 rows—values under each label across the row.)
what it’s trying to capture (in plain english)
Trade with the higher-timeframe bias (EMA 50 over 200).
Enter as volatility compresses (bands tight) and a sweep grabs stops beyond a 20-bar extreme.
Only pull the trigger when momentum agrees (MACD hist direction & side of zero).
caveats / tips
It’s an indicator, not a strategy—no entries/exits/backtests baked in.
Signals are strict (4 filters), so you’ll get fewer but “cleaner” prints; still not magical.
The liquidity-sweep check uses the prior bar’s 20-bar high/low ([1]), so on bar close it won’t repaint; intrabar alerts may feel jumpy if you alert “on every tick.”
Consider adding:
Exit logic (e.g., ATR stop + take-profit, or opposite signal).
Minimum squeeze duration (e.g., bb_squeeze true for N bars) to avoid one-bar dips in width.
Cool-down after a signal to prevent clustering.
Session/time or volume filter if you only want liquid hours.
if you want, I can convert this into a backtestable strategy() version with ATR-based stops/targets and a few toggles, so you can see stats right away.
what each block does
Trend filter (context)
ema50 > ema200 ⇒ trendUp
ema50 < ema200 ⇒ trendDn
Plots both EMAs for visual context.
Volatility compression (setup)
20-period Bollinger Bands (stdev 2).
bb_squeeze is true when current band width < its 20-SMA ⇒ price is compressed (potential energy building).
Liquidity sweep (trigger)
Tracks 20-bar swing high/low.
Long sweep: high > swingHigh[1] ⇒ price just poked above the prior 20-bar high (took buy-side liquidity).
Short sweep: low < swingLow[1] ⇒ price just poked below the prior 20-bar low (took sell-side liquidity).
MACD momentum (confirmation)
Standard MACD(12,26,9) histogram.
Bullish: hist > 0 and rising versus previous bar.
Bearish: hist < 0 and falling.
the actual entry signals
LongEntry = trendUp AND bb_squeeze AND liquiditySweepLong AND macdBullish
→ prints a green “BUY CALL” label below the bar.
ShortEntry = trendDn AND bb_squeeze AND liquiditySweepShort AND macdBearish
→ prints a red “BUY PUT” label above the bar.
alerts & dashboard
Alerts: fires when those long/short conditions hit so you can set TradingView alerts on them.
On-chart dashboard (bottom-right):
Trend (Bullish/Bearish/Neutral)
Squeeze (Yes/No)
Liquidity (Long/Short/None)
Momentum (Bullish/Bearish/Neutral)
Current Signal (BUY CALL / BUY PUT / WAIT)
(btw the comment says “2 columns × 5 rows” but the table is actually 5 columns × 2 rows—values under each label across the row.)
what it’s trying to capture (in plain english)
Trade with the higher-timeframe bias (EMA 50 over 200).
Enter as volatility compresses (bands tight) and a sweep grabs stops beyond a 20-bar extreme.
Only pull the trigger when momentum agrees (MACD hist direction & side of zero).
caveats / tips
It’s an indicator, not a strategy—no entries/exits/backtests baked in.
Signals are strict (4 filters), so you’ll get fewer but “cleaner” prints; still not magical.
The liquidity-sweep check uses the prior bar’s 20-bar high/low ([1]), so on bar close it won’t repaint; intrabar alerts may feel jumpy if you alert “on every tick.”
Consider adding:
Exit logic (e.g., ATR stop + take-profit, or opposite signal).
Minimum squeeze duration (e.g., bb_squeeze true for N bars) to avoid one-bar dips in width.
Cool-down after a signal to prevent clustering.
Session/time or volume filter if you only want liquid hours.
if you want, I can convert this into a backtestable strategy() version with ATR-based stops/targets and a few toggles, so you can see stats right away.
สคริปต์โอเพนซอร์ซ
ด้วยเจตนารมณ์หลักของ TradingView ผู้สร้างสคริปต์นี้ได้ทำให้มันเป็นโอเพ่นซอร์ส เพื่อให้เทรดเดอร์สามารถตรวจสอบและยืนยันการทำงานของสคริปต์ได้ ขอแสดงความชื่นชมผู้เขียน! แม้ว่าคุณจะสามารถใช้งานได้ฟรี แต่อย่าลืมว่าการเผยแพร่โค้ดซ้ำนั้นจะต้องเป็นไปตามกฎระเบียบการใช้งานของเรา
คำจำกัดสิทธิ์ความรับผิดชอบ
ข้อมูลและบทความไม่ได้มีวัตถุประสงค์เพื่อก่อให้เกิดกิจกรรมทางการเงิน, การลงทุน, การซื้อขาย, ข้อเสนอแนะ หรือคำแนะนำประเภทอื่น ๆ ที่ให้หรือรับรองโดย TradingView อ่านเพิ่มเติมที่ ข้อกำหนดการใช้งาน
สคริปต์โอเพนซอร์ซ
ด้วยเจตนารมณ์หลักของ TradingView ผู้สร้างสคริปต์นี้ได้ทำให้มันเป็นโอเพ่นซอร์ส เพื่อให้เทรดเดอร์สามารถตรวจสอบและยืนยันการทำงานของสคริปต์ได้ ขอแสดงความชื่นชมผู้เขียน! แม้ว่าคุณจะสามารถใช้งานได้ฟรี แต่อย่าลืมว่าการเผยแพร่โค้ดซ้ำนั้นจะต้องเป็นไปตามกฎระเบียบการใช้งานของเรา
คำจำกัดสิทธิ์ความรับผิดชอบ
ข้อมูลและบทความไม่ได้มีวัตถุประสงค์เพื่อก่อให้เกิดกิจกรรมทางการเงิน, การลงทุน, การซื้อขาย, ข้อเสนอแนะ หรือคำแนะนำประเภทอื่น ๆ ที่ให้หรือรับรองโดย TradingView อ่านเพิ่มเติมที่ ข้อกำหนดการใช้งาน