OPEN-SOURCE SCRIPT

VWAP table with color

137




## ๐Ÿ“Š VWAP Table with Color โ€“ Clear VWAP Deviation at a Glance

This script displays a **VWAP (Volume-Weighted Average Price)** table in a non-intrusive, color-coded panel on your chart. It helps you **quickly assess where the current price stands relative to VWAP**, classified into sigma bands (standard deviations). The goal is to provide valuable VWAP insight **without cluttering the chart with multiple lines**.

---

### ๐Ÿ” Purpose & Concept

VWAP is a powerful tool used by institutional traders to measure the average price an asset has traded at throughout the day, based on both volume and price.

In this script:
- We **do not plot traditional VWAP lines** with multiple ยฑ1ฯƒ, ยฑ2ฯƒ, etc., on the chart.
- Instead, we **summarize VWAP and its relative position in a table**, color-coded by deviation.
- This provides the **same information**, but in a **cleaner, minimal, and visually digestible format**.

---

### ๐Ÿง  VWAP Deviation Classification

The script calculates how far the current price is from the VWAP, in units of **standard deviation (ฯƒ)**.

The formula is:

```plaintext
VWAP Delta ฯƒ = (Current Price - VWAP) / Standard Deviation
```

This gives you a normalized value for deviation from VWAP, and it is **clamped between -3 and +3** to avoid extreme outliers.

Each range is color-coded and classified as:

| VWAP ฮ”ฯƒ | Zone | Interpretation | Color |
|---------|---------------|------------------------------------------|--------------|
| -3ฯƒ | Far Below | Strongly below VWAP โ€“ potentially oversold | ๐Ÿ”ด Red |
| -2ฯƒ | Below | Below VWAP โ€“ bearish territory | ๐ŸŸ  Orange |
| -1ฯƒ | Slightly Below| Slightly under VWAP โ€“ weak signal | ๐ŸŸก Yellow |
| 0ฯƒ | At VWAP | Price is around VWAP โ€“ neutral zone | โšช Gray |
| +1ฯƒ | Slightly Above| Slightly above VWAP โ€“ weak bullish | ๐ŸŸข Lime Green |
| +2ฯƒ | Above | Above VWAP โ€“ bullish signal | ๐ŸŸข Green |
| +3ฯƒ | Far Above | Strongly above VWAP โ€“ potentially overbought | ๐ŸŸฆ Teal |

This **compact summary in the table** provides a clear situational view while keeping the chart clean.

---

### โš™๏ธ User Customization

Users can configure:

- **VWAP ฯƒ Multiplier** (default 0.1) to set the width of the optional VWAP band on the chart.
- **Table Position** (Top Center, Bottom Right, etc.).
- **Text Size** and **Text Color**.
- **Hide VWAP logic**: VWAP data can be hidden automatically on higher timeframes (e.g., daily or weekly).
- **Enable/disable the VWAP ยฑฯƒ band lines** (optional visual aid).

---

### ๐Ÿ“ Technical Highlights

- VWAP is recalculated each day using `ta.vwap(hlc3, isNewPeriod, 1)`.
- The band width uses standard deviation and the selected multiplier: `VWAP ยฑ ฯƒ * multiplier`.
- Table updates dynamically with the new VWAP values each day.
- To **avoid floating-point rounding issues**, `vwapDelta` is rounded before comparison, ensuring correct background color display.

---

### โœ… Why Use This?

- Keeps your chart **visually clean and readable**.
- Gives **immediate context** to current price action relative to VWAP.
- Helps **discretionary traders** or **scalpers** decide whether price is stretched too far from the mean.
- Easier than tracking multiple ฯƒ bands manually.

---

### Example Usage:

- On intraday timeframes, you can identify price exhaustion as it hits ยฑ2ฯƒ or ยฑ3ฯƒ.
- On a 5-minute chart, if price touches `+3ฯƒ`, you may consider taking profits on longs.
- On reversal setups, watch for price at `-3ฯƒ` with bullish divergence.

---

### ๐Ÿงฉ Future Enhancements (Optional Ideas)

- Add alerts for when `vwapDelta` crosses thresholds like ยฑ2ฯƒ or ยฑ3ฯƒ.
- Let user select the timeframe for VWAP source (e.g., 1H, 5M, etc.).
- Extend to display VWAP on session or weekly basis.

---

Let me know if you want a version of this script formatted and cleaned up for direct TradingView publication (with annotations, credits, and formatting). Would you like that?

Penafian

Maklumat dan penerbitan adalah tidak dimaksudkan untuk menjadi, dan tidak membentuk, nasihat untuk kewangan, pelaburan, perdagangan dan jenis-jenis lain atau cadangan yang dibekalkan atau disahkan oleh TradingView. Baca dengan lebih lanjut di Terma Penggunaan.