OPEN-SOURCE SCRIPT

Intrabar Volume Delta — RealTime + History (Stocks/Crypto/Forex)

105
Intrabar Volume Delta Grid — RealTime + History (Stocks/Crypto/Forex)

# Short Description

Shows intrabar Up/Down volume, Delta (absolute/relative) and UpShare% in a compact grid for both real-time and historical bars. Includes an MTF (M1…D1) dashboard, contextual coloring, density controls, and alerts on Δ and UpShare%. Smart historical splitting (“History Mode”) for Crypto/Futures/FX.

---

# What it does (Quick)

* **UpVol / DownVol / Δ / UpShare%** — visualizes order-flow inside each candle.
* **Real-time** — accumulates intrabar volume live by tick-direction.
* **History Mode** — splits Up/Down on closed bars via simple or range-aware logic.
* **MTF Dashboard** — one table view across M1, M5, M15, M30, H1, H4, D1 (Vol, Up/Down, Δ%, Share, Trend).
* **Contextual opacity** — stronger signals appear bolder.
* **Label density** — draw every N-th bar and limit to last X bars for performance.
* **Alerts** — thresholds for |Δ|, Δ%, and UpShare%.

---

# How it works (Real-Time vs History)

* **Real-time (open bar):** volume increments into **UpVolRT** or **DownVolRT** depending on last price move (↑ goes to Up, ↓ to Down). This approximates live order-flow even when full tick history isn’t available.
* **History (closed bars):**

* **None** — no split (Up/Down = 0/0). Safest for equities/indices with unreliable tick history.
* **Approx (Close vs Open)** — all volume goes to candle direction (green → Up 100%, red → Down 100%). Fast but yields many 0/100% bars.
* **Price Action Based** — splits by Close position within High-Low range; strength = |Close−mid|/(High−Low). Above mid → more Up; below mid → more Down. Falls back to direction if High==Low.
* **Auto** — **Stocks/Index → None**, **Crypto/Futures/FX → Approx**. If you see too many 0/100 bars, switch to **Price Action Based**.

---

# Rows & Meaning

* **Volume** — total bar volume (no split).
* **UpVol / DownVol** — directional intrabar volume.
* **Delta (Δ)** — UpVol − DownVol.

* **Absolute**: raw units
* **Relative (Δ%)**: Δ / (Up+Down) × 100
* **Both**: shows both formats
* **UpShare%** — UpVol / (Up+Down) × 100. >50% bullish, <50% bearish.

* Helpful icons: ▲ (>65%), ▼ (<35%).

---

# MTF Dashboard (🔧 Enable Dashboard)

A single table with **Vol, Up, Down, Δ%, Share, Trend (🔼/🔽/⏭️)** for selected timeframes (M1…D1). Great for a fast “panorama” read of flow alignment across horizons.

---

# Inputs (Grouped)

## Display

* Toggle rows: **Volume / Up / Down / Delta / UpShare**
* **Delta Display**: Absolute / Relative / Both

## Realtime & History

* **History Mode**: Auto / None / Approx / Price Action Based
* **Compact Numbers**: 1.2k, 1.25M, 3.4B…

## Theme & UI

* **Theme Mode**: Auto / Light / Dark
* **Row Spacing**: vertical spacing between rows
* **Top Row Y**: moves the whole grid vertically
* **Draw Guide Lines**: faint dotted guides
* **Text Size**: Tiny / Small / Normal / Large

## 🔧 Dashboard Settings

* **Enable Dashboard**
* **📏 Table Text Size**: Tiny…Huge
* **🦓 Zebra Rows**
* **🔲 Table Border**

## ⏰ Timeframes (for Dashboard)

* **M1…D1** toggles

## Contextual Coloring

* **Enable Contextual Coloring**: opacity by signal strength
* **Δ% cap / Share offset cap**: saturation caps
* **Min/Max transparency**: solid vs faint extremes

## Label Density & Size

* **Show every N-th bar**: draw labels only every Nth bar
* **Limit to last X bars**: keep labels only in the most recent X bars

## Colors

* Up / Down / Text / Guide

## Alerts

* **Delta Threshold (abs)** — |Δ| in volume units
* **UpShare > / <** — bullish/bearish thresholds
* **Enable Δ% Alert**, **Δ% > +**, **Δ% < −** — relative delta levels

---

# How to use (Quick Start)

1. Add the indicator to your chart (overlay=false → separate pane).
2. **History Mode**:

