OPEN-SOURCE SCRIPT
Aktualisiert NSF/NBF Boxes

📘 NSF / NBF Extended Boxes (Wyckoff–VSA Smart Zones)
This indicator automatically detects No Supply (NSF) and No Buying / No Demand (NBF) bars using Wyckoff–VSA principles and marks them with extended boxes and a dashed 50% midline.
🟢 NSF (No Supply) — Bullish accumulation signal
🔴 NBF (No Demand) — Bearish distribution signal
Each box extends forward in time to highlight key supply/demand zones, while the dashed midline represents the equilibrium level within that bar.
When price later retests this 50% level, the script triggers a visual marker and an alert condition, helping you spot potential reversals or continuation confirmations.
🧠 Core Features
Automatic detection of No Supply / No Demand bars
Extended boxes with adjustable length and auto-extension
Midline (50%) retest alerts for precise trade timing
Optional EMA trend filter, volume check, and close bias
Works even on symbols without volume data (crypto, indices, FX)
“Test Mode” included for easy visualization and debugging
⚙️ Usage Tips
Use on 5m–4h charts for crypto or stocks to spot professional activity.
Combine with Wyckoff, VSA, or Smart Money Concepts to confirm accumulation/distribution phases.
Look for NSF retests near support in a downtrend → possible long entry.
Look for NBF retests near resistance in an uptrend → possible short entry.
🧩 Parameters
Ignore Volume: disables volume filters for markets with missing data
Use EMA Trend Filter: only confirm signals in direction of trend
Auto-extend Boxes: keeps zones projecting into future bars
Retest Alerts: triggers when price touches midline after formation
💡 Author’s Note
This tool visualizes the often-hidden behavior of smart money absorption and weak demand exhaustion.
Use it as part of a complete trading plan — not as a standalone buy/sell signal
This indicator automatically detects No Supply (NSF) and No Buying / No Demand (NBF) bars using Wyckoff–VSA principles and marks them with extended boxes and a dashed 50% midline.
🟢 NSF (No Supply) — Bullish accumulation signal
🔴 NBF (No Demand) — Bearish distribution signal
Each box extends forward in time to highlight key supply/demand zones, while the dashed midline represents the equilibrium level within that bar.
When price later retests this 50% level, the script triggers a visual marker and an alert condition, helping you spot potential reversals or continuation confirmations.
🧠 Core Features
Automatic detection of No Supply / No Demand bars
Extended boxes with adjustable length and auto-extension
Midline (50%) retest alerts for precise trade timing
Optional EMA trend filter, volume check, and close bias
Works even on symbols without volume data (crypto, indices, FX)
“Test Mode” included for easy visualization and debugging
⚙️ Usage Tips
Use on 5m–4h charts for crypto or stocks to spot professional activity.
Combine with Wyckoff, VSA, or Smart Money Concepts to confirm accumulation/distribution phases.
Look for NSF retests near support in a downtrend → possible long entry.
Look for NBF retests near resistance in an uptrend → possible short entry.
🧩 Parameters
Ignore Volume: disables volume filters for markets with missing data
Use EMA Trend Filter: only confirm signals in direction of trend
Auto-extend Boxes: keeps zones projecting into future bars
Retest Alerts: triggers when price touches midline after formation
💡 Author’s Note
This tool visualizes the often-hidden behavior of smart money absorption and weak demand exhaustion.
Use it as part of a complete trading plan — not as a standalone buy/sell signal
Versionshinweise
# NSF / NBF Boxes — Narrow Spread Formation Detector## Overview
**NSF/NBF Boxes** marks potential **supply zones** (NSF — Narrow Spread Formation) and **demand zones** (NBF — Narrow Base Formation) on any chart and timeframe. Both formations share the same core idea: a candle whose high-low range is significantly narrower than normal represents a moment of **compressed volatility and indecision**, often acting as a magnet for future price action.
- **NSF** (cyan/teal) — narrow-range bar in a **downtrend** → potential supply / resistance area
- **NBF** (red/rose) — narrow-range bar in an **uptrend** → potential demand / support area
Each zone is drawn as a **semi-transparent box** spanning from the signal bar forward, with an optional **dashed midline** marking the exact centre of the formation. Price frequently returns to test — and react from — these midpoints.
---
## How It Works
### 1 · Spread Filter (always active)
The indicator computes a rolling SMA of the high-low spread over the last *N* bars (default 100). A bar qualifies as "narrow" when:
```
current spread < SMA(spread, N) × narrow_multiplier
```
The default multiplier of **0.8** means the bar must be narrower than 80 % of the average. Raising this value produces more signals; lowering it keeps only the tightest compressions.
### 2 · Volume Filter (optional, off by default)
When enabled, the script checks that volume is below its own SMA by a configurable factor. The optional *"also require vol < vol[1] & vol[2]"* flag adds a three-bar declining-volume confirmation so that a single low-volume spike doesn't qualify on its own.
Disable volume filtering for **Forex pairs, indices, or any instrument where tick volume is unreliable**.
### 3 · EMA Trend Filter (on by default, EMA 200)
Aligns signals with the prevailing trend:
- **NSF** only fires when `close < EMA` (bearish context — supply more relevant)
- **NBF** only fires when `close > EMA` (bullish context — demand more relevant)
Disable to get both signal types regardless of trend — useful for ranging markets or when you want to see all compressions.
### 4 · Close Bias Filter (optional, off by default)
Adds an extra layer:
- **NSF** requires the close to be in the **upper half** of the bar (sellers couldn't push price down)
- **NBF** requires the close to be in the **lower half** of the bar (buyers couldn't push price up)
This subtle filter reflects Wyckoff-style logic and is most useful on higher timeframes.
---
## Modes
| Mode | Behaviour |
| **Signal (NSF/NBF)** | Draws boxes only when conditions are met. Default. |
| **Test (plot every bar)** | Draws a grey box on every confirmed bar. Use this to preview box sizing (`Extend bars`) before switching to Signal mode. |
---
## Inputs Reference
### ⚙️ Mode & Display
| Input | Default | Description |
| Mode | Signal | Signal mode or Test mode (see above) |
| Extend boxes (bars right) | 10 | How far each box projects to the right of the signal bar |
| Auto-extend boxes | Off | Continuously stretches all boxes to the current bar. Useful for live monitoring; may be heavy on long histories |
| Use candle BODY only | Off | Uses open/close instead of high/low as box bounds — tighter zones |
| Show NSF/NBF labels | On | Prints tiny "NSF" / "NBF" text above/below each signal bar |
| Show midline | On | Dashed line at the midpoint of each box |
| Show info panel | On | Small status table at the top-right corner of the chart |
### 📡 Signal Filters
| Input | Default | Description |
| Ignore volume | On | Bypasses all volume checks |
| Spread SMA length | 100 | Lookback for the average spread baseline |
| Narrow spread multiplier | 0.8 | `spread < SMA × this` to qualify as narrow |
| Volume SMA length | 20 | Lookback for average volume baseline |
| Low-volume multiplier | 0.8 | `volume < SMA_vol × this` to qualify as low |
| Also require vol < vol[1] & [2] | On | Three-bar declining volume confirmation |
| Close bias | Off | Upper-half close for NSF; lower-half close for NBF |
| EMA trend filter | On | NSF below EMA, NBF above EMA |
| EMA length | 200 | Period for the trend EMA |
---
## Practical Usage
### Entry Confluence
NSF/NBF boxes work best as **zone confluence tools**, not standalone entry triggers. Look for:
- Price returning to a zone after a directional move
- A reversal candle pattern *inside* the box (pin bar, engulfing, etc.)
- Volume expanding on the re-entry candle
- Zone alignment with a higher-timeframe level (swing high/low, round number, prior session close)
### Multi-Timeframe Workflow
1. Add the indicator to a **higher timeframe** (e.g. H4 or Daily) and note the zone locations
2. Drop to your **execution timeframe** (e.g. M15 or H1) and wait for price to reach those zones
3. Use the midline retest alert on your execution timeframe to get notified the moment price touches the midpoint of a formation
### Recommended Settings by Market
| Market | Volume filter | Trend filter | Narrow mult |
| Gold (XAU/USD) | Off | On (EMA 200) | 0.75 |
| Forex majors | Off | On (EMA 200) | 0.80 |
| Indices (futures) | On | On (EMA 50) | 0.80 |
| Crypto | On | Optional | 0.70–0.85 |
| Equities | On | On (EMA 200) | 0.75 |
## Changelog
| Version | Notes |
|---|---|
| 2.0 | Grouped inputs, info dashboard, show/hide midline & labels, signal alerts (not just retest), multi-box retest scanning, array pruning, colour-matched borders |
| 1.0 | Initial release — basic NSF/NBF box drawing with retest alerts |
---
*Built with Pine Script v6. Works on all symbols and timeframes.*
Open-source Skript
Ganz im Sinne von TradingView hat dieser Autor sein/ihr Script als Open-Source veröffentlicht. Auf diese Weise können nun auch andere Trader das Script rezensieren und die Funktionalität überprüfen. Vielen Dank an den Autor! Sie können das Script kostenlos verwenden, aber eine Wiederveröffentlichung des Codes unterliegt unseren Hausregeln.
Haftungsausschluss
Die Informationen und Veröffentlichungen sind nicht als Finanz-, Anlage-, Handels- oder andere Arten von Ratschlägen oder Empfehlungen gedacht, die von TradingView bereitgestellt oder gebilligt werden, und stellen diese nicht dar. Lesen Sie mehr in den Nutzungsbedingungen.
Open-source Skript
Ganz im Sinne von TradingView hat dieser Autor sein/ihr Script als Open-Source veröffentlicht. Auf diese Weise können nun auch andere Trader das Script rezensieren und die Funktionalität überprüfen. Vielen Dank an den Autor! Sie können das Script kostenlos verwenden, aber eine Wiederveröffentlichung des Codes unterliegt unseren Hausregeln.
Haftungsausschluss
Die Informationen und Veröffentlichungen sind nicht als Finanz-, Anlage-, Handels- oder andere Arten von Ratschlägen oder Empfehlungen gedacht, die von TradingView bereitgestellt oder gebilligt werden, und stellen diese nicht dar. Lesen Sie mehr in den Nutzungsbedingungen.