Quanta Docs

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

Khái niệmrenderplot/vpfr

`vpfr(from, to, rows, va, …)` — Volume Profile Fixed Range

Profile khối lượng trong span thời gian giữa hai anchor `[t, giá]` — zigzag legs, buy/sell split, POC, value area.

Canonical kind nội bộ: volume_profile_fixed. Verb khuyến nghị trong render v2: `vpfr`.

Khác VPVR (neo cạnh pane, full visible range): VPFR tính volume chỉ trong khoảng thời gian giữa hai góc pivot — histogram nằm trong span đó (mặc định anchor histogram on right trong span).

Story-style (khuyến nghị)

quanta
render:
  panel main:
    vpfr [phigh_t, phigh_p] to [plow_t, plow_p] as "Fixed Range Profile" with rows 64 and value area 70pct on right in violet with opacity 14pct
    vpfr [plow_t, plow_p] to [phigh_t, phigh_p] in lime and red with rows 48 on right
    vpfr [phigh_t, phigh_p] to [plow_t, plow_p] in lime and red and white with rows 64 on right

Hướng anchor (giống fibo/box):

  • `from` = góc phải (tín hiệu swing mới).
  • `to` = góc trái (pivot đối diện, ffill).
  • Multi-series: mỗi lần from signal → một VPFR leg (dedup theo thời gian from).
  • Single: vpfr [t[i], p[i]] to [t[j], p[j]] — một profile cố định.

Modifier story:

ModifierÝ nghĩa
as "Tên"Legend
with rows NSố hàng giá (4–256, mặc định 24)
and value area Npct% value area quanh POC
on right / on leftHistogram bám cạnh phải/trái trong span
in violetMàu thống nhất buy + sell
in lime and redBuy / sell tách màu
in lime and red and whiteBuy · sell · POC (màu thứ 3)
with opacity NpctOpacity (14pct → 0.14)
limit by NTối đa N profile gần nhất

Function call

quanta
vpfr(from: [ph_t, ph_p], to: [pl_t, pl_p], rows: 64, va: 70pct, side: right, color: violet, opacity: 14pct, title: "Leg")

Thuật toán

  • Slice OHLCV theo [min(t_from,t_to), max(...)].
  • Bin theo min(L)…max(H) trong window; phân bổ volume H–L; split buy/sell theo close.
  • POC + value area giống VPVR.
  • width_pct mặc định 100 — histogram fill tối đa chiều ngang span (renderer clamp).

Render trên chart

  • Layer QuantaDraw — histogram trong [from, to] time span.
  • Không recompute khi pan tile (merge theo id; khác VPVR).

Ví dụ zigzag legs

quanta
strategy "VPFR Zigzag"
detect:
  h = market.high
  l = market.low
  ph_val = swinghigh(h, 2)
  phigh_t = valuewhen(ph_val, bar.time)
  phigh_p = valuewhen(ph_val, h)
  pl_val = swinglow(l, 2)
  plow_t = valuewhen(pl_val, bar.time)
  plow_p = valuewhen(pl_val, l)
render:
  panel main:
    trendline [phigh_t, phigh_p] to [plow_t, plow_p] in yellow solid
    vpfr [phigh_t, phigh_p] to [plow_t, plow_p] as "Fixed Range Profile" with rows 64 and value area 70pct on right in violet with opacity 14pct
act:
  when true:
    signal(score: 0.1)
#plot#drawing#vpfr#volume#fibonacci
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?").