Linh's Anomaly Radar v2

What this script does
Itโs an event detector for price/volume anomalies that often precede or confirm moves.
It watches a bunch of patterns (Wyckoff tests, squeezes, failed breakouts, turnover bursts, etc.), applies robust z-scores, optional trend filters, cooldowns (to avoid spam), and then fires:
A shape/label on the bar,
A row in the mini panel (top-right),
A ready-made alertcondition you can hook into.
How to add & set up (TradingView)
Paste the script โ Save โ Add to chart on Daily first (works on any TF).
Open Settings โ Inputs:
General
โข Use Robust Z (MAD): more outlier-resistant; keep on.
โข Z Lookback: 60 bars is ~3 months; bump to 120 for slower regimes.
โข Cooldown: min bars to wait before the same signal can fire again (default 5).
โข Use trend filter: if on, โbullishโ signals only fire above SMA(tfLen), โbearishโ below.
Thresholds: fine-tune sensitivity (defaults are sane).
To create alerts: Right-click chart โ Add alert
Condition: Linhโs Anomaly Radar v2 โ choose a specific signal or Composite (ฮฃ).
Options: โOnce per bar closeโ (recommended).
Customize message if you want ticker/timeframe in your phone push.
The mini panel (top-right)
Signal column: short code (see cheat sheet below).
Fired column: a dot โโขโ means that on the latest bar this signal fired.
Score (right column): total count of signals that fired this bar.
ฮฃโฅN shows your composite threshold (how many must fire to trigger the โCompositeโ alert).
Shapes & codes (whatโs what)
Code Name (category) What itโs looking for Why it matters
STL Stealth Volume z(volume)>5 & ** z(return)
EVR Effort vs Result squeeze z(vol)>3 & z(TR)<โ0.5 Heavy effort, tiny spread โ absorption
TGV Tight+Heavy (HL/ATR)<0.6 & z(vol)>3 Tight bar + heavy tape โ pro activity
CLS Accumulation cluster โฅ3 of last 5 bars: up, volโ, close near high Classic accumulation footprint
GAP Open drive failure Big gap not filled (โฅ80%) & volโ One-sided open stalls โ fade risk
BBโ BB squeeze breakout Squeeze (z(BBWidth)<โ1.3) โ close > upperBB & volโ Regime shift with confirmation
ERโ EffortโResult inversion Down day on vol then next bar > prior high Demand overwhelms supply
OBV OBV divergence OBV slope up & ** z(ret20)
WER Wide Effort, Opposite Result z(vol)>3, close<open, z(CLVM)>+1 Selling into strength / distribution
NS No-Supply (Wyckoff) Down bar, HL<0.6ยทATR, vol << avg Sellers absent into weakness
ND No-Demand (Wyckoff) Up bar, HL<0.6ยทATR, vol << avg Buyers absent into strength
VAC Liquidity Vacuum z(vol)<โ1.5 & ** z(ret)
UTD UTAD (failed breakout) Breaks swing-high, closes back below, volโ Stop-run, reversal risk
SPR Spring (failed breakdown) Breaks swing-low, closes back above, volโ Bear trap, reversal risk
PIV Pocket Pivot Up bar; vol > max down-vol in lookback Quiet base โ sudden demand
NR7 Narrow Range 7 + Vol HL is 7-bar low & z(vol)>2 Coiled spring with participation
52W 52-wk breakout quality New 52-wk close high + squeeze + volโ High-quality breakouts
VvK Vol-of-Vol kink z(ATR20,200)>0.5 & z(ATR5,60)<0 Long-vol wakes up, short-vol compresses
TAC Turnover acceleration SMA3 vol / SMA20 vol > 1.8 & muted return Participation surging before move
RBd RSI Bullish div Price LL, RSI HL, vol z>1 Exhaustion of sellers
RSโ RSI Bearish div Price HH, RSI LH, vol z>1 Exhaustion of buyers
ฮฃ Composite Count of all fired signals โฅ threshold High-conviction bar
Placement:
Triangles up (below bar) โ bullish-leaning events.
Triangles down (above bar) โ bearish-leaning events.
Circles โ neutral context (VAC, VvK, Composite).
Key inputs (quick reference)
General
Use Robust Z (MAD): keep on for noisy tickers.
Z Lookback (lenZ): 60 default; 120 if you want fewer alerts.
Trend filter: when on, bullish signals require close > SMA(tfLen), bearish require <.
Cooldown: prevents repeated firing of the same signal within N bars.
Phase-1 thresholds (core)
Stealth: vol z > 5, |ret z| < 1.
EVR: vol z > 3, TR z < โ0.5.
Tight+Heavy: (HL/ATR) < 0.6, vol z > 3.
Cluster: window=5, min=3 strong bars.
GapFail: gap/ATR โฅ1.5, fill <80%, vol z > 2.
BB Squeeze: z(BBWidth)<โ1.3 then breakout with vol z > 2.
EffโRes Up: prev bar heavy down โ current bar > prior high.
OBV Div: OBV uptrend + |z(ret20)|<0.3.
Phase-2 thresholds (extras)
WER: vol z > 3, close<open, z(CLVM)>1.
No-Supply/No-Demand: tight bar & very light volume vs SMA20.
Vacuum: vol z < โ1.5, |ret z|>1.5.
UTAD/Spring: swing lookback N (default 20), vol z > 2.
Pocket Pivot: lookback for prior down-vol max (default 10).
NR7: 7-bar narrowest range + vol z > 2.
52W Quality: new 52-wk high + squeeze + vol z > 2.
VoV Kink: z(ATR20,200)>0.5 AND z(ATR5,60)<0.
Turnover Accel: SMA3/SMA20 > 1.8 and |ret z|<1.
RSI Divergences: compare to n bars back (default 14).
How to use it (playbooks)
A) Daily scan workflow
Run on Daily for your VN watchlist.
Turn Composite (ฮฃ) alert on with ฮฃโฅ2 or โฅ3 to reduce noise.
When a bar fires ฮฃ (or a fav combo like STL + BBโ), drop to 60-min to time entries.
B) Breakout quality check
Look for 52W together with BBโ, TAC, and OBV.
If WER/ND appear near highs โ downgrade the breakout.
C) Spring/UTAD reversals
If SPR fires near major support and RBd confirms โ long bias with stop below spring low.
If UTD + WER/RSโ near resistance โ short/fade with stop above UTAD high.
D) Accumulation basing
During bases, you want CLS, OBV, TGV, STL, NR7.
A pocket pivot (PIV) can be your early add; manage risk below base lows.
Tuning tips
Too many signals? Raise stealthVolZ to 5.5โ6, evrVolZ to 3.5, use ฮฃโฅ3.
Fast movers? Lower bbwZthr to โ1.0 (less strict squeeze), keep trend filter on.
Illiquid tickers? Keep MAD z-scores on, increase lookbacks (e.g., lenZ=120).
Limitations & good habits
First lenZ bars on a new symbol are less reliable (incomplete z-window).
Some ideas (VWAP magnet, close auction spikes, ETF/foreign flows, options skew) need intraday/external feeds โ not included here.
Pine canโt โscreenโ across the whole market; set alerts or cycle your watchlist.
Quick troubleshooting
Compilation errors: make sure youโre on Pine v6; donโt nest functions in if blocks; each var int must be declared on its own line.
No shapes firing: check trend filter (maybe price is below SMA and youโre waiting for bullish signals), and verify thresholds arenโt too strict.
Itโs an event detector for price/volume anomalies that often precede or confirm moves.
It watches a bunch of patterns (Wyckoff tests, squeezes, failed breakouts, turnover bursts, etc.), applies robust z-scores, optional trend filters, cooldowns (to avoid spam), and then fires:
A shape/label on the bar,
A row in the mini panel (top-right),
A ready-made alertcondition you can hook into.
How to add & set up (TradingView)
Paste the script โ Save โ Add to chart on Daily first (works on any TF).
Open Settings โ Inputs:
General
โข Use Robust Z (MAD): more outlier-resistant; keep on.
โข Z Lookback: 60 bars is ~3 months; bump to 120 for slower regimes.
โข Cooldown: min bars to wait before the same signal can fire again (default 5).
โข Use trend filter: if on, โbullishโ signals only fire above SMA(tfLen), โbearishโ below.
Thresholds: fine-tune sensitivity (defaults are sane).
To create alerts: Right-click chart โ Add alert
Condition: Linhโs Anomaly Radar v2 โ choose a specific signal or Composite (ฮฃ).
Options: โOnce per bar closeโ (recommended).
Customize message if you want ticker/timeframe in your phone push.
The mini panel (top-right)
Signal column: short code (see cheat sheet below).
Fired column: a dot โโขโ means that on the latest bar this signal fired.
Score (right column): total count of signals that fired this bar.
ฮฃโฅN shows your composite threshold (how many must fire to trigger the โCompositeโ alert).
Shapes & codes (whatโs what)
Code Name (category) What itโs looking for Why it matters
STL Stealth Volume z(volume)>5 & ** z(return)
EVR Effort vs Result squeeze z(vol)>3 & z(TR)<โ0.5 Heavy effort, tiny spread โ absorption
TGV Tight+Heavy (HL/ATR)<0.6 & z(vol)>3 Tight bar + heavy tape โ pro activity
CLS Accumulation cluster โฅ3 of last 5 bars: up, volโ, close near high Classic accumulation footprint
GAP Open drive failure Big gap not filled (โฅ80%) & volโ One-sided open stalls โ fade risk
BBโ BB squeeze breakout Squeeze (z(BBWidth)<โ1.3) โ close > upperBB & volโ Regime shift with confirmation
ERโ EffortโResult inversion Down day on vol then next bar > prior high Demand overwhelms supply
OBV OBV divergence OBV slope up & ** z(ret20)
WER Wide Effort, Opposite Result z(vol)>3, close<open, z(CLVM)>+1 Selling into strength / distribution
NS No-Supply (Wyckoff) Down bar, HL<0.6ยทATR, vol << avg Sellers absent into weakness
ND No-Demand (Wyckoff) Up bar, HL<0.6ยทATR, vol << avg Buyers absent into strength
VAC Liquidity Vacuum z(vol)<โ1.5 & ** z(ret)
UTD UTAD (failed breakout) Breaks swing-high, closes back below, volโ Stop-run, reversal risk
SPR Spring (failed breakdown) Breaks swing-low, closes back above, volโ Bear trap, reversal risk
PIV Pocket Pivot Up bar; vol > max down-vol in lookback Quiet base โ sudden demand
NR7 Narrow Range 7 + Vol HL is 7-bar low & z(vol)>2 Coiled spring with participation
52W 52-wk breakout quality New 52-wk close high + squeeze + volโ High-quality breakouts
VvK Vol-of-Vol kink z(ATR20,200)>0.5 & z(ATR5,60)<0 Long-vol wakes up, short-vol compresses
TAC Turnover acceleration SMA3 vol / SMA20 vol > 1.8 & muted return Participation surging before move
RBd RSI Bullish div Price LL, RSI HL, vol z>1 Exhaustion of sellers
RSโ RSI Bearish div Price HH, RSI LH, vol z>1 Exhaustion of buyers
ฮฃ Composite Count of all fired signals โฅ threshold High-conviction bar
Placement:
Triangles up (below bar) โ bullish-leaning events.
Triangles down (above bar) โ bearish-leaning events.
Circles โ neutral context (VAC, VvK, Composite).
Key inputs (quick reference)
General
Use Robust Z (MAD): keep on for noisy tickers.
Z Lookback (lenZ): 60 default; 120 if you want fewer alerts.
Trend filter: when on, bullish signals require close > SMA(tfLen), bearish require <.
Cooldown: prevents repeated firing of the same signal within N bars.
Phase-1 thresholds (core)
Stealth: vol z > 5, |ret z| < 1.
EVR: vol z > 3, TR z < โ0.5.
Tight+Heavy: (HL/ATR) < 0.6, vol z > 3.
Cluster: window=5, min=3 strong bars.
GapFail: gap/ATR โฅ1.5, fill <80%, vol z > 2.
BB Squeeze: z(BBWidth)<โ1.3 then breakout with vol z > 2.
EffโRes Up: prev bar heavy down โ current bar > prior high.
OBV Div: OBV uptrend + |z(ret20)|<0.3.
Phase-2 thresholds (extras)
WER: vol z > 3, close<open, z(CLVM)>1.
No-Supply/No-Demand: tight bar & very light volume vs SMA20.
Vacuum: vol z < โ1.5, |ret z|>1.5.
UTAD/Spring: swing lookback N (default 20), vol z > 2.
Pocket Pivot: lookback for prior down-vol max (default 10).
NR7: 7-bar narrowest range + vol z > 2.
52W Quality: new 52-wk high + squeeze + vol z > 2.
VoV Kink: z(ATR20,200)>0.5 AND z(ATR5,60)<0.
Turnover Accel: SMA3/SMA20 > 1.8 and |ret z|<1.
RSI Divergences: compare to n bars back (default 14).
How to use it (playbooks)
A) Daily scan workflow
Run on Daily for your VN watchlist.
Turn Composite (ฮฃ) alert on with ฮฃโฅ2 or โฅ3 to reduce noise.
When a bar fires ฮฃ (or a fav combo like STL + BBโ), drop to 60-min to time entries.
B) Breakout quality check
Look for 52W together with BBโ, TAC, and OBV.
If WER/ND appear near highs โ downgrade the breakout.
C) Spring/UTAD reversals
If SPR fires near major support and RBd confirms โ long bias with stop below spring low.
If UTD + WER/RSโ near resistance โ short/fade with stop above UTAD high.
D) Accumulation basing
During bases, you want CLS, OBV, TGV, STL, NR7.
A pocket pivot (PIV) can be your early add; manage risk below base lows.
Tuning tips
Too many signals? Raise stealthVolZ to 5.5โ6, evrVolZ to 3.5, use ฮฃโฅ3.
Fast movers? Lower bbwZthr to โ1.0 (less strict squeeze), keep trend filter on.
Illiquid tickers? Keep MAD z-scores on, increase lookbacks (e.g., lenZ=120).
Limitations & good habits
First lenZ bars on a new symbol are less reliable (incomplete z-window).
Some ideas (VWAP magnet, close auction spikes, ETF/foreign flows, options skew) need intraday/external feeds โ not included here.
Pine canโt โscreenโ across the whole market; set alerts or cycle your watchlist.
Quick troubleshooting
Compilation errors: make sure youโre on Pine v6; donโt nest functions in if blocks; each var int must be declared on its own line.
No shapes firing: check trend filter (maybe price is below SMA and youโre waiting for bullish signals), and verify thresholds arenโt too strict.
Penafian
Maklumat dan penerbitan adalah tidak bertujuan, dan tidak membentuk, nasihat atau cadangan kewangan, pelaburan, dagangan atau jenis lain yang diberikan atau disahkan oleh TradingView. Baca lebih dalam Terma Penggunaan.
Penafian
Maklumat dan penerbitan adalah tidak bertujuan, dan tidak membentuk, nasihat atau cadangan kewangan, pelaburan, dagangan atau jenis lain yang diberikan atau disahkan oleh TradingView. Baca lebih dalam Terma Penggunaan.