OPEN-SOURCE SCRIPT
已更新

OHLC Horizontal Compact + Volume + Buy/Sell

116
A compact, single-row horizontal table for TradingView displaying Open, High, Low, Close (OHLC), net change, percentage change, volume, and buy/sell pressure percentages. The table is fully color-coded for easy interpretation: green for positive values, red for negative, and yellow for neutral. Table position is fully customizable (top, middle, bottom / left, center, right). Ideal for traders who want a concise, real-time snapshot of price action and market sentiment in a single row.

Features:

OHLC values in one horizontal row

Net change (Δ) and % change with directional arrows

Real-time volume display

Buy/Sell pressure % with dynamic coloring

Fully customizable table placement

Works on all timeframes
發行說明

### 1. 📛 Indicator Name
- **Old**: `"OHLC Horizontal Compact + Volume + Buy/Sell"`
- **New**: `"OHLC Compact + Volume + Buy/Sell + Separators"`
- **Change**: The new version adds "Separators" to the name, reflecting a visual enhancement.

---

### 2. 📍 Table Positioning
- **Old**: Uses `i_tab1Ypos + "_" + i_tab1Xpos` as a string to define position.
- **New**: Maps `i_tab1Ypos` and `i_tab1Xpos` to the `position` enum for more precise placement.
- **Improvement**: More robust and readable positioning logic.

---

### 3. 🧱 Table Structure
- **Old**: Table with 9 columns (one per data point).
- **New**: Table with 17 columns (9 data points + 8 separators).
- **Improvement**: Adds visual separators between data points for better readability.

---

### 4. 🔣 Separator Customization
- **Old**: No separators.
- **New**: Adds `sepChar` input to choose separator style (e.g., `│`, `|`, `•`, etc.).
- **Improvement**: Enhances visual clarity and user customization.

---

### 5. 🧮 Buy/Sell Calculation Robustness
- **Old**: Assumes `high - low` is non-zero.
- **New**: Adds `rangeIsZero` check to avoid division by zero when `high == low`.
- **Improvement**: Prevents runtime errors and ensures stability.

---

### 6. 🧠 Percent Change Safety
- **Old**: `(netChange / open[1]) * 100` without checking if `open[1]` is zero.
- **New**: Adds condition `open[1] != 0 ? ... : na`.
- **Improvement**: Avoids division by zero and handles edge cases gracefully.

---

### 7. 🧩 Modular Layout
- **Old**: Direct `table.cell` calls for each data point.
- **New**: Uses helper functions `addData()` and `addSep()` for cleaner layout logic.
- **Improvement**: More maintainable and readable code.

---

### 8. 🎨 Visual Enhancements
- **Old**: Basic layout with consistent background.
- **New**: Adds separators with distinct color (`sepCol`) and customizable character.
- **Improvement**: More polished and user-friendly interface.

---

### 9. 🧾 Minor Renaming
- Variable and group names are slightly renamed for clarity:
- `tab1` → `tab`
- `GP1` → `groupPos`

---

## ✅ Summary
The updated script introduces:
- Better layout with separators
- Safer calculations
- Cleaner code structure
- Enhanced customization options

免責聲明

這些資訊和出版物並不意味著也不構成TradingView提供或認可的金融、投資、交易或其他類型的意見或建議。請在使用條款閱讀更多資訊。