Quanta Docs

Tài liệu Quanta hoàn chỉnh cho Quant Studio

Khái niệmrenderplot/vpvr

`vpvr(rows, va, side, …)` — Volume Profile Visible Range

Profile khối lượng cố định theo dải giá visible range — buy/sell split, POC, value area; tự recompute khi pan/load tile.

Canonical kind nội bộ: volume_profile. Verb khuyến nghị trong render v2: `vpvr` (alias legacy: volume_profile(...)).

VPVR kiểu TradingView: histogram ngang bám cạnh pane giá, tính từ toàn bộ OHLC đang hiển thị (hoặc lookback bar cuối nếu bạn giới hạn).

Story-style (khuyến nghị)

quanta
render:
  panel main:
    vpvr as "Visible Range Profile" with rows 64 and value area 70pct on right in cyan with opacity 14pct
    vpvr in lime and red with rows 48 and value area 68pct on right with opacity 30pct
    vpvr in lime and red and white with rows 48 on right with opacity 30pct

Modifier story:

ModifierÝ nghĩa
as "Tên"Legend / nhãn plot
with rows NSố hàng giá (4–256, mặc định 24)
and value area Npct% value area quanh POC (70pct → 0.7)
on right / on leftCạnh histogram (mặc định right)
in cyanMàu thống nhất buy + sell
in lime and redBuy lime · sell đỏ (split)
in lime and red and whiteBuy · sell · POC (màu thứ 3)
with opacity NpctOpacity histogram (14pct → 0.14)

Function call (truyền thống)

quanta
vpvr(rows: 64, va: 70pct, side: right, color: cyan, opacity: 14pct)
vpvr(rows: 48, lookback: 120, side: right, buy_color: lime, sell_color: red, poc_color: yellow, width_pct: 25, opacity: 30pct)

Tham số

Tham sốAliasMặc địnhMô tả
rowsbins24Số bin giá (4–256)
lookback0 (full visible)Số bar cuối dùng tính profile; 0 = toàn bộ panel/tile đang load
vavalue_area_pct0.70Tỉ lệ volume value area (70pct = 0.7)
siderightleft hoặc right — cạnh histogram
width_pct25Độ rộng tối đa histogram (% chiều ngang pane, renderer clamp ~5–45%)
colorcyanMàu thống nhất khi không tách buy/sell
buy_color(theo color)Màu volume mua
sell_color(theo color)Màu volume bán
poc_coloryellowĐường POC (Point of Control)
opacity0.30Opacity bin; hàng ngoài value area mờ hơn (~35%)

Thuật toán

  • Phân bổ volume theo High–Low từng bar (không bin theo close đơn).
  • Buy / sell split: tỉ lệ theo vị trí close trong range H–L bar đó.
  • POC — mức giá có tổng volume lớn nhất (đường ngang).
  • Value area — mở rộng từ POC cho đến khi đạt va% tổng volume.

Pan / load tile (Candora)

  • Khi pan trái merge tile lịch sử, engine recompute VP từ toàn bộ OHLC đã merge (một profile duy nhất mỗi panel+side).
  • lookback: 0 (mặc định) = profile cover full visible session, không chỉ tile mới nhất.
  • Chỉ dùng lookback: N khi bạn cố ý giới hạn N bar cuối (ví dụ profile 20 phiên gần nhất).

Render trên chart

  • Layer QuantaDraw (foreground) trên pane giá.
  • Bin trong value area sáng hơn; ngoài VA mờ hơn.
  • Split mode: buy sát trục giá, sell phía trong (side right).

Ví dụ đầy đủ

quanta
strategy "VPVR Demo"
detect:
  c = market.close
render:
  panel main:
    line ema(c, 50) in amber
    vpvr as "VRVP" with rows 64 and value area 70pct on right in cyan with opacity 14pct
act:
  when true:
    signal(score: 0.1)
#plot#drawing#vpvr#volume
Trợ lý Quanta"Học nhanh hơn, hiệu quả hơn cùng AI"

Xin chào! Tôi là trợ lý học ngôn ngữ Quanta. Hỏi tôi về cú pháp, hàm, hoặc cách viết một chiến lược cụ thể (ví dụ: "Làm sao để xác định đỉnh đáy để vẽ trendline?").