* Crypto/Futures/FX → keep **Auto** or switch to **Price Action Based** for richer history.
* Stocks/Index → prefer **None** or **Price Action Based** for safer splits.
3. **Label Density**: start with **Limit to last X bars = 30–150** and **Show every N-th bar = 2–4**.
4. **Contextual Coloring**: keep on to emphasize strong Δ% / Share moves.
5. **Dashboard**: enable and pick only the TFs you actually use.
6. **Alerts**: set thresholds (ideas below).

---

# Alerts (in TradingView)

Add alert → pick this indicator → choose any of:

* **Delta exceeds threshold** (|Δ| > X)
* **UpShare above threshold** (UpShare% > X)
* **UpShare below threshold** (UpShare% < X)
* **Relative Delta above +X%**
* **Relative Delta below −X%**

**Starter thresholds (tune per symbol & TF):**

* **Crypto M1/M5**: Δ% > +25…35 (bullish), Δ% < −25…−35 (bearish)
* **FX (tick volume)**: UpShare > 60–65% or < 40–35%
* **Stocks (liquid)**: set **Absolute Δ** by typical volume scale (e.g., 50k / 100k / 500k)

---

# Notes by Market Type

* **Crypto/Futures**: 24/7 and high liquidity — **Price Action Based** often gives nicer history splits than Approx.
* **Forex (FX)**: TradingView volume is typically **tick volume** (not true exchange volume). Treat Δ/Share as tick-based flow, still very useful intraday.
* **Stocks/Index**: historical tick detail can be limited. **None** or **Price Action Based** is a safer default. If you see too many 0/100% shares, switch away from Approx.

---

# “All Timeframes” accuracy

* Works on **any TF** (M1 → D1/W1).
* **Real-time accuracy** is strong for the open bar (live accumulation).
* **Historical accuracy** depends on your **History Mode** (None = safest, Approx = fastest/simplest, Price Action Based = more nuanced).
* The MTF dashboard uses `request.security` and therefore follows the same logic per TF.

---

# Trade Ideas (Use-Cases)

* **Scalping (M1–M5)**: a spike in Δ% + UpShare>65% + rising total Vol → momentum entries.
* **Intraday (M5–M30–H1)**: when multiple TFs show aligned Δ%/Share (e.g., M5 & M15 bullish), join the trend.
* **Swing (H4–D1)**: persistent Δ% > 0 and UpShare > 55–60% → structural accumulation bias.

---

# Advantages

* **True-feeling live flow** on the open bar.
* **Adaptable history** (three modes) to match data quality.
* **Clean visual layout** with guides, compact numbers, contextual opacity.
* **MTF snapshot** for quick bias read.
* **Performance controls** (last X bars, every N-th bar).

---

# Limitations & Care

* **FX uses tick volume** — interpret Δ/Share accordingly.
* **History Mode is an approximation** — confirm with trend/structure/liquidity context.
* **Illiquid symbols** can produce noisy or contradictory signals.
* **Too many labels** can slow charts → raise N, lower X, or disable guides.

---

# Best Practices (Checklist)

* Crypto/Futures: prefer **Price Action Based** for history.
* Stocks: **None** or **Price Action Based**; be cautious with **Approx**.
* FX: pair Δ% & UpShare% with session context (London/NY) and volatility.
* If labels overlap: tweak **Row Spacing** and **Text Size**.
* In the dashboard, keep only the TFs you actually act on.
* Alerts: start around **Δ% 25–35** for “punchy” moves, then refine per asset.

---

# FAQ

**1) Why do some closed bars show 0%/100% UpShare?**
You’re on **Approx** history mode. Switch to **Price Action Based** for smoother splits.

**2) Δ% looks strong but price doesn’t move — why?**
Δ% is an **order-flow** measure. Price also depends on liquidity pockets, sessions, news, higher-timeframe structure. Use confirmations.

**3) Performance slowdown — what to do?**
Lower **Limit to last X bars** (e.g., 30–100), increase **Show every N-th bar** (2–6), or disable **Draw Guide Lines**.

**4) Dashboard values don’t “match” the grid exactly?**
Dashboard is multi-TF via `request.security` and follows the history logic per TF. Differences are normal.

---

# Short “Store” Marketing Blurb

Intrabar Volume Delta Grid reveals the order-flow inside every candle (Up/Down, Δ, UpShare%) — live and on history. With smart history splitting, an MTF dashboard, contextual emphasis, and flexible alerts, it helps you spot momentum and bias across Crypto, Forex (tick volume), and Stocks. Tidy labels and compact numbers keep the panel readable and fast.


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.