PINE LIBRARY
已更新

VolumeProfile

795
Library "VolumeProfile"
Analyzes volume and price and calculates a volume profile, in particular the Point Of Control and Value Area values.

new(rowSizeInTicks, valueAreaCoverage, startTime)
  Constructor method that creates a new Volume Profile
  Parameters:
    rowSizeInTicks (float): Internal row size (aka resolution) of the volume profile. Useful for most futures contracts would be '1 / syminfo.mintick'. Default '4'.
    valueAreaCoverage (int): Percentage of total volume that is considered the Value Area. Default '70'
    startTime (int): Start time (unix timestamp in milliseconds) of the Volume Profile. Default 'time'.
  Returns: VolumeProfile object

method calculatePOC(vp)
  Calculates current Point Of Control of the VP
  Namespace types: VolumeProfile
  Parameters:
    vp (VolumeProfile)
  Returns: void

method calculateVA(vp)
  Calculates current Value Area High and Low of the VP
  Namespace types: VolumeProfile
  Parameters:
    vp (VolumeProfile)
  Returns: void

method update(vp, h, l, v, t)
  Processes new chart data and sorts volume into rows. Then calls calculatePOC() and calculateVA() to update the VP. Parameters are usually the output of request.security_lower_tf.
  Namespace types: VolumeProfile
  Parameters:
    vp (VolumeProfile)
    h (array<float>): Array of highs
    l (array<float>): Array of lows
    v (array<float>): Array of volumes
    t (array<int>): Array of candle times
  Returns: void

method setSessionHigh(vp, h)
  Sets the high of the session the VP is tracking
  Namespace types: VolumeProfile
  Parameters:
    vp (VolumeProfile)
    h (float)
  Returns: void

method setSessionLow(vp, l)
  Sets the low of the session the VP is tracking
  Namespace types: VolumeProfile
  Parameters:
    vp (VolumeProfile)
    l (float)
  Returns: void

method getPOC(vp)
  Gets the current Point Of Control
  Namespace types: VolumeProfile
  Parameters:
    vp (VolumeProfile)
  Returns: Point Of Control (float)

method getVAH(vp)
  Gets the current Value Area High
  Namespace types: VolumeProfile
  Parameters:
    vp (VolumeProfile)
  Returns: Value Area High (float)

method getVAL(vp)
  Gets the current Value Area Low
  Namespace types: VolumeProfile
  Parameters:
    vp (VolumeProfile)
  Returns: Value Area Low (float)

VolumeProfile
  Fields:
    rowSizeInTicks (series float)
    valueAreaCoverage (series int)
    startTime (series int)
    valueAreaHigh (series float)
    pointOfControl (series float)
    valueAreaLow (series float)
    sessionHigh (series float)
    sessionLow (series float)
    volumeByRow (map<float, float>)
    totalVolume (series float)
    pocRow (series float)
    pocVol (series float)
版本注释
v2:
- update session high/low while reading new data
版本注释
v3: use middle of area with same volume for point of control (especially important on first candle).
版本注释
v4: fix v3 and other bugs that mainly affected PoC and VA calculation when little data is available at the beginning of a VP session
版本注释
v5: hopefully the final bugfix release - I wish pine script made it easier to develop libraries
版本注释
v6: restore intended v3 functionality

免责声明

这些信息和出版物并不意味着也不构成TradingView提供或认可的金融、投资、交易或其它类型的建议或背书。请在使用条款阅读更多信息。