Linh's Anomaly Radar v2

860
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.

Pernyataan Penyangkalan

Informasi dan publikasi ini tidak dimaksudkan, dan bukan merupakan, saran atau rekomendasi keuangan, investasi, trading, atau jenis lainnya yang diberikan atau didukung oleh TradingView. Baca selengkapnya di Ketentuan Penggunaan.