已更新

FC_VolumeEngine

242
Library "FC_VolumeEngine"
Adaptive fine price-grid volume engine: accumulate buy/sell volume, then build volume-profile rows, POC, value area, composites and volume nodes.

smooth(a, len)
  Centered moving average across profile rows
  Parameters:
    a (array<float>): Row values
    len (int): Window length
  Returns: Smoothed copy

gridSize(c, est)
  Fine-grid bucket size for a new period
  Parameters:
    c (Cfg): Config
    est (float): Expected period range (e.g. previous period's range)
  Returns: Bucket size in price

newState()
  New empty state
  Returns: PState with empty arrays

method gpush(s)
  Append one empty bucket
  Namespace types: PState
  Parameters:
    s (PState)

method coarsen(s)
  Halve grid resolution (merge bucket pairs)
  Namespace types: PState
  Parameters:
    s (PState)

method addVol(s, a, b, v, vb, maxG)
  Spread volume uniformly over a price range
  Namespace types: PState
  Parameters:
    s (PState)
    a (float): Range bound
    b (float): Range bound
    v (float): Total volume
    vb (float): Buy volume
    maxG (int): Max buckets

method markBar(s, lo, hi)
  Count one bar visit across a price range (TPO-style)
  Namespace types: PState
  Parameters:
    s (PState)
    lo (float)
    hi (float)

method reset(s, bar, op, hp, lp, cp, ah, gsz)
  Start a new period
  Namespace types: PState
  Parameters:
    s (PState)
    bar (int)
    op (float)
    hp (float)
    lp (float)
    cp (float)
    ah (bool)
    gsz (float)

compute(s, cfg, nRows)
  Build rows, POC and value area
  Parameters:
    s (PState): Period state
    cfg (Cfg): Config
    nRows (int): Row count (ignored in tick mode)
  Returns: PResult or na

merge(snaps, cur, maxG)
  Merge period snapshots + current period into one composite state
  Parameters:
    snaps (array<PState>): Completed-period snapshots
    cur (PState): Current period
    maxG (int): Max buckets
  Returns: Merged PState

nodes(r, win, hvnPct, lvnPct, maxN, wantH, wantL)
  HVN / LVN row indices
  Parameters:
    r (PResult)
    win (int)
    hvnPct (float)
    lvnPct (float)
    maxN (int)
    wantH (bool)
    wantL (bool)
  Returns: [hvn rows, lvn rows]

Cfg
  Engine configuration
  Fields:
    useTick (series bool): Size rows in ticks instead of a fixed row count
    tickRow (series int): Ticks per row when useTick is true
    rows (series int): Row count when useTick is false
    vaPct (series float): Value-area volume percent
    pocMid (series bool): Break POC ties toward the range midpoint
    twoRow (series bool): Use two-row (CBOT) value-area expansion
    maxG (series int): Max fine-grid buckets before coarsening
    maxRows (series int): Max rows in tick mode
    tick (series float): Symbol min tick

PState
  Accumulating period state (fine grid)
  Fields:
    startBar (series int)
    o (series float)
    h (series float)
    l (series float)
    c (series float)
    isAH (series bool)
    base (series float)
    gsz (series float)
    gv (array<float>)
    gu (array<float>)
    gc (array<float>)
    tv (series float)
    tb (series float)
    nBars (series int)
    fpBars (series int)

PResult
  Computed profile
  Fields:
    rv (array<float>)
    ru (array<float>)
    rc (array<float>)
    rowLow (series float)
    rowH (series float)
    n (series int)
    poc (series int)
    vaLo (series int)
    vaHi (series int)
    pocPx (series float)
    vahPx (series float)
    valPx (series float)
    tv (series float)
    tb (series float)
版本注释
v2

免责声明

这些信息和出版物并非旨在提供,也不构成TradingView提供或认可的任何形式的财务、投资、交易或其他类型的建议或推荐。请阅读使用条款了解更多信息。