OPEN-SOURCE SCRIPT
Mis à jour

Oversold Screener · Webhook v3.3

178
#Oversold Screener · Webhook v3.3

US Equities · 15-minute signals · AVWAP entries A–F · Optional CVD gate

## TL;DR

This indicator finds short-term, emotion-driven selloffs in large, liquid US stocks and pings your webhook with a compact alert (symbol + 15-minute close time).
It anchors an Event-AVWAP at the first qualified 15-minute bar after the selloff and proposes disciplined “right-side” entries (A–F) as price mean-reverts back through statistically defined bands. Optional macro fuses and CVD filters help avoid catching knives.

---

## What it does

1. Universe filter (off-chart): You run this on constituents of S&P 500 / Nasdaq-100 / Nasdaq Golden Dragon (or your curated list of healthy companies).
2. Signal (Step-2): On the 15-minute timeframe—including extended hours—the script flags an “oversold event” when:
• Depth: Today’s drawdown vs yesterday’s RTH reference (min of yesterday’s VWAP and Close) is large.
• Relative: The stock underperforms both its market benchmark (e.g., SPY/QQQ) and its sector ETF over the same 16/32×15m windows.
• Macro fuses: If any of the following exceed thresholds, the signal is suppressed: VIX spike, market 16/32×15m selloff, sector 16/32×15m selloff.
• RSI guard: 1-hour RSI is below a configurable level (default 30).
• Cooldown: De-dupes repeated events; you won’t be spammed by the same name intraday.
3. Execution geometry: At the event bar’s close the indicator anchors an AVWAP calculated natively in 15m space and draws ±1σ/±2σ/±3σ bands from a rolling variance of typical price.
4. Entry proposals: It labels A–F entries when price regains key bands after first probing the lower ones (see below). Optional 15m CVD confirmation can be required.
5. Alerts: When the event closes, TradingView raises a single alert with a tiny JSON payload so your downstream AI/service can do the news check and decide.

---

## Why this approach works

• Depth vs yesterday’s RTH reference targets “fresh” dislocations rather than slow trends.
• Relative filters ensure the stock fell much more than both the market and its sector, isolating idiosyncratic panic.
• AVWAP from the event bar approximates the market’s true average position after the shock; band reclaims are robust right-side confirmations.
• Optional CVD (delta volume) catches sell-side exhaustion and buy-side emergence without requiring a full order-book feed.
• Macro fuses (VIX / market / sector) avoid swimming against systemic stress.

---

## Inputs (key)

Bench ETF / Sector ETF
Choose your market (SPY or QQQ) and sector ETF (XLK/XLF/XLY… or KWEB/CQQQ for China tech ADRs).

Depth & relative settings (15-minute space)
• Depth vs prior-day RTH reference: percentage thresholds for 16 and 32 bars.
• Relative to market & sector: underperformance thresholds over 16 and 32 bars.

Macro circuit breakers
• VIX max change (e.g., +8%/+12% over the session)
• Market max 16/32×15m selloff (e.g., −1.5% / −2.5%)
• Sector max 16/32×15m selloff (e.g., −2.0% / −3.0%)
If any one exceeds the limit, the signal is suppressed.

Momentum guard
• RSI(1h) < 30 (configurable).

AVWAP band engine (15m native)
• Bands: ±1σ / ±2σ / ±3σ with EMA smoothing and optional σ cap.
• Settling bars after anchor (default 1–3) to reduce immediate whipsaws.

Entry toggles
• Enable/disable A, B, C, D, E, F individually.
• Optional CVD gate (on/off), lookback window and reversal thresholds.

Housekeeping
• Debounce per ticker and per entry type.
• Entry window length (default 1 week) and per-type cap (show top 3 per event).
• Webhook on/off.

---

## Entries (A–F)

These are right-side confirmations; each requires first touching the prerequisite lower band before reclaiming a higher one.

A Touch ≤ −2σ, then cross up through −1σ (classic exhaustion → relief).
B Touch ≤ −1σ, then reclaim AVWAP (crowd average changes hands).
C Break −1σ up, retest near −1σ within N bars, then bounce (retest confirmation).
D After compression (low ATR%), reclaim AVWAP (coiled spring).
E Touch ≤ −2σ, then reclaim AVWAP after a base (deeper flush → stronger reclaim).
F Touch ≤ −3σ, then cross up through −1σ (capitulation → violent mean reversion).

Optional CVD gate (15m): require sell-pressure exhaustion and a CVD turn-up before validating entries. Defaults are conservative so that A/F remain the highest-quality.

---

## Alert payload (minimal by design)

On event close, one alert is fired with a tiny JSON:

{
"event": "step2_signal",
"symbol": "TSLA",
"ts_15m_ms": 1730879700000
}

Use “Once per bar close” and the 15-minute chart. Your webhook receiver can enrich with fundamentals/news and decide Allow / Hold / Reject, then monitor A–F entries for execution.

---

## How to use

1. Run on your 15-minute chart with extended session enabled.
2. Create one alert per chart (or use TradingView’s multi-chart / watchlist alerts if you have Pro+).
3. Your backend ingests the minimal payload, fetches news and fundamentals, and returns a decision.
4. For Allowed names, watch the on-chart A–F labels; scale in across levels, scale out into upper HVNs/POC or AVWAP give-back.

---

## Defaults that work well

• RSI(1h) < 30
• Depth vs yesterday’s RTH ref: ≤ −4% (16 bars), ≤ −6% (32 bars)
• Relative to market/sector: ≤ −3% (16 bars), ≤ −4% (32 bars)
• Macro fuses: VIX day change ≤ +10%; market ≤ −2.0% / −3.0%; sector ≤ −2.5% / −3.5%
• AVWAP bands: EMA(σ)=3; σ cap off; settle ≥ 1 bar
• CVD gate off initially; enable after you’re comfortable with its behavior.

---

## Notes & limitations

• Indicator, not a strategy: it proposes event points and entries; position sizing and exits are up to you.
• Designed for US equities with ample liquidity; thin names will be noisy.
• Repainting: AVWAP and bands are anchored and do not repaint; entries are evaluated on bar close.
• To keep charts readable, we limit entry labels to the first three occurrences per type within the one-week window.

---

## What’s new in v3.3

• 15-minute event engine (always 15m, independent of the chart you view).
• Depth measured vs yesterday’s RTH VWAP/CLOSE (the lower of the two).
• Removed structure-health (SMA50 coverage) and MA50/200 position checks.
• Macro circuit breakers: VIX + market + sector thresholds; any one trips a fuse.
• RSI guard moved to 1-hour.
• AVWAP bands include ±3σ and new Entry F (−3σ → −1σ reclaim).
• Optional 15m CVD gate for entries.
• Minimal webhook payload for fast downstream AI checks.
• Debounce + entry-window caps to prevent over-labeling and to focus the week after the event.
• Numerous performance and stability tweaks in the 15m security sandbox.

---

## Disclaimer

This is a research tool. It does not constitute investment advice. Test in Replay first, start with small size, and respect your risk.
Notes de version
# Step-2 Oversold Screener · v3.3

US equities · 15-minute event engine · AVWAP entries A–F · optional CVD/RSI/Z guards

## What this script does

Finds short, emotion-driven selloffs in large, healthy US stocks and turns them into actionable, right-side opportunities.
On a qualified 15-minute close it:

1. emits a minimal webhook so your backend/AI can vet the news and fundamentals, and
2. anchors an Event-AVWAP and plots ±1/±2/±3σ bands to guide entries A–F as price mean-reverts.

The logic runs in a fixed 15-minute space, independent of the chart timeframe you view.

## How an event is detected (Step-2 signal)

All conditions are evaluated on 15-minute data, including extended hours.

Depth, measured vs yesterday’s RTH reference

* Reference = min(yesterday’s RTH VWAP proxy, yesterday’s Close).
* 4h depth: current price vs reference across 16×15m bars ≤ threshold (default −4%).
* 8h depth: lowest close across the last 32×15m bars vs reference ≤ threshold (default −6%).

Relative underperformance

* Versus market ETF (SPY/QQQ) and sector ETF (XLK/XLF/XLY… or KWEB/CQQQ).
* Uses the same 16/32×15m windows; stock must be weaker by at least the set margins (default −3%).

Macro circuit breakers (any one trips = suppress signal)

* VIX level ≥ fuse (default 28).
* Market 4h/8h drawdown ≤ limits (default −2.0% / −3.5%).
* Sector 4h/8h drawdown ≤ limits (default −2.5% / −4.0%).

Momentum and distribution guards

* RSI(1h) < 30 by default (computed from 15m series).
* Optional Z-score filters: stock Z ≤ zTrig, and macro Z floors for market/sector.
* Cooldown per symbol so you don’t get spammed by repeated events.

When the event closes, the script posts a tiny JSON to your alert webhook and pins an on-chart “S2” marker at the event bar.

## Event-AVWAP and bands

From the event bar forward the script computes AVWAP natively in 15m space and draws bands at ±1σ/±2σ/±3σ.
σ is a rolling standard deviation of typical price with optional EMA smoothing and an optional cap.

Why this helps

* AVWAP from the shock timestamp approximates the crowd’s average position after the selloff.
* Reclaiming key bands often marks the start of orderly mean reversion rather than a dead-cat bounce.

## Entry proposals A–F (right-side confirmations)

Each entry requires first touching a lower band, then reclaiming a higher band.

A touch ≤ −2σ, then cross up through −1σ
B touch ≤ −1σ, then reclaim AVWAP
C break above −1σ, retest near −1σ within N bars, then bounce
D after compression (low ATR%), reclaim AVWAP
E touch ≤ −3σ, then cross up through −2σ
F touch ≤ −3σ, then cross up through −1σ (fast, aggressive)

Labeling hygiene

* Only the first three occurrences of each type A–F are shown within a one-week window after the event.
* A debounce interval avoids over-labeling across adjacent bars.

## Optional CVD gate (order-flow confirmation)

When enabled, entries must also pass a 15-minute CVD gate that looks for sell pressure exhaustion and a turn-up in cumulative delta.
Defaults are conservative; start with CVD off until you’re comfortable, then enable to filter chop after capitulations.

## Alert payload (minimal by design)

On the event bar close the script fires one alert with a tiny JSON that is easy to route and process in bulk:

```json
{
"event": "Crash_signal_15m",
"symbol": "NVDA",
"symbol_id": "NASDAQ:NVDA",
"ts_alert_15m_ms": 1730898900000,
"ts_alert_15m_local": "2025-11-06 10:45"
}
```

Notes

* ts_alert_15m_ms is the 15-minute close time in milliseconds since epoch (UTC reference).
* ts_alert_15m_local uses your chart’s timezone for readability.

Optional: a 24-hour streaming mode can resend this minimal payload on every 15-minute close during the day after the event (tiny patch available on request).

## Inputs you will actually touch

Bench/Sector symbols

* Bench: SPY or QQQ. Sector: XLK/XLF/XLY… or KWEB/CQQQ depending on the name.

Depth and relative thresholds

* 4h depth ≤ −4%, 8h depth ≤ −6%.
* Relative to market/sector ≤ −3% each.

Macro fuses

* VIX ≥ 28; market ≤ −2.0%/−3.5%; sector ≤ −2.5%/−4.0%.

Z/RSI guards

* Z window 80 bars (15m), stock zTrig ≤ −1.5, macro floors ≥ −1.0.
* RSI(1h) < 30.

AVWAP band engine

* σ EMA length 3; σ cap off by default.
* Retest window for entry C: 24 bars (≈6 hours).

Presentation and hygiene

* One-week entry window; per-type cap 3; debounce 8×15m bars.
* Signal table on/off, label pinning on/off.

## How to run it

1. Open a 15-minute chart (extended hours enabled recommended).
2. Add the indicator and choose Bench/Sector for the names you are reviewing.
3. Create a single alert per chart with Condition = Any alert() function call and Options = Once per bar close.
4. Point the alert to your webhook URL (or use app/email if you don’t have a URL).
5. Let your backend/AI receive the minimal JSON, do the news/fundamentals check, and decide Allow / Hold / Reject.
6. For Allowed names, use the on-chart A–F markers to stage in; manage risk against Event-AVWAP and upper HVNs/POC.

## Defaults that work well

* RSI(1h) < 30
* Depth 4h/8h ≤ −4%/−6% vs yesterday’s reference
* Relative to market/sector ≤ −3%
* Z: stock ≤ −1.5; macro floors ≥ −1.0
* Fuses: VIX ≥ 28; market ≤ −2.0%/−3.5%; sector ≤ −2.5%/−4.0%
* Bands: σ EMA = 3; no σ cap; one-week window; 3 labels per type

## Notes and limitations

* This is an indicator, not an auto-trader. Position sizing and exits are up to you.
* Designed for liquid US equities; thin ADRs and micro-caps are noisy.
* All event logic and entries are evaluated on bar close; AVWAP and bands do not repaint.
* If you need to monitor many symbols without a server, a Scanner variant can batch 10–17 tickers per script and alert without a webhook.

## Change highlights vs earlier generations

* Fixed 15-minute engine for signals and AVWAP (stable across chart TF).
* Depth is measured vs the lower of yesterday’s RTH VWAP proxy and Close.
* Macro circuit breakers added (VIX, market, sector).
* Structure-health (SMA50 coverage) and MA position checks removed.
* AVWAP now plots ±3σ; added Entry F; optional CVD filter; compact webhook payload.

Use in Replay first, then roll out with small size.

Clause de non-responsabilité

Les informations et les publications ne sont pas destinées à être, et ne constituent pas, des conseils ou des recommandations en matière de finance, d'investissement, de trading ou d'autres types de conseils fournis ou approuvés par TradingView. Pour en savoir plus, consultez les Conditions d'utilisation